1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package fms 4 5import ( 6 "context" 7 awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware" 8 "github.com/aws/aws-sdk-go-v2/aws/signer/v4" 9 "github.com/aws/aws-sdk-go-v2/service/fms/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12 "time" 13) 14 15// If you created a Shield Advanced policy, returns policy-level attack summary 16// information in the event of a potential DDoS attack. Other policy types are 17// currently unsupported. 18func (c *Client) GetProtectionStatus(ctx context.Context, params *GetProtectionStatusInput, optFns ...func(*Options)) (*GetProtectionStatusOutput, error) { 19 if params == nil { 20 params = &GetProtectionStatusInput{} 21 } 22 23 result, metadata, err := c.invokeOperation(ctx, "GetProtectionStatus", params, optFns, c.addOperationGetProtectionStatusMiddlewares) 24 if err != nil { 25 return nil, err 26 } 27 28 out := result.(*GetProtectionStatusOutput) 29 out.ResultMetadata = metadata 30 return out, nil 31} 32 33type GetProtectionStatusInput struct { 34 35 // The ID of the policy for which you want to get the attack information. 36 // 37 // This member is required. 38 PolicyId *string 39 40 // The end of the time period to query for the attacks. This is a timestamp type. 41 // The request syntax listing indicates a number type because the default used by 42 // Firewall Manager is Unix time in seconds. However, any valid timestamp format is 43 // allowed. 44 EndTime *time.Time 45 46 // Specifies the number of objects that you want Firewall Manager to return for 47 // this request. If you have more objects than the number that you specify for 48 // MaxResults, the response includes a NextToken value that you can use to get 49 // another batch of objects. 50 MaxResults *int32 51 52 // The Amazon Web Services account that is in scope of the policy that you want to 53 // get the details for. 54 MemberAccountId *string 55 56 // If you specify a value for MaxResults and you have more objects than the number 57 // that you specify for MaxResults, Firewall Manager returns a NextToken value in 58 // the response, which you can use to retrieve another group of objects. For the 59 // second and subsequent GetProtectionStatus requests, specify the value of 60 // NextToken from the previous response to get information about another batch of 61 // objects. 62 NextToken *string 63 64 // The start of the time period to query for the attacks. This is a timestamp type. 65 // The request syntax listing indicates a number type because the default used by 66 // Firewall Manager is Unix time in seconds. However, any valid timestamp format is 67 // allowed. 68 StartTime *time.Time 69 70 noSmithyDocumentSerde 71} 72 73type GetProtectionStatusOutput struct { 74 75 // The ID of the Firewall Manager administrator account for this policy. 76 AdminAccountId *string 77 78 // Details about the attack, including the following: 79 // 80 // * Attack type 81 // 82 // * Account 83 // ID 84 // 85 // * ARN of the resource attacked 86 // 87 // * Start time of the attack 88 // 89 // * End time of 90 // the attack (ongoing attacks will not have an end time) 91 // 92 // The details are in JSON 93 // format. 94 Data *string 95 96 // If you have more objects than the number that you specified for MaxResults in 97 // the request, the response includes a NextToken value. To list more objects, 98 // submit another GetProtectionStatus request, and specify the NextToken value from 99 // the response in the NextToken value in the next request. Amazon Web Services 100 // SDKs provide auto-pagination that identify NextToken in a response and make 101 // subsequent request calls automatically on your behalf. However, this feature is 102 // not supported by GetProtectionStatus. You must submit subsequent requests with 103 // NextToken using your own processes. 104 NextToken *string 105 106 // The service type that is protected by the policy. Currently, this is always 107 // SHIELD_ADVANCED. 108 ServiceType types.SecurityServiceType 109 110 // Metadata pertaining to the operation's result. 111 ResultMetadata middleware.Metadata 112 113 noSmithyDocumentSerde 114} 115 116func (c *Client) addOperationGetProtectionStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { 117 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetProtectionStatus{}, middleware.After) 118 if err != nil { 119 return err 120 } 121 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetProtectionStatus{}, middleware.After) 122 if err != nil { 123 return err 124 } 125 if err = addSetLoggerMiddleware(stack, options); err != nil { 126 return err 127 } 128 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 129 return err 130 } 131 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 132 return err 133 } 134 if err = addResolveEndpointMiddleware(stack, options); err != nil { 135 return err 136 } 137 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 138 return err 139 } 140 if err = addRetryMiddlewares(stack, options); err != nil { 141 return err 142 } 143 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 144 return err 145 } 146 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 147 return err 148 } 149 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 150 return err 151 } 152 if err = addClientUserAgent(stack); err != nil { 153 return err 154 } 155 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 156 return err 157 } 158 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 159 return err 160 } 161 if err = addOpGetProtectionStatusValidationMiddleware(stack); err != nil { 162 return err 163 } 164 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetProtectionStatus(options.Region), middleware.Before); err != nil { 165 return err 166 } 167 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 168 return err 169 } 170 if err = addResponseErrorMiddleware(stack); err != nil { 171 return err 172 } 173 if err = addRequestResponseLogging(stack, options); err != nil { 174 return err 175 } 176 return nil 177} 178 179func newServiceMetadataMiddleware_opGetProtectionStatus(region string) *awsmiddleware.RegisterServiceMetadata { 180 return &awsmiddleware.RegisterServiceMetadata{ 181 Region: region, 182 ServiceID: ServiceID, 183 SigningName: "fms", 184 OperationName: "GetProtectionStatus", 185 } 186} 187