1// Code generated by smithy-go-codegen DO NOT EDIT. 2 3package waf 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/waf/types" 10 "github.com/aws/smithy-go/middleware" 11 smithyhttp "github.com/aws/smithy-go/transport/http" 12) 13 14// This is AWS WAF Classic documentation. For more information, see AWS WAF Classic 15// (https://docs.aws.amazon.com/waf/latest/developerguide/classic-waf-chapter.html) 16// in the developer guide. For the latest version of AWS WAF, use the AWS WAFV2 API 17// and see the AWS WAF Developer Guide 18// (https://docs.aws.amazon.com/waf/latest/developerguide/waf-chapter.html). With 19// the latest version, AWS WAF has a single set of endpoints for regional and 20// global use. Creates a SqlInjectionMatchSet, which you use to allow, block, or 21// count requests that contain snippets of SQL code in a specified part of web 22// requests. AWS WAF searches for character sequences that are likely to be 23// malicious strings. To create and configure a SqlInjectionMatchSet, perform the 24// following steps: 25// 26// * Use GetChangeToken to get the change token that you provide 27// in the ChangeToken parameter of a CreateSqlInjectionMatchSet request. 28// 29// * Submit 30// a CreateSqlInjectionMatchSet request. 31// 32// * Use GetChangeToken to get the change 33// token that you provide in the ChangeToken parameter of an 34// UpdateSqlInjectionMatchSet request. 35// 36// * Submit an UpdateSqlInjectionMatchSet 37// request to specify the parts of web requests in which you want to allow, block, 38// or count malicious SQL code. 39// 40// For more information about how to use the AWS WAF 41// API to allow or block HTTP requests, see the AWS WAF Developer Guide 42// (https://docs.aws.amazon.com/waf/latest/developerguide/). 43func (c *Client) CreateSqlInjectionMatchSet(ctx context.Context, params *CreateSqlInjectionMatchSetInput, optFns ...func(*Options)) (*CreateSqlInjectionMatchSetOutput, error) { 44 if params == nil { 45 params = &CreateSqlInjectionMatchSetInput{} 46 } 47 48 result, metadata, err := c.invokeOperation(ctx, "CreateSqlInjectionMatchSet", params, optFns, addOperationCreateSqlInjectionMatchSetMiddlewares) 49 if err != nil { 50 return nil, err 51 } 52 53 out := result.(*CreateSqlInjectionMatchSetOutput) 54 out.ResultMetadata = metadata 55 return out, nil 56} 57 58// A request to create a SqlInjectionMatchSet. 59type CreateSqlInjectionMatchSetInput struct { 60 61 // The value returned by the most recent call to GetChangeToken. 62 // 63 // This member is required. 64 ChangeToken *string 65 66 // A friendly name or description for the SqlInjectionMatchSet that you're 67 // creating. You can't change Name after you create the SqlInjectionMatchSet. 68 // 69 // This member is required. 70 Name *string 71} 72 73// The response to a CreateSqlInjectionMatchSet request. 74type CreateSqlInjectionMatchSetOutput struct { 75 76 // The ChangeToken that you used to submit the CreateSqlInjectionMatchSet request. 77 // You can also use this value to query the status of the request. For more 78 // information, see GetChangeTokenStatus. 79 ChangeToken *string 80 81 // A SqlInjectionMatchSet. 82 SqlInjectionMatchSet *types.SqlInjectionMatchSet 83 84 // Metadata pertaining to the operation's result. 85 ResultMetadata middleware.Metadata 86} 87 88func addOperationCreateSqlInjectionMatchSetMiddlewares(stack *middleware.Stack, options Options) (err error) { 89 err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateSqlInjectionMatchSet{}, middleware.After) 90 if err != nil { 91 return err 92 } 93 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateSqlInjectionMatchSet{}, middleware.After) 94 if err != nil { 95 return err 96 } 97 if err = addSetLoggerMiddleware(stack, options); err != nil { 98 return err 99 } 100 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 101 return err 102 } 103 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 104 return err 105 } 106 if err = addResolveEndpointMiddleware(stack, options); err != nil { 107 return err 108 } 109 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 110 return err 111 } 112 if err = addRetryMiddlewares(stack, options); err != nil { 113 return err 114 } 115 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 116 return err 117 } 118 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 119 return err 120 } 121 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 122 return err 123 } 124 if err = addClientUserAgent(stack); err != nil { 125 return err 126 } 127 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 128 return err 129 } 130 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 131 return err 132 } 133 if err = addOpCreateSqlInjectionMatchSetValidationMiddleware(stack); err != nil { 134 return err 135 } 136 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateSqlInjectionMatchSet(options.Region), middleware.Before); err != nil { 137 return err 138 } 139 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 140 return err 141 } 142 if err = addResponseErrorMiddleware(stack); err != nil { 143 return err 144 } 145 if err = addRequestResponseLogging(stack, options); err != nil { 146 return err 147 } 148 return nil 149} 150 151func newServiceMetadataMiddleware_opCreateSqlInjectionMatchSet(region string) *awsmiddleware.RegisterServiceMetadata { 152 return &awsmiddleware.RegisterServiceMetadata{ 153 Region: region, 154 ServiceID: ServiceID, 155 SigningName: "waf", 156 OperationName: "CreateSqlInjectionMatchSet", 157 } 158} 159