VPCLattice / Client / update_rule

update_rule#

VPCLattice.Client.update_rule(**kwargs)#

Updates a rule for the listener. You can’t modify a default listener rule. To modify a default listener rule, use UpdateListener.

See also: AWS API Documentation

Request Syntax

response = client.update_rule(
    action={
        'fixedResponse': {
            'statusCode': 123
        },
        'forward': {
            'targetGroups': [
                {
                    'targetGroupIdentifier': 'string',
                    'weight': 123
                },
            ]
        }
    },
    listenerIdentifier='string',
    match={
        'httpMatch': {
            'headerMatches': [
                {
                    'caseSensitive': True|False,
                    'match': {
                        'contains': 'string',
                        'exact': 'string',
                        'prefix': 'string'
                    },
                    'name': 'string'
                },
            ],
            'method': 'string',
            'pathMatch': {
                'caseSensitive': True|False,
                'match': {
                    'exact': 'string',
                    'prefix': 'string'
                }
            }
        }
    },
    priority=123,
    ruleIdentifier='string',
    serviceIdentifier='string'
)
Parameters:
  • action (dict) –

    Information about the action for the specified listener rule.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: fixedResponse, forward.

    • fixedResponse (dict) –

      Describes the rule action that returns a custom HTTP response.

      • statusCode (integer) – [REQUIRED]

        The HTTP response code.

    • forward (dict) –

      The forward action. Traffic that matches the rule is forwarded to the specified target groups.

      • targetGroups (list) – [REQUIRED]

        The target groups. Traffic matching the rule is forwarded to the specified target groups. With forward actions, you can assign a weight that controls the prioritization and selection of each target group. This means that requests are distributed to individual target groups based on their weights. For example, if two target groups have the same weight, each target group receives half of the traffic.

        The default value is 1. This means that if only one target group is provided, there is no need to set the weight; 100% of traffic will go to that target group.

        • (dict) –

          Describes the weight of a target group.

          • targetGroupIdentifier (string) – [REQUIRED]

            The ID or Amazon Resource Name (ARN) of the target group.

          • weight (integer) –

            Only required if you specify multiple target groups for a forward action. The “weight” determines how requests are distributed to the target group. For example, if you specify two target groups, each with a weight of 10, each target group receives half the requests. If you specify two target groups, one with a weight of 10 and the other with a weight of 20, the target group with a weight of 20 receives twice as many requests as the other target group. If there’s only one target group specified, then the default value is 100.

  • listenerIdentifier (string) –

    [REQUIRED]

    The ID or Amazon Resource Name (ARN) of the listener.

  • match (dict) –

    The rule match.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: httpMatch.

    • httpMatch (dict) –

      The HTTP criteria that a rule must match.

      • headerMatches (list) –

        The header matches. Matches incoming requests with rule based on request header value before applying rule action.

        • (dict) –

          Describes the constraints for a header match. Matches incoming requests with rule based on request header value before applying rule action.

          • caseSensitive (boolean) –

            Indicates whether the match is case sensitive. Defaults to false.

          • match (dict) – [REQUIRED]

            The header match type.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: contains, exact, prefix.

            • contains (string) –

              Specifies a contains type match.

            • exact (string) –

              Specifies an exact type match.

            • prefix (string) –

              Specifies a prefix type match. Matches the value with the prefix.

          • name (string) – [REQUIRED]

            The name of the header.

      • method (string) –

        The HTTP method type.

      • pathMatch (dict) –

        The path match.

        • caseSensitive (boolean) –

          Indicates whether the match is case sensitive. Defaults to false.

        • match (dict) – [REQUIRED]

          The type of path match.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: exact, prefix.

          • exact (string) –

            An exact match of the path.

          • prefix (string) –

            A prefix match of the path.

  • priority (integer) – The rule priority. A listener can’t have multiple rules with the same priority.

  • ruleIdentifier (string) –

    [REQUIRED]

    The ID or Amazon Resource Name (ARN) of the rule.

  • serviceIdentifier (string) –

    [REQUIRED]

    The ID or Amazon Resource Name (ARN) of the service.

Return type:

dict

Returns:

Response Syntax

{
    'action': {
        'fixedResponse': {
            'statusCode': 123
        },
        'forward': {
            'targetGroups': [
                {
                    'targetGroupIdentifier': 'string',
                    'weight': 123
                },
            ]
        }
    },
    'arn': 'string',
    'id': 'string',
    'isDefault': True|False,
    'match': {
        'httpMatch': {
            'headerMatches': [
                {
                    'caseSensitive': True|False,
                    'match': {
                        'contains': 'string',
                        'exact': 'string',
                        'prefix': 'string'
                    },
                    'name': 'string'
                },
            ],
            'method': 'string',
            'pathMatch': {
                'caseSensitive': True|False,
                'match': {
                    'exact': 'string',
                    'prefix': 'string'
                }
            }
        }
    },
    'name': 'string',
    'priority': 123
}

Response Structure

  • (dict) –

    • action (dict) –

      Information about the action for the specified listener rule.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: fixedResponse, forward. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • fixedResponse (dict) –

        Describes the rule action that returns a custom HTTP response.

        • statusCode (integer) –

          The HTTP response code.

      • forward (dict) –

        The forward action. Traffic that matches the rule is forwarded to the specified target groups.

        • targetGroups (list) –

          The target groups. Traffic matching the rule is forwarded to the specified target groups. With forward actions, you can assign a weight that controls the prioritization and selection of each target group. This means that requests are distributed to individual target groups based on their weights. For example, if two target groups have the same weight, each target group receives half of the traffic.

          The default value is 1. This means that if only one target group is provided, there is no need to set the weight; 100% of traffic will go to that target group.

          • (dict) –

            Describes the weight of a target group.

            • targetGroupIdentifier (string) –

              The ID or Amazon Resource Name (ARN) of the target group.

            • weight (integer) –

              Only required if you specify multiple target groups for a forward action. The “weight” determines how requests are distributed to the target group. For example, if you specify two target groups, each with a weight of 10, each target group receives half the requests. If you specify two target groups, one with a weight of 10 and the other with a weight of 20, the target group with a weight of 20 receives twice as many requests as the other target group. If there’s only one target group specified, then the default value is 100.

    • arn (string) –

      The Amazon Resource Name (ARN) of the listener.

    • id (string) –

      The ID of the listener.

    • isDefault (boolean) –

      Indicates whether this is the default rule.

    • match (dict) –

      The rule match.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: httpMatch. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • httpMatch (dict) –

        The HTTP criteria that a rule must match.

        • headerMatches (list) –

          The header matches. Matches incoming requests with rule based on request header value before applying rule action.

          • (dict) –

            Describes the constraints for a header match. Matches incoming requests with rule based on request header value before applying rule action.

            • caseSensitive (boolean) –

              Indicates whether the match is case sensitive. Defaults to false.

            • match (dict) –

              The header match type.

              Note

              This is a Tagged Union structure. Only one of the following top level keys will be set: contains, exact, prefix. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

              'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
              
              • contains (string) –

                Specifies a contains type match.

              • exact (string) –

                Specifies an exact type match.

              • prefix (string) –

                Specifies a prefix type match. Matches the value with the prefix.

            • name (string) –

              The name of the header.

        • method (string) –

          The HTTP method type.

        • pathMatch (dict) –

          The path match.

          • caseSensitive (boolean) –

            Indicates whether the match is case sensitive. Defaults to false.

          • match (dict) –

            The type of path match.

            Note

            This is a Tagged Union structure. Only one of the following top level keys will be set: exact, prefix. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

            'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
            
            • exact (string) –

              An exact match of the path.

            • prefix (string) –

              A prefix match of the path.

    • name (string) –

      The name of the listener.

    • priority (integer) –

      The rule priority.

Exceptions

  • VPCLattice.Client.exceptions.ValidationException

  • VPCLattice.Client.exceptions.AccessDeniedException

  • VPCLattice.Client.exceptions.ThrottlingException

  • VPCLattice.Client.exceptions.ResourceNotFoundException

  • VPCLattice.Client.exceptions.ConflictException

  • VPCLattice.Client.exceptions.InternalServerException