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, 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 // AWS Firewall Manager is Unix time in seconds. However, any valid timestamp 43 // format is allowed. 44 EndTime *time.Time 45 46 // Specifies the number of objects that you want AWS 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 AWS account that is in scope of the policy that you want to get the details 53 // 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, AWS Firewall Manager returns a NextToken value 58 // in 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 // AWS Firewall Manager is Unix time in seconds. However, any valid timestamp 67 // format is allowed. 68 StartTime *time.Time 69} 70 71type GetProtectionStatusOutput struct { 72 73 // The ID of the AWS Firewall administrator account for this policy. 74 AdminAccountId *string 75 76 // Details about the attack, including the following: 77 // 78 // * Attack type 79 // 80 // * Account 81 // ID 82 // 83 // * ARN of the resource attacked 84 // 85 // * Start time of the attack 86 // 87 // * End time of 88 // the attack (ongoing attacks will not have an end time) 89 // 90 // The details are in JSON 91 // format. 92 Data *string 93 94 // If you have more objects than the number that you specified for MaxResults in 95 // the request, the response includes a NextToken value. To list more objects, 96 // submit another GetProtectionStatus request, and specify the NextToken value from 97 // the response in the NextToken value in the next request. AWS SDKs provide 98 // auto-pagination that identify NextToken in a response and make subsequent 99 // request calls automatically on your behalf. However, this feature is not 100 // supported by GetProtectionStatus. You must submit subsequent requests with 101 // NextToken using your own processes. 102 NextToken *string 103 104 // The service type that is protected by the policy. Currently, this is always 105 // SHIELD_ADVANCED. 106 ServiceType types.SecurityServiceType 107 108 // Metadata pertaining to the operation's result. 109 ResultMetadata middleware.Metadata 110} 111 112func addOperationGetProtectionStatusMiddlewares(stack *middleware.Stack, options Options) (err error) { 113 err = stack.Serialize.Add(&awsAwsjson11_serializeOpGetProtectionStatus{}, middleware.After) 114 if err != nil { 115 return err 116 } 117 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpGetProtectionStatus{}, middleware.After) 118 if err != nil { 119 return err 120 } 121 if err = addSetLoggerMiddleware(stack, options); err != nil { 122 return err 123 } 124 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 125 return err 126 } 127 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addResolveEndpointMiddleware(stack, options); err != nil { 131 return err 132 } 133 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 134 return err 135 } 136 if err = addRetryMiddlewares(stack, options); err != nil { 137 return err 138 } 139 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 140 return err 141 } 142 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 143 return err 144 } 145 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 146 return err 147 } 148 if err = addClientUserAgent(stack); err != nil { 149 return err 150 } 151 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 152 return err 153 } 154 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 155 return err 156 } 157 if err = addOpGetProtectionStatusValidationMiddleware(stack); err != nil { 158 return err 159 } 160 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opGetProtectionStatus(options.Region), middleware.Before); err != nil { 161 return err 162 } 163 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 164 return err 165 } 166 if err = addResponseErrorMiddleware(stack); err != nil { 167 return err 168 } 169 if err = addRequestResponseLogging(stack, options); err != nil { 170 return err 171 } 172 return nil 173} 174 175func newServiceMetadataMiddleware_opGetProtectionStatus(region string) *awsmiddleware.RegisterServiceMetadata { 176 return &awsmiddleware.RegisterServiceMetadata{ 177 Region: region, 178 ServiceID: ServiceID, 179 SigningName: "fms", 180 OperationName: "GetProtectionStatus", 181 } 182} 183