diff --git a/.changelog/4c52821949634858bfee20de3a9323bd.json b/.changelog/4c52821949634858bfee20de3a9323bd.json new file mode 100644 index 00000000000..331e033e364 --- /dev/null +++ b/.changelog/4c52821949634858bfee20de3a9323bd.json @@ -0,0 +1,8 @@ +{ + "id": "4c528219-4963-4858-bfee-20de3a9323bd", + "type": "documentation", + "description": "This release includes an update to the mtu value for CreateTransitVirtualInterface from 9001 mtu to 8500 mtu.", + "modules": [ + "service/directconnect" + ] +} \ No newline at end of file diff --git a/.changelog/bab1c7beb1db401dbc3010b679d39c86.json b/.changelog/bab1c7beb1db401dbc3010b679d39c86.json new file mode 100644 index 00000000000..4962e9e6c5e --- /dev/null +++ b/.changelog/bab1c7beb1db401dbc3010b679d39c86.json @@ -0,0 +1,8 @@ +{ + "id": "bab1c7be-b1db-401d-bc30-10b679d39c86", + "type": "feature", + "description": "Add Support for Tags for Custom Entity Types", + "modules": [ + "service/glue" + ] +} \ No newline at end of file diff --git a/.changelog/cdccd3b2b3ed4ac6a3015d9fdc816c68.json b/.changelog/cdccd3b2b3ed4ac6a3015d9fdc816c68.json new file mode 100644 index 00000000000..784014057d3 --- /dev/null +++ b/.changelog/cdccd3b2b3ed4ac6a3015d9fdc816c68.json @@ -0,0 +1,8 @@ +{ + "id": "cdccd3b2-b3ed-4ac6-a301-5d9fdc816c68", + "type": "feature", + "description": "Added and updated API operations in Detective to support the integration of ASFF Security Hub findings.", + "modules": [ + "service/detective" + ] +} \ No newline at end of file diff --git a/.changelog/e8d908a92ee64a3e9cc2dcb82872789c.json b/.changelog/e8d908a92ee64a3e9cc2dcb82872789c.json new file mode 100644 index 00000000000..ebe1adf0d6f --- /dev/null +++ b/.changelog/e8d908a92ee64a3e9cc2dcb82872789c.json @@ -0,0 +1,8 @@ +{ + "id": "e8d908a9-2ee6-4a3e-9cc2-dcb82872789c", + "type": "documentation", + "description": "Documentation updates for Secrets Manager", + "modules": [ + "service/secretsmanager" + ] +} \ No newline at end of file diff --git a/.changelog/ebc5d26468374091a8ceb92831df9aba.json b/.changelog/ebc5d26468374091a8ceb92831df9aba.json new file mode 100644 index 00000000000..7241c096095 --- /dev/null +++ b/.changelog/ebc5d26468374091a8ceb92831df9aba.json @@ -0,0 +1,8 @@ +{ + "id": "ebc5d264-6837-4091-a8ce-b92831df9aba", + "type": "feature", + "description": "My AWS Service (placeholder) - You can now rate limit web requests based on aggregation keys other than IP addresses, and you can aggregate using combinations of keys. You can also rate limit all requests that match a scope-down statement, without further aggregation.", + "modules": [ + "service/wafv2" + ] +} \ No newline at end of file diff --git a/service/customerprofiles/internal/endpoints/endpoints.go b/service/customerprofiles/internal/endpoints/endpoints.go index 293e010f93a..6a794b92914 100644 --- a/service/customerprofiles/internal/endpoints/endpoints.go +++ b/service/customerprofiles/internal/endpoints/endpoints.go @@ -155,18 +155,63 @@ var defaultPartitions = endpoints.Partitions{ endpoints.EndpointKey{ Region: "ca-central-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "ca-central-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "profile-fips.ca-central-1.amazonaws.com", + }, endpoints.EndpointKey{ Region: "eu-central-1", }: endpoints.Endpoint{}, endpoints.EndpointKey{ Region: "eu-west-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "fips-ca-central-1", + }: endpoints.Endpoint{ + Hostname: "profile-fips.ca-central-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "ca-central-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-east-1", + }: endpoints.Endpoint{ + Hostname: "profile-fips.us-east-1.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-east-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "fips-us-west-2", + }: endpoints.Endpoint{ + Hostname: "profile-fips.us-west-2.amazonaws.com", + CredentialScope: endpoints.CredentialScope{ + Region: "us-west-2", + }, + Deprecated: aws.TrueTernary, + }, endpoints.EndpointKey{ Region: "us-east-1", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "profile-fips.us-east-1.amazonaws.com", + }, endpoints.EndpointKey{ Region: "us-west-2", }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-west-2", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "profile-fips.us-west-2.amazonaws.com", + }, }, }, { diff --git a/service/detective/types/enums.go b/service/detective/types/enums.go index c15cb5154b1..7c445f6041f 100644 --- a/service/detective/types/enums.go +++ b/service/detective/types/enums.go @@ -6,8 +6,9 @@ type DatasourcePackage string // Enum values for DatasourcePackage const ( - DatasourcePackageDetectiveCore DatasourcePackage = "DETECTIVE_CORE" - DatasourcePackageEksAudit DatasourcePackage = "EKS_AUDIT" + DatasourcePackageDetectiveCore DatasourcePackage = "DETECTIVE_CORE" + DatasourcePackageEksAudit DatasourcePackage = "EKS_AUDIT" + DatasourcePackageAsffSecurityhubFinding DatasourcePackage = "ASFF_SECURITYHUB_FINDING" ) // Values returns all known values for DatasourcePackage. Note that this can be @@ -17,6 +18,7 @@ func (DatasourcePackage) Values() []DatasourcePackage { return []DatasourcePackage{ "DETECTIVE_CORE", "EKS_AUDIT", + "ASFF_SECURITYHUB_FINDING", } } diff --git a/service/directconnect/api_op_AllocatePrivateVirtualInterface.go b/service/directconnect/api_op_AllocatePrivateVirtualInterface.go index 06c8d50f645..83728e9c0d9 100644 --- a/service/directconnect/api_op_AllocatePrivateVirtualInterface.go +++ b/service/directconnect/api_op_AllocatePrivateVirtualInterface.go @@ -100,7 +100,7 @@ type AllocatePrivateVirtualInterfaceOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/api_op_AllocatePublicVirtualInterface.go b/service/directconnect/api_op_AllocatePublicVirtualInterface.go index 4e7ffb38a2b..63c9fe33b92 100644 --- a/service/directconnect/api_op_AllocatePublicVirtualInterface.go +++ b/service/directconnect/api_op_AllocatePublicVirtualInterface.go @@ -105,7 +105,7 @@ type AllocatePublicVirtualInterfaceOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/api_op_AssociateVirtualInterface.go b/service/directconnect/api_op_AssociateVirtualInterface.go index 0f6c3deae1e..cac08b0dcb3 100644 --- a/service/directconnect/api_op_AssociateVirtualInterface.go +++ b/service/directconnect/api_op_AssociateVirtualInterface.go @@ -101,7 +101,7 @@ type AssociateVirtualInterfaceOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/api_op_CreatePrivateVirtualInterface.go b/service/directconnect/api_op_CreatePrivateVirtualInterface.go index 71ecefebbc3..18f10dff404 100644 --- a/service/directconnect/api_op_CreatePrivateVirtualInterface.go +++ b/service/directconnect/api_op_CreatePrivateVirtualInterface.go @@ -103,7 +103,7 @@ type CreatePrivateVirtualInterfaceOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/api_op_CreatePublicVirtualInterface.go b/service/directconnect/api_op_CreatePublicVirtualInterface.go index 75c5dd29113..893191698f1 100644 --- a/service/directconnect/api_op_CreatePublicVirtualInterface.go +++ b/service/directconnect/api_op_CreatePublicVirtualInterface.go @@ -96,7 +96,7 @@ type CreatePublicVirtualInterfaceOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/api_op_UpdateVirtualInterfaceAttributes.go b/service/directconnect/api_op_UpdateVirtualInterfaceAttributes.go index 9ff4abda2c2..3e70188e2a7 100644 --- a/service/directconnect/api_op_UpdateVirtualInterfaceAttributes.go +++ b/service/directconnect/api_op_UpdateVirtualInterfaceAttributes.go @@ -103,7 +103,7 @@ type UpdateVirtualInterfaceAttributesOutput struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/directconnect/types/types.go b/service/directconnect/types/types.go index 7f69a1d3af8..9ceadee037d 100644 --- a/service/directconnect/types/types.go +++ b/service/directconnect/types/types.go @@ -821,7 +821,7 @@ type NewTransitVirtualInterfaceAllocation struct { CustomerAddress *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The tags associated with the transitive virtual interface. @@ -967,7 +967,7 @@ type VirtualInterface struct { Location *string // The maximum transmission unit (MTU), in bytes. The supported values are 1500 - // and 9001. The default value is 1500. + // and 8500. The default value is 1500 Mtu *int32 // The ID of the Amazon Web Services account that owns the virtual interface. diff --git a/service/glue/api_op_CreateCustomEntityType.go b/service/glue/api_op_CreateCustomEntityType.go index 0265252fb13..4d19303060b 100644 --- a/service/glue/api_op_CreateCustomEntityType.go +++ b/service/glue/api_op_CreateCustomEntityType.go @@ -48,6 +48,9 @@ type CreateCustomEntityTypeInput struct { // data. If no context words are passed only a regular expression is checked. ContextWords []string + // A list of tags applied to the custom entity type. + Tags map[string]string + noSmithyDocumentSerde } diff --git a/service/glue/api_op_ListCustomEntityTypes.go b/service/glue/api_op_ListCustomEntityTypes.go index 6b1c6b0fa71..b32936c5ef8 100644 --- a/service/glue/api_op_ListCustomEntityTypes.go +++ b/service/glue/api_op_ListCustomEntityTypes.go @@ -36,6 +36,9 @@ type ListCustomEntityTypesInput struct { // A paginated token to offset the results. NextToken *string + // A list of key-value pair tags. + Tags map[string]string + noSmithyDocumentSerde } diff --git a/service/glue/serializers.go b/service/glue/serializers.go index bed86d3d935..794a4805f14 100644 --- a/service/glue/serializers.go +++ b/service/glue/serializers.go @@ -19679,6 +19679,13 @@ func awsAwsjson11_serializeOpDocumentCreateCustomEntityTypeInput(v *CreateCustom ok.String(*v.RegexString) } + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsAwsjson11_serializeDocumentTagsMap(v.Tags, ok); err != nil { + return err + } + } + return nil } @@ -22525,6 +22532,13 @@ func awsAwsjson11_serializeOpDocumentListCustomEntityTypesInput(v *ListCustomEnt ok.String(*v.NextToken) } + if v.Tags != nil { + ok := object.Key("Tags") + if err := awsAwsjson11_serializeDocumentTagsMap(v.Tags, ok); err != nil { + return err + } + } + return nil } diff --git a/service/rbin/internal/endpoints/endpoints.go b/service/rbin/internal/endpoints/endpoints.go index a284192867b..5c80476db6e 100644 --- a/service/rbin/internal/endpoints/endpoints.go +++ b/service/rbin/internal/endpoints/endpoints.go @@ -358,6 +358,26 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIso, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-iso-east-1", + }: endpoints.Endpoint{ + Hostname: "rbin-fips.us-iso-east-1.c2s.ic.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-iso-east-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "us-iso-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-iso-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rbin-fips.us-iso-east-1.c2s.ic.gov", + }, + }, }, { ID: "aws-iso-b", @@ -379,6 +399,26 @@ var defaultPartitions = endpoints.Partitions{ }, RegionRegex: partitionRegexp.AwsIsoB, IsRegionalized: true, + Endpoints: endpoints.Endpoints{ + endpoints.EndpointKey{ + Region: "fips-us-isob-east-1", + }: endpoints.Endpoint{ + Hostname: "rbin-fips.us-isob-east-1.sc2s.sgov.gov", + CredentialScope: endpoints.CredentialScope{ + Region: "us-isob-east-1", + }, + Deprecated: aws.TrueTernary, + }, + endpoints.EndpointKey{ + Region: "us-isob-east-1", + }: endpoints.Endpoint{}, + endpoints.EndpointKey{ + Region: "us-isob-east-1", + Variant: endpoints.FIPSVariant, + }: { + Hostname: "rbin-fips.us-isob-east-1.sc2s.sgov.gov", + }, + }, }, { ID: "aws-iso-e", diff --git a/service/secretsmanager/api_op_DeleteSecret.go b/service/secretsmanager/api_op_DeleteSecret.go index 3dbfaa95be9..0b4cb7cde55 100644 --- a/service/secretsmanager/api_op_DeleteSecret.go +++ b/service/secretsmanager/api_op_DeleteSecret.go @@ -71,10 +71,12 @@ type DeleteSecretInput struct { // Secrets Manager performs the actual deletion with an asynchronous background // process, so there might be a short delay before the secret is permanently // deleted. If you delete a secret and then immediately create a secret with the - // same name, use appropriate back off and retry logic. Use this parameter with - // caution. This parameter causes the operation to skip the normal recovery window - // before the permanent deletion that Secrets Manager would normally impose with - // the RecoveryWindowInDays parameter. If you delete a secret with the + // same name, use appropriate back off and retry logic. If you forcibly delete an + // already deleted or nonexistent secret, the operation does not return + // ResourceNotFoundException . Use this parameter with caution. This parameter + // causes the operation to skip the normal recovery window before the permanent + // deletion that Secrets Manager would normally impose with the + // RecoveryWindowInDays parameter. If you delete a secret with the // ForceDeleteWithoutRecovery parameter, then you have no opportunity to recover // the secret. You lose the secret permanently. ForceDeleteWithoutRecovery *bool diff --git a/service/secretsmanager/api_op_DescribeSecret.go b/service/secretsmanager/api_op_DescribeSecret.go index 917cd32d034..aec38fef391 100644 --- a/service/secretsmanager/api_op_DescribeSecret.go +++ b/service/secretsmanager/api_op_DescribeSecret.go @@ -88,9 +88,8 @@ type DescribeSecretOutput struct { // The name of the secret. Name *string - // The next date and time that Secrets Manager will rotate the secret, rounded to - // the nearest hour. If the secret isn't configured for rotation, Secrets Manager - // returns null. + // The next rotation is scheduled to occur on or before this date. If the secret + // isn't configured for rotation, Secrets Manager returns null. NextRotationDate *time.Time // The ID of the service that created this secret. For more information, see diff --git a/service/secretsmanager/types/types.go b/service/secretsmanager/types/types.go index 6869576a43e..c346c679230 100644 --- a/service/secretsmanager/types/types.go +++ b/service/secretsmanager/types/types.go @@ -161,9 +161,8 @@ type SecretListEntry struct { // the folder prod . Name *string - // The next date and time that Secrets Manager will attempt to rotate the secret, - // rounded to the nearest hour. This value is null if the secret is not set up for - // rotation. + // The next rotation is scheduled to occur on or before this date. If the secret + // isn't configured for rotation, Secrets Manager returns null. NextRotationDate *time.Time // Returns the name of the service that created the secret. diff --git a/service/wafv2/api_op_GetRateBasedStatementManagedKeys.go b/service/wafv2/api_op_GetRateBasedStatementManagedKeys.go index 17947131818..d8cb0f06f17 100644 --- a/service/wafv2/api_op_GetRateBasedStatementManagedKeys.go +++ b/service/wafv2/api_op_GetRateBasedStatementManagedKeys.go @@ -11,19 +11,21 @@ import ( smithyhttp "github.com/aws/smithy-go/transport/http" ) -// Retrieves the keys that are currently blocked by a rate-based rule instance. -// The maximum number of managed keys that can be blocked for a single rate-based -// rule instance is 10,000. If more than 10,000 addresses exceed the rate limit, -// those with the highest rates are blocked. For a rate-based rule that you've -// defined inside a rule group, provide the name of the rule group reference -// statement in your request, in addition to the rate-based rule name and the web -// ACL name. WAF monitors web requests and manages keys independently for each -// unique combination of web ACL, optional rule group, and rate-based rule. For -// example, if you define a rate-based rule inside a rule group, and then use the -// rule group in a web ACL, WAF monitors web requests and manages keys for that web -// ACL, rule group reference statement, and rate-based rule instance. If you use -// the same rule group in a second web ACL, WAF monitors web requests and manages -// keys for this second usage completely independent of your first. +// Retrieves the IP addresses that are currently blocked by a rate-based rule +// instance. This is only available for rate-based rules that aggregate solely on +// the IP address or on the forwarded IP address. The maximum number of addresses +// that can be blocked for a single rate-based rule instance is 10,000. If more +// than 10,000 addresses exceed the rate limit, those with the highest rates are +// blocked. For a rate-based rule that you've defined inside a rule group, provide +// the name of the rule group reference statement in your request, in addition to +// the rate-based rule name and the web ACL name. WAF monitors web requests and +// manages keys independently for each unique combination of web ACL, optional rule +// group, and rate-based rule. For example, if you define a rate-based rule inside +// a rule group, and then use the rule group in a web ACL, WAF monitors web +// requests and manages keys for that web ACL, rule group reference statement, and +// rate-based rule instance. If you use the same rule group in a second web ACL, +// WAF monitors web requests and manages keys for this second usage completely +// independent of your first. func (c *Client) GetRateBasedStatementManagedKeys(ctx context.Context, params *GetRateBasedStatementManagedKeysInput, optFns ...func(*Options)) (*GetRateBasedStatementManagedKeysOutput, error) { if params == nil { params = &GetRateBasedStatementManagedKeysInput{} diff --git a/service/wafv2/deserializers.go b/service/wafv2/deserializers.go index 8f4e9fd2705..6f2fab981d5 100644 --- a/service/wafv2/deserializers.go +++ b/service/wafv2/deserializers.go @@ -3037,6 +3037,9 @@ func awsAwsjson11_deserializeOpErrorGetRateBasedStatementManagedKeys(response *s case strings.EqualFold("WAFNonexistentItemException", errorCode): return awsAwsjson11_deserializeErrorWAFNonexistentItemException(response, errorBody) + case strings.EqualFold("WAFUnsupportedAggregateKeyTypeException", errorCode): + return awsAwsjson11_deserializeErrorWAFUnsupportedAggregateKeyTypeException(response, errorBody) + default: genericError := &smithy.GenericAPIError{ Code: errorCode, @@ -6992,6 +6995,41 @@ func awsAwsjson11_deserializeErrorWAFUnavailableEntityException(response *smithy return output } +func awsAwsjson11_deserializeErrorWAFUnsupportedAggregateKeyTypeException(response *smithyhttp.Response, errorBody *bytes.Reader) error { + var buff [1024]byte + ringBuffer := smithyio.NewRingBuffer(buff[:]) + + body := io.TeeReader(errorBody, ringBuffer) + decoder := json.NewDecoder(body) + decoder.UseNumber() + var shape interface{} + if err := decoder.Decode(&shape); err != nil && err != io.EOF { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + output := &types.WAFUnsupportedAggregateKeyTypeException{} + err := awsAwsjson11_deserializeDocumentWAFUnsupportedAggregateKeyTypeException(&output, shape) + + if err != nil { + var snapshot bytes.Buffer + io.Copy(&snapshot, ringBuffer) + err = &smithy.DeserializationError{ + Err: fmt.Errorf("failed to decode response body, %w", err), + Snapshot: snapshot.Bytes(), + } + return err + } + + errorBody.Seek(0, io.SeekStart) + return output +} + func awsAwsjson11_deserializeDocumentActionCondition(v **types.ActionCondition, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -11183,6 +11221,11 @@ func awsAwsjson11_deserializeDocumentRateBasedStatement(v **types.RateBasedState sv.AggregateKeyType = types.RateBasedStatementAggregateKeyType(jtv) } + case "CustomKeys": + if err := awsAwsjson11_deserializeDocumentRateBasedStatementCustomKeys(&sv.CustomKeys, value); err != nil { + return err + } + case "ForwardedIPConfig": if err := awsAwsjson11_deserializeDocumentForwardedIPConfig(&sv.ForwardedIPConfig, value); err != nil { return err @@ -11215,6 +11258,111 @@ func awsAwsjson11_deserializeDocumentRateBasedStatement(v **types.RateBasedState return nil } +func awsAwsjson11_deserializeDocumentRateBasedStatementCustomKey(v **types.RateBasedStatementCustomKey, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateBasedStatementCustomKey + if *v == nil { + sv = &types.RateBasedStatementCustomKey{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Cookie": + if err := awsAwsjson11_deserializeDocumentRateLimitCookie(&sv.Cookie, value); err != nil { + return err + } + + case "ForwardedIP": + if err := awsAwsjson11_deserializeDocumentRateLimitForwardedIP(&sv.ForwardedIP, value); err != nil { + return err + } + + case "Header": + if err := awsAwsjson11_deserializeDocumentRateLimitHeader(&sv.Header, value); err != nil { + return err + } + + case "HTTPMethod": + if err := awsAwsjson11_deserializeDocumentRateLimitHTTPMethod(&sv.HTTPMethod, value); err != nil { + return err + } + + case "IP": + if err := awsAwsjson11_deserializeDocumentRateLimitIP(&sv.IP, value); err != nil { + return err + } + + case "LabelNamespace": + if err := awsAwsjson11_deserializeDocumentRateLimitLabelNamespace(&sv.LabelNamespace, value); err != nil { + return err + } + + case "QueryArgument": + if err := awsAwsjson11_deserializeDocumentRateLimitQueryArgument(&sv.QueryArgument, value); err != nil { + return err + } + + case "QueryString": + if err := awsAwsjson11_deserializeDocumentRateLimitQueryString(&sv.QueryString, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateBasedStatementCustomKeys(v *[]types.RateBasedStatementCustomKey, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.([]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var cv []types.RateBasedStatementCustomKey + if *v == nil { + cv = []types.RateBasedStatementCustomKey{} + } else { + cv = *v + } + + for _, value := range shape { + var col types.RateBasedStatementCustomKey + destAddr := &col + if err := awsAwsjson11_deserializeDocumentRateBasedStatementCustomKey(&destAddr, value); err != nil { + return err + } + col = *destAddr + cv = append(cv, col) + + } + *v = cv + return nil +} + func awsAwsjson11_deserializeDocumentRateBasedStatementManagedKeysIPSet(v **types.RateBasedStatementManagedKeysIPSet, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -11260,6 +11408,310 @@ func awsAwsjson11_deserializeDocumentRateBasedStatementManagedKeysIPSet(v **type return nil } +func awsAwsjson11_deserializeDocumentRateLimitCookie(v **types.RateLimitCookie, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitCookie + if *v == nil { + sv = &types.RateLimitCookie{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldToMatchData to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "TextTransformations": + if err := awsAwsjson11_deserializeDocumentTextTransformations(&sv.TextTransformations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitForwardedIP(v **types.RateLimitForwardedIP, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitForwardedIP + if *v == nil { + sv = &types.RateLimitForwardedIP{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitHeader(v **types.RateLimitHeader, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitHeader + if *v == nil { + sv = &types.RateLimitHeader{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldToMatchData to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "TextTransformations": + if err := awsAwsjson11_deserializeDocumentTextTransformations(&sv.TextTransformations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitHTTPMethod(v **types.RateLimitHTTPMethod, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitHTTPMethod + if *v == nil { + sv = &types.RateLimitHTTPMethod{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitIP(v **types.RateLimitIP, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitIP + if *v == nil { + sv = &types.RateLimitIP{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitLabelNamespace(v **types.RateLimitLabelNamespace, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitLabelNamespace + if *v == nil { + sv = &types.RateLimitLabelNamespace{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Namespace": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected LabelNamespace to be of type string, got %T instead", value) + } + sv.Namespace = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitQueryArgument(v **types.RateLimitQueryArgument, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitQueryArgument + if *v == nil { + sv = &types.RateLimitQueryArgument{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Name": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected FieldToMatchData to be of type string, got %T instead", value) + } + sv.Name = ptr.String(jtv) + } + + case "TextTransformations": + if err := awsAwsjson11_deserializeDocumentTextTransformations(&sv.TextTransformations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + +func awsAwsjson11_deserializeDocumentRateLimitQueryString(v **types.RateLimitQueryString, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.RateLimitQueryString + if *v == nil { + sv = &types.RateLimitQueryString{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "TextTransformations": + if err := awsAwsjson11_deserializeDocumentTextTransformations(&sv.TextTransformations, value); err != nil { + return err + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentRedactedFields(v *[]types.FieldToMatch, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) @@ -14722,6 +15174,46 @@ func awsAwsjson11_deserializeDocumentWAFUnavailableEntityException(v **types.WAF return nil } +func awsAwsjson11_deserializeDocumentWAFUnsupportedAggregateKeyTypeException(v **types.WAFUnsupportedAggregateKeyTypeException, value interface{}) error { + if v == nil { + return fmt.Errorf("unexpected nil of type %T", v) + } + if value == nil { + return nil + } + + shape, ok := value.(map[string]interface{}) + if !ok { + return fmt.Errorf("unexpected JSON type %v", value) + } + + var sv *types.WAFUnsupportedAggregateKeyTypeException + if *v == nil { + sv = &types.WAFUnsupportedAggregateKeyTypeException{} + } else { + sv = *v + } + + for key, value := range shape { + switch key { + case "Message": + if value != nil { + jtv, ok := value.(string) + if !ok { + return fmt.Errorf("expected ErrorMessage to be of type string, got %T instead", value) + } + sv.Message = ptr.String(jtv) + } + + default: + _, _ = key, value + + } + } + *v = sv + return nil +} + func awsAwsjson11_deserializeDocumentWebACL(v **types.WebACL, value interface{}) error { if v == nil { return fmt.Errorf("unexpected nil of type %T", v) diff --git a/service/wafv2/serializers.go b/service/wafv2/serializers.go index b98693dafb0..fd3aef4d4fc 100644 --- a/service/wafv2/serializers.go +++ b/service/wafv2/serializers.go @@ -3978,6 +3978,13 @@ func awsAwsjson11_serializeDocumentRateBasedStatement(v *types.RateBasedStatemen ok.String(string(v.AggregateKeyType)) } + if v.CustomKeys != nil { + ok := object.Key("CustomKeys") + if err := awsAwsjson11_serializeDocumentRateBasedStatementCustomKeys(v.CustomKeys, ok); err != nil { + return err + } + } + if v.ForwardedIPConfig != nil { ok := object.Key("ForwardedIPConfig") if err := awsAwsjson11_serializeDocumentForwardedIPConfig(v.ForwardedIPConfig, ok); err != nil { @@ -4000,6 +4007,186 @@ func awsAwsjson11_serializeDocumentRateBasedStatement(v *types.RateBasedStatemen return nil } +func awsAwsjson11_serializeDocumentRateBasedStatementCustomKey(v *types.RateBasedStatementCustomKey, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Cookie != nil { + ok := object.Key("Cookie") + if err := awsAwsjson11_serializeDocumentRateLimitCookie(v.Cookie, ok); err != nil { + return err + } + } + + if v.ForwardedIP != nil { + ok := object.Key("ForwardedIP") + if err := awsAwsjson11_serializeDocumentRateLimitForwardedIP(v.ForwardedIP, ok); err != nil { + return err + } + } + + if v.Header != nil { + ok := object.Key("Header") + if err := awsAwsjson11_serializeDocumentRateLimitHeader(v.Header, ok); err != nil { + return err + } + } + + if v.HTTPMethod != nil { + ok := object.Key("HTTPMethod") + if err := awsAwsjson11_serializeDocumentRateLimitHTTPMethod(v.HTTPMethod, ok); err != nil { + return err + } + } + + if v.IP != nil { + ok := object.Key("IP") + if err := awsAwsjson11_serializeDocumentRateLimitIP(v.IP, ok); err != nil { + return err + } + } + + if v.LabelNamespace != nil { + ok := object.Key("LabelNamespace") + if err := awsAwsjson11_serializeDocumentRateLimitLabelNamespace(v.LabelNamespace, ok); err != nil { + return err + } + } + + if v.QueryArgument != nil { + ok := object.Key("QueryArgument") + if err := awsAwsjson11_serializeDocumentRateLimitQueryArgument(v.QueryArgument, ok); err != nil { + return err + } + } + + if v.QueryString != nil { + ok := object.Key("QueryString") + if err := awsAwsjson11_serializeDocumentRateLimitQueryString(v.QueryString, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentRateBasedStatementCustomKeys(v []types.RateBasedStatementCustomKey, value smithyjson.Value) error { + array := value.Array() + defer array.Close() + + for i := range v { + av := array.Value() + if err := awsAwsjson11_serializeDocumentRateBasedStatementCustomKey(&v[i], av); err != nil { + return err + } + } + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitCookie(v *types.RateLimitCookie, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("Name") + ok.String(*v.Name) + } + + if v.TextTransformations != nil { + ok := object.Key("TextTransformations") + if err := awsAwsjson11_serializeDocumentTextTransformations(v.TextTransformations, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitForwardedIP(v *types.RateLimitForwardedIP, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitHeader(v *types.RateLimitHeader, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("Name") + ok.String(*v.Name) + } + + if v.TextTransformations != nil { + ok := object.Key("TextTransformations") + if err := awsAwsjson11_serializeDocumentTextTransformations(v.TextTransformations, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitHTTPMethod(v *types.RateLimitHTTPMethod, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitIP(v *types.RateLimitIP, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitLabelNamespace(v *types.RateLimitLabelNamespace, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Namespace != nil { + ok := object.Key("Namespace") + ok.String(*v.Namespace) + } + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitQueryArgument(v *types.RateLimitQueryArgument, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.Name != nil { + ok := object.Key("Name") + ok.String(*v.Name) + } + + if v.TextTransformations != nil { + ok := object.Key("TextTransformations") + if err := awsAwsjson11_serializeDocumentTextTransformations(v.TextTransformations, ok); err != nil { + return err + } + } + + return nil +} + +func awsAwsjson11_serializeDocumentRateLimitQueryString(v *types.RateLimitQueryString, value smithyjson.Value) error { + object := value.Object() + defer object.Close() + + if v.TextTransformations != nil { + ok := object.Key("TextTransformations") + if err := awsAwsjson11_serializeDocumentTextTransformations(v.TextTransformations, ok); err != nil { + return err + } + } + + return nil +} + func awsAwsjson11_serializeDocumentRedactedFields(v []types.FieldToMatch, value smithyjson.Value) error { array := value.Array() defer array.Close() diff --git a/service/wafv2/types/enums.go b/service/wafv2/types/enums.go index 50cda65d5ab..5e438539f22 100644 --- a/service/wafv2/types/enums.go +++ b/service/wafv2/types/enums.go @@ -885,6 +885,8 @@ const ( ParameterExceptionFieldTokenDomain ParameterExceptionField = "TOKEN_DOMAIN" ParameterExceptionFieldAtpRuleSetResponseInspection ParameterExceptionField = "ATP_RULE_SET_RESPONSE_INSPECTION" ParameterExceptionFieldAssociatedResourceType ParameterExceptionField = "ASSOCIATED_RESOURCE_TYPE" + ParameterExceptionFieldScopeDown ParameterExceptionField = "SCOPE_DOWN" + ParameterExceptionFieldCustomKeys ParameterExceptionField = "CUSTOM_KEYS" ) // Values returns all known values for ParameterExceptionField. Note that this can @@ -959,6 +961,8 @@ func (ParameterExceptionField) Values() []ParameterExceptionField { "TOKEN_DOMAIN", "ATP_RULE_SET_RESPONSE_INSPECTION", "ASSOCIATED_RESOURCE_TYPE", + "SCOPE_DOWN", + "CUSTOM_KEYS", } } @@ -1028,6 +1032,8 @@ type RateBasedStatementAggregateKeyType string const ( RateBasedStatementAggregateKeyTypeIp RateBasedStatementAggregateKeyType = "IP" RateBasedStatementAggregateKeyTypeForwardedIp RateBasedStatementAggregateKeyType = "FORWARDED_IP" + RateBasedStatementAggregateKeyTypeCustomKeys RateBasedStatementAggregateKeyType = "CUSTOM_KEYS" + RateBasedStatementAggregateKeyTypeConstant RateBasedStatementAggregateKeyType = "CONSTANT" ) // Values returns all known values for RateBasedStatementAggregateKeyType. Note @@ -1038,6 +1044,8 @@ func (RateBasedStatementAggregateKeyType) Values() []RateBasedStatementAggregate return []RateBasedStatementAggregateKeyType{ "IP", "FORWARDED_IP", + "CUSTOM_KEYS", + "CONSTANT", } } diff --git a/service/wafv2/types/errors.go b/service/wafv2/types/errors.go index 91531c8de05..f3cfb7315e2 100644 --- a/service/wafv2/types/errors.go +++ b/service/wafv2/types/errors.go @@ -545,3 +545,33 @@ func (e *WAFUnavailableEntityException) ErrorCode() string { return *e.ErrorCodeOverride } func (e *WAFUnavailableEntityException) ErrorFault() smithy.ErrorFault { return smithy.FaultClient } + +// The rule that you've named doesn't aggregate solely on the IP address or solely +// on the forwarded IP address. This call is only available for rate-based rules +// with an AggregateKeyType setting of IP or FORWARDED_IP . +type WAFUnsupportedAggregateKeyTypeException struct { + Message *string + + ErrorCodeOverride *string + + noSmithyDocumentSerde +} + +func (e *WAFUnsupportedAggregateKeyTypeException) Error() string { + return fmt.Sprintf("%s: %s", e.ErrorCode(), e.ErrorMessage()) +} +func (e *WAFUnsupportedAggregateKeyTypeException) ErrorMessage() string { + if e.Message == nil { + return "" + } + return *e.Message +} +func (e *WAFUnsupportedAggregateKeyTypeException) ErrorCode() string { + if e == nil || e.ErrorCodeOverride == nil { + return "WAFUnsupportedAggregateKeyTypeException" + } + return *e.ErrorCodeOverride +} +func (e *WAFUnsupportedAggregateKeyTypeException) ErrorFault() smithy.ErrorFault { + return smithy.FaultClient +} diff --git a/service/wafv2/types/types.go b/service/wafv2/types/types.go index f4d2da67e8a..416f42ac950 100644 --- a/service/wafv2/types/types.go +++ b/service/wafv2/types/types.go @@ -250,10 +250,13 @@ type ByteMatchStatement struct { SearchString []byte // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation @@ -1772,75 +1775,203 @@ type QueryString struct { noSmithyDocumentSerde } -// A rate-based rule tracks the rate of requests for each originating IP address, -// and triggers the rule action when the rate exceeds a limit that you specify on -// the number of requests in any 5-minute time span. You can use this to put a -// temporary block on requests from an IP address that is sending excessive -// requests. WAF tracks and manages web requests separately for each instance of a -// rate-based rule that you use. For example, if you provide the same rate-based -// rule settings in two web ACLs, each of the two rule statements represents a -// separate instance of the rate-based rule and gets its own tracking and -// management by WAF. If you define a rate-based rule inside a rule group, and then -// use that rule group in multiple places, each use creates a separate instance of -// the rate-based rule that gets its own tracking and management by WAF. When the -// rule action triggers, WAF blocks additional requests from the IP address until -// the request rate falls below the limit. You can optionally nest another -// statement inside the rate-based statement, to narrow the scope of the rule so -// that it only counts requests that match the nested statement. For example, based -// on recent requests that you have seen from an attacker, you might create a -// rate-based rule with a nested AND rule statement that contains the following -// nested statements: -// - An IP match statement with an IP set that specifies the address 192.0.2.44. -// - A string match statement that searches in the User-Agent header for the -// string BadBot. +// A rate-based rule counts incoming requests and rate limits requests when they +// are coming at too fast a rate. The rule categorizes requests according to your +// aggregation criteria, collects them into aggregation instances, and counts and +// rate limits the requests for each instance. You can specify individual +// aggregation keys, like IP address or HTTP method. You can also specify +// aggregation key combinations, like IP address and HTTP method, or HTTP method, +// query argument, and cookie. Each unique set of values for the aggregation keys +// that you specify is a separate aggregation instance, with the value from each +// key contributing to the aggregation instance definition. For example, assume the +// rule evaluates web requests with the following IP address and HTTP method +// values: +// - IP address 10.1.1.1, HTTP method POST +// - IP address 10.1.1.1, HTTP method GET +// - IP address 127.0.0.0, HTTP method POST +// - IP address 10.1.1.1, HTTP method GET // -// In this rate-based rule, you also define a rate limit. For this example, the -// rate limit is 1,000. Requests that meet the criteria of both of the nested -// statements are counted. If the count exceeds 1,000 requests per five minutes, -// the rule action triggers. Requests that do not meet the criteria of both of the -// nested statements are not counted towards the rate limit and are not affected by -// this rule. You cannot nest a RateBasedStatement inside another statement, for -// example inside a NotStatement or OrStatement . You can define a -// RateBasedStatement inside a web ACL and inside a rule group. +// The rule would create different aggregation instances according to your +// aggregation criteria, for example: +// - If the aggregation criteria is just the IP address, then each individual +// address is an aggregation instance, and WAF counts requests separately for each. +// The aggregation instances and request counts for our example would be the +// following: +// - IP address 10.1.1.1: count 3 +// - IP address 127.0.0.0: count 1 +// - If the aggregation criteria is HTTP method, then each individual HTTP +// method is an aggregation instance. The aggregation instances and request counts +// for our example would be the following: +// - HTTP method POST: count 2 +// - HTTP method GET: count 2 +// - If the aggregation criteria is IP address and HTTP method, then each IP +// address and each HTTP method would contribute to the combined aggregation +// instance. The aggregation instances and request counts for our example would be +// the following: +// - IP address 10.1.1.1, HTTP method POST: count 1 +// - IP address 10.1.1.1, HTTP method GET: count 2 +// - IP address 127.0.0.0, HTTP method POST: count 1 +// +// For any n-tuple of aggregation keys, each unique combination of values for the +// keys defines a separate aggregation instance, which WAF counts and rate-limits +// individually. You can optionally nest another statement inside the rate-based +// statement, to narrow the scope of the rule so that it only counts and rate +// limits requests that match the nested statement. You can use this nested +// scope-down statement in conjunction with your aggregation key specifications or +// you can just count and rate limit all requests that match the scope-down +// statement, without additional aggregation. When you choose to just manage all +// requests that match a scope-down statement, the aggregation instance is singular +// for the rule. You cannot nest a RateBasedStatement inside another statement, +// for example inside a NotStatement or OrStatement . You can define a +// RateBasedStatement inside a web ACL and inside a rule group. For additional +// information about the options, see Rate limiting web requests using rate-based +// rules (https://docs.aws.amazon.com/waf/latest/developerguide/waf-rate-based-rules.html) +// in the WAF Developer Guide. If you only aggregate on the individual IP address +// or forwarded IP address, you can retrieve the list of IP addresses that WAF is +// currently rate limiting for a rule through the API call +// GetRateBasedStatementManagedKeys . This option is not available for other +// aggregation configurations. WAF tracks and manages web requests separately for +// each instance of a rate-based rule that you use. For example, if you provide the +// same rate-based rule settings in two web ACLs, each of the two rule statements +// represents a separate instance of the rate-based rule and gets its own tracking +// and management by WAF. If you define a rate-based rule inside a rule group, and +// then use that rule group in multiple places, each use creates a separate +// instance of the rate-based rule that gets its own tracking and management by +// WAF. type RateBasedStatement struct { - // Setting that indicates how to aggregate the request counts. The options are the - // following: - // - IP - Aggregate the request counts on the IP address from the web request - // origin. + // Setting that indicates how to aggregate the request counts. Web requests that + // are missing any of the components specified in the aggregation keys are omitted + // from the rate-based rule evaluation and handling. + // - CONSTANT - Count and limit the requests that match the rate-based rule's + // scope-down statement. With this option, the counted requests aren't further + // aggregated. The scope-down statement is the only specification used. When the + // count of all requests that satisfy the scope-down statement goes over the limit, + // WAF applies the rule action to all requests that satisfy the scope-down + // statement. With this option, you must configure the ScopeDownStatement + // property. + // - CUSTOM_KEYS - Aggregate the request counts using one or more web request + // components as the aggregate keys. With this option, you must specify the + // aggregate keys in the CustomKeys property. To aggregate on only the IP address + // or only the forwarded IP address, don't use custom keys. Instead, set the + // aggregate key type to IP or FORWARDED_IP . // - FORWARDED_IP - Aggregate the request counts on the first IP address in an - // HTTP header. If you use this, configure the ForwardedIPConfig , to specify the - // header to use. + // HTTP header. With this option, you must specify the header to use in the + // ForwardedIPConfig property. To aggregate on a combination of the forwarded IP + // address with other aggregate keys, use CUSTOM_KEYS . + // - IP - Aggregate the request counts on the IP address from the web request + // origin. To aggregate on a combination of the IP address with other aggregate + // keys, use CUSTOM_KEYS . // // This member is required. AggregateKeyType RateBasedStatementAggregateKeyType - // The limit on requests per 5-minute period for a single originating IP address. - // If the statement includes a ScopeDownStatement , this limit is applied only to - // the requests that match the statement. + // The limit on requests per 5-minute period for a single aggregation instance for + // the rate-based rule. If the rate-based statement includes a ScopeDownStatement , + // this limit is applied only to the requests that match the statement. Examples: + // - If you aggregate on just the IP address, this is the limit on requests from + // any single IP address. + // - If you aggregate on the HTTP method and the query argument name "city", + // then this is the limit on requests for any single method, city pair. // // This member is required. Limit int64 + // Specifies the aggregate keys to use in a rate-base rule. + CustomKeys []RateBasedStatementCustomKey + // The configuration for inspecting IP addresses in an HTTP header that you // specify, instead of using the IP address that's reported by the web request // origin. Commonly, this is the X-Forwarded-For (XFF) header, but you can specify // any header name. If the specified header isn't present in the request, WAF - // doesn't apply the rule to the web request at all. This is required if - // AggregateKeyType is set to FORWARDED_IP . + // doesn't apply the rule to the web request at all. This is required if you + // specify a forwarded IP in the rule's aggregate key settings. ForwardedIPConfig *ForwardedIPConfig // An optional nested statement that narrows the scope of the web requests that - // are evaluated by the rate-based statement. Requests are only tracked by the - // rate-based statement if they match the scope-down statement. You can use any - // nestable Statement in the scope-down statement, and you can nest statements at - // any level, the same as you can for a rule statement. + // are evaluated and managed by the rate-based statement. When you use a scope-down + // statement, the rate-based rule only tracks and rate limits requests that match + // the scope-down statement. You can use any nestable Statement in the scope-down + // statement, and you can nest statements at any level, the same as you can for a + // rule statement. ScopeDownStatement *Statement noSmithyDocumentSerde } +// Specifies a single custom aggregate key for a rate-base rule. Web requests that +// are missing any of the components specified in the aggregation keys are omitted +// from the rate-based rule evaluation and handling. +type RateBasedStatementCustomKey struct { + + // Use the value of a cookie in the request as an aggregate key. Each distinct + // value in the cookie contributes to the aggregation instance. If you use a single + // cookie as your custom key, then each value fully defines an aggregation + // instance. + Cookie *RateLimitCookie + + // Use the first IP address in an HTTP header as an aggregate key. Each distinct + // forwarded IP address contributes to the aggregation instance. When you specify + // an IP or forwarded IP in the custom key settings, you must also specify at least + // one other key to use. You can aggregate on only the forwarded IP address by + // specifying FORWARDED_IP in your rate-based statement's AggregateKeyType . With + // this option, you must specify the header to use in the rate-based rule's + // ForwardedIPConfig property. + ForwardedIP *RateLimitForwardedIP + + // Use the request's HTTP method as an aggregate key. Each distinct HTTP method + // contributes to the aggregation instance. If you use just the HTTP method as your + // custom key, then each method fully defines an aggregation instance. + HTTPMethod *RateLimitHTTPMethod + + // Use the value of a header in the request as an aggregate key. Each distinct + // value in the header contributes to the aggregation instance. If you use a single + // header as your custom key, then each value fully defines an aggregation + // instance. + Header *RateLimitHeader + + // Use the request's originating IP address as an aggregate key. Each distinct IP + // address contributes to the aggregation instance. When you specify an IP or + // forwarded IP in the custom key settings, you must also specify at least one + // other key to use. You can aggregate on only the IP address by specifying IP in + // your rate-based statement's AggregateKeyType . + IP *RateLimitIP + + // Use the specified label namespace as an aggregate key. Each distinct fully + // qualified label name that has the specified label namespace contributes to the + // aggregation instance. If you use just one label namespace as your custom key, + // then each label name fully defines an aggregation instance. This uses only + // labels that have been added to the request by rules that are evaluated before + // this rate-based rule in the web ACL. For information about label namespaces and + // names, see Label syntax and naming requirements (https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-label-requirements.html) + // in the WAF Developer Guide. + LabelNamespace *RateLimitLabelNamespace + + // Use the specified query argument as an aggregate key. Each distinct value for + // the named query argument contributes to the aggregation instance. If you use a + // single query argument as your custom key, then each value fully defines an + // aggregation instance. + QueryArgument *RateLimitQueryArgument + + // Use the request's query string as an aggregate key. Each distinct string + // contributes to the aggregation instance. If you use just the query string as + // your custom key, then each string fully defines an aggregation instance. + QueryString *RateLimitQueryString + + noSmithyDocumentSerde +} + // The set of IP addresses that are currently blocked for a RateBasedStatement . +// This is only available for rate-based rules that aggregate on just the IP +// address, with the AggregateKeyType set to IP or FORWARDED_IP . A rate-based rule +// applies its rule action to requests from IP addresses that are in the rule's +// managed keys list and that match the rule's scope-down statement. When a rule +// has no scope-down statement, it applies the action to all requests from the IP +// addresses that are in the list. The rule applies its rule action to rate limit +// the matching requests. The action is usually Block but it can be any valid rule +// action except for Allow. The maximum number of IP addresses that can be rate +// limited by a single rate-based rule instance is 10,000. If more than 10,000 +// addresses exceed the rate limit, WAF limits those with the highest rates. type RateBasedStatementManagedKeysIPSet struct { // The IP addresses that are currently blocked. @@ -1852,6 +1983,159 @@ type RateBasedStatementManagedKeysIPSet struct { noSmithyDocumentSerde } +// Specifies a cookie as an aggregate key for a rate-based rule. Each distinct +// value in the cookie contributes to the aggregation instance. If you use a single +// cookie as your custom key, then each value fully defines an aggregation +// instance. +type RateLimitCookie struct { + + // The name of the cookie to use. + // + // This member is required. + Name *string + + // Text transformations eliminate some of the unusual formatting that attackers + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. + // + // This member is required. + TextTransformations []TextTransformation + + noSmithyDocumentSerde +} + +// Specifies the first IP address in an HTTP header as an aggregate key for a +// rate-based rule. Each distinct forwarded IP address contributes to the +// aggregation instance. This setting is used only in the +// RateBasedStatementCustomKey specification of a rate-based rule statement. When +// you specify an IP or forwarded IP in the custom key settings, you must also +// specify at least one other key to use. You can aggregate on only the forwarded +// IP address by specifying FORWARDED_IP in your rate-based statement's +// AggregateKeyType . This data type supports using the forwarded IP address in the +// web request aggregation for a rate-based rule, in RateBasedStatementCustomKey . +// The JSON specification for using the forwarded IP address doesn't explicitly use +// this data type. JSON specification: "ForwardedIP": {} When you use this +// specification, you must also configure the forwarded IP address in the +// rate-based statement's ForwardedIPConfig . +type RateLimitForwardedIP struct { + noSmithyDocumentSerde +} + +// Specifies a header as an aggregate key for a rate-based rule. Each distinct +// value in the header contributes to the aggregation instance. If you use a single +// header as your custom key, then each value fully defines an aggregation +// instance. +type RateLimitHeader struct { + + // The name of the header to use. + // + // This member is required. + Name *string + + // Text transformations eliminate some of the unusual formatting that attackers + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. + // + // This member is required. + TextTransformations []TextTransformation + + noSmithyDocumentSerde +} + +// Specifies the request's HTTP method as an aggregate key for a rate-based rule. +// Each distinct HTTP method contributes to the aggregation instance. If you use +// just the HTTP method as your custom key, then each method fully defines an +// aggregation instance. JSON specification: "RateLimitHTTPMethod": {} +type RateLimitHTTPMethod struct { + noSmithyDocumentSerde +} + +// Specifies the IP address in the web request as an aggregate key for a +// rate-based rule. Each distinct IP address contributes to the aggregation +// instance. This setting is used only in the RateBasedStatementCustomKey +// specification of a rate-based rule statement. To use this in the custom key +// settings, you must specify at least one other key to use, along with the IP +// address. To aggregate on only the IP address, in your rate-based statement's +// AggregateKeyType , specify IP . JSON specification: "RateLimitIP": {} +type RateLimitIP struct { + noSmithyDocumentSerde +} + +// Specifies a label namespace to use as an aggregate key for a rate-based rule. +// Each distinct fully qualified label name that has the specified label namespace +// contributes to the aggregation instance. If you use just one label namespace as +// your custom key, then each label name fully defines an aggregation instance. +// This uses only labels that have been added to the request by rules that are +// evaluated before this rate-based rule in the web ACL. For information about +// label namespaces and names, see Label syntax and naming requirements (https://docs.aws.amazon.com/waf/latest/developerguide/waf-rule-label-requirements.html) +// in the WAF Developer Guide. +type RateLimitLabelNamespace struct { + + // The namespace to use for aggregation. + // + // This member is required. + Namespace *string + + noSmithyDocumentSerde +} + +// Specifies a query argument in the request as an aggregate key for a rate-based +// rule. Each distinct value for the named query argument contributes to the +// aggregation instance. If you use a single query argument as your custom key, +// then each value fully defines an aggregation instance. +type RateLimitQueryArgument struct { + + // The name of the query argument to use. + // + // This member is required. + Name *string + + // Text transformations eliminate some of the unusual formatting that attackers + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. + // + // This member is required. + TextTransformations []TextTransformation + + noSmithyDocumentSerde +} + +// Specifies the request's query string as an aggregate key for a rate-based rule. +// Each distinct string contributes to the aggregation instance. If you use just +// the query string as your custom key, then each string fully defines an +// aggregation instance. +type RateLimitQueryString struct { + + // Text transformations eliminate some of the unusual formatting that attackers + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. + // + // This member is required. + TextTransformations []TextTransformation + + noSmithyDocumentSerde +} + // A single regular expression. This is used in a RegexPatternSet . type Regex struct { @@ -1876,10 +2160,13 @@ type RegexMatchStatement struct { RegexString *string // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation @@ -1934,10 +2221,13 @@ type RegexPatternSetReferenceStatement struct { FieldToMatch *FieldToMatch // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation @@ -2611,10 +2901,13 @@ type SizeConstraintStatement struct { Size int64 // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation @@ -2633,10 +2926,13 @@ type SqliMatchStatement struct { FieldToMatch *FieldToMatch // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation @@ -2732,35 +3028,67 @@ type Statement struct { // You provide more than one Statement within the OrStatement . OrStatement *OrStatement - // A rate-based rule tracks the rate of requests for each originating IP address, - // and triggers the rule action when the rate exceeds a limit that you specify on - // the number of requests in any 5-minute time span. You can use this to put a - // temporary block on requests from an IP address that is sending excessive - // requests. WAF tracks and manages web requests separately for each instance of a - // rate-based rule that you use. For example, if you provide the same rate-based - // rule settings in two web ACLs, each of the two rule statements represents a - // separate instance of the rate-based rule and gets its own tracking and - // management by WAF. If you define a rate-based rule inside a rule group, and then - // use that rule group in multiple places, each use creates a separate instance of - // the rate-based rule that gets its own tracking and management by WAF. When the - // rule action triggers, WAF blocks additional requests from the IP address until - // the request rate falls below the limit. You can optionally nest another - // statement inside the rate-based statement, to narrow the scope of the rule so - // that it only counts requests that match the nested statement. For example, based - // on recent requests that you have seen from an attacker, you might create a - // rate-based rule with a nested AND rule statement that contains the following - // nested statements: - // - An IP match statement with an IP set that specifies the address 192.0.2.44. - // - A string match statement that searches in the User-Agent header for the - // string BadBot. - // In this rate-based rule, you also define a rate limit. For this example, the - // rate limit is 1,000. Requests that meet the criteria of both of the nested - // statements are counted. If the count exceeds 1,000 requests per five minutes, - // the rule action triggers. Requests that do not meet the criteria of both of the - // nested statements are not counted towards the rate limit and are not affected by - // this rule. You cannot nest a RateBasedStatement inside another statement, for - // example inside a NotStatement or OrStatement . You can define a - // RateBasedStatement inside a web ACL and inside a rule group. + // A rate-based rule counts incoming requests and rate limits requests when they + // are coming at too fast a rate. The rule categorizes requests according to your + // aggregation criteria, collects them into aggregation instances, and counts and + // rate limits the requests for each instance. You can specify individual + // aggregation keys, like IP address or HTTP method. You can also specify + // aggregation key combinations, like IP address and HTTP method, or HTTP method, + // query argument, and cookie. Each unique set of values for the aggregation keys + // that you specify is a separate aggregation instance, with the value from each + // key contributing to the aggregation instance definition. For example, assume the + // rule evaluates web requests with the following IP address and HTTP method + // values: + // - IP address 10.1.1.1, HTTP method POST + // - IP address 10.1.1.1, HTTP method GET + // - IP address 127.0.0.0, HTTP method POST + // - IP address 10.1.1.1, HTTP method GET + // The rule would create different aggregation instances according to your + // aggregation criteria, for example: + // - If the aggregation criteria is just the IP address, then each individual + // address is an aggregation instance, and WAF counts requests separately for each. + // The aggregation instances and request counts for our example would be the + // following: + // - IP address 10.1.1.1: count 3 + // - IP address 127.0.0.0: count 1 + // - If the aggregation criteria is HTTP method, then each individual HTTP + // method is an aggregation instance. The aggregation instances and request counts + // for our example would be the following: + // - HTTP method POST: count 2 + // - HTTP method GET: count 2 + // - If the aggregation criteria is IP address and HTTP method, then each IP + // address and each HTTP method would contribute to the combined aggregation + // instance. The aggregation instances and request counts for our example would be + // the following: + // - IP address 10.1.1.1, HTTP method POST: count 1 + // - IP address 10.1.1.1, HTTP method GET: count 2 + // - IP address 127.0.0.0, HTTP method POST: count 1 + // For any n-tuple of aggregation keys, each unique combination of values for the + // keys defines a separate aggregation instance, which WAF counts and rate-limits + // individually. You can optionally nest another statement inside the rate-based + // statement, to narrow the scope of the rule so that it only counts and rate + // limits requests that match the nested statement. You can use this nested + // scope-down statement in conjunction with your aggregation key specifications or + // you can just count and rate limit all requests that match the scope-down + // statement, without additional aggregation. When you choose to just manage all + // requests that match a scope-down statement, the aggregation instance is singular + // for the rule. You cannot nest a RateBasedStatement inside another statement, + // for example inside a NotStatement or OrStatement . You can define a + // RateBasedStatement inside a web ACL and inside a rule group. For additional + // information about the options, see Rate limiting web requests using rate-based + // rules (https://docs.aws.amazon.com/waf/latest/developerguide/waf-rate-based-rules.html) + // in the WAF Developer Guide. If you only aggregate on the individual IP address + // or forwarded IP address, you can retrieve the list of IP addresses that WAF is + // currently rate limiting for a rule through the API call + // GetRateBasedStatementManagedKeys . This option is not available for other + // aggregation configurations. WAF tracks and manages web requests separately for + // each instance of a rate-based rule that you use. For example, if you provide the + // same rate-based rule settings in two web ACLs, each of the two rule statements + // represents a separate instance of the rate-based rule and gets its own tracking + // and management by WAF. If you define a rate-based rule inside a rule group, and + // then use that rule group in multiple places, each use creates a separate + // instance of the rate-based rule that gets its own tracking and management by + // WAF. RateBasedStatement *RateBasedStatement // A rule statement used to search web request components for a match against a @@ -2868,10 +3196,10 @@ type TagInfoForResource struct { // use in web requests in an effort to bypass detection. type TextTransformation struct { - // Sets the relative processing order for multiple transformations that are - // defined for a rule statement. WAF processes all transformations, from lowest - // priority to highest, before inspecting the transformed content. The priorities - // don't need to be consecutive, but they must all be different. + // Sets the relative processing order for multiple transformations. WAF processes + // all transformations, from lowest priority to highest, before inspecting the + // transformed content. The priorities don't need to be consecutive, but they must + // all be different. // // This member is required. Priority int32 @@ -3225,10 +3553,13 @@ type XssMatchStatement struct { FieldToMatch *FieldToMatch // Text transformations eliminate some of the unusual formatting that attackers - // use in web requests in an effort to bypass detection. If you specify one or more - // transformations in a rule statement, WAF performs all transformations on the - // content of the request component identified by FieldToMatch , starting from the - // lowest priority setting, before inspecting the content for a match. + // use in web requests in an effort to bypass detection. Text transformations are + // used in rule match statements, to transform the FieldToMatch request component + // before inspecting it, and they're used in rate-based rule statements, to + // transform request components before using them as custom aggregation keys. If + // you specify one or more transformations to apply, WAF performs all + // transformations on the specified content, starting from the lowest priority + // setting, and then uses the component contents. // // This member is required. TextTransformations []TextTransformation diff --git a/service/wafv2/validators.go b/service/wafv2/validators.go index 26ffe53ecec..cf7ef0a6234 100644 --- a/service/wafv2/validators.go +++ b/service/wafv2/validators.go @@ -2175,6 +2175,165 @@ func validateRateBasedStatement(v *types.RateBasedStatement) error { invalidParams.AddNested("ForwardedIPConfig", err.(smithy.InvalidParamsError)) } } + if v.CustomKeys != nil { + if err := validateRateBasedStatementCustomKeys(v.CustomKeys); err != nil { + invalidParams.AddNested("CustomKeys", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateBasedStatementCustomKey(v *types.RateBasedStatementCustomKey) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateBasedStatementCustomKey"} + if v.Header != nil { + if err := validateRateLimitHeader(v.Header); err != nil { + invalidParams.AddNested("Header", err.(smithy.InvalidParamsError)) + } + } + if v.Cookie != nil { + if err := validateRateLimitCookie(v.Cookie); err != nil { + invalidParams.AddNested("Cookie", err.(smithy.InvalidParamsError)) + } + } + if v.QueryArgument != nil { + if err := validateRateLimitQueryArgument(v.QueryArgument); err != nil { + invalidParams.AddNested("QueryArgument", err.(smithy.InvalidParamsError)) + } + } + if v.QueryString != nil { + if err := validateRateLimitQueryString(v.QueryString); err != nil { + invalidParams.AddNested("QueryString", err.(smithy.InvalidParamsError)) + } + } + if v.LabelNamespace != nil { + if err := validateRateLimitLabelNamespace(v.LabelNamespace); err != nil { + invalidParams.AddNested("LabelNamespace", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateBasedStatementCustomKeys(v []types.RateBasedStatementCustomKey) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateBasedStatementCustomKeys"} + for i := range v { + if err := validateRateBasedStatementCustomKey(&v[i]); err != nil { + invalidParams.AddNested(fmt.Sprintf("[%d]", i), err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateLimitCookie(v *types.RateLimitCookie) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateLimitCookie"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.TextTransformations == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextTransformations")) + } else if v.TextTransformations != nil { + if err := validateTextTransformations(v.TextTransformations); err != nil { + invalidParams.AddNested("TextTransformations", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateLimitHeader(v *types.RateLimitHeader) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateLimitHeader"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.TextTransformations == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextTransformations")) + } else if v.TextTransformations != nil { + if err := validateTextTransformations(v.TextTransformations); err != nil { + invalidParams.AddNested("TextTransformations", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateLimitLabelNamespace(v *types.RateLimitLabelNamespace) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateLimitLabelNamespace"} + if v.Namespace == nil { + invalidParams.Add(smithy.NewErrParamRequired("Namespace")) + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateLimitQueryArgument(v *types.RateLimitQueryArgument) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateLimitQueryArgument"} + if v.Name == nil { + invalidParams.Add(smithy.NewErrParamRequired("Name")) + } + if v.TextTransformations == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextTransformations")) + } else if v.TextTransformations != nil { + if err := validateTextTransformations(v.TextTransformations); err != nil { + invalidParams.AddNested("TextTransformations", err.(smithy.InvalidParamsError)) + } + } + if invalidParams.Len() > 0 { + return invalidParams + } else { + return nil + } +} + +func validateRateLimitQueryString(v *types.RateLimitQueryString) error { + if v == nil { + return nil + } + invalidParams := smithy.InvalidParamsError{Context: "RateLimitQueryString"} + if v.TextTransformations == nil { + invalidParams.Add(smithy.NewErrParamRequired("TextTransformations")) + } else if v.TextTransformations != nil { + if err := validateTextTransformations(v.TextTransformations); err != nil { + invalidParams.AddNested("TextTransformations", err.(smithy.InvalidParamsError)) + } + } if invalidParams.Len() > 0 { return invalidParams } else {