NetworkSecurityManagerCustomerAPI / Client / create_scope

create_scope

NetworkSecurityManagerCustomerAPI.Client.create_scope(**kwargs)

Creates a scope. A scope selects the accounts and resources that a deployment applies to. Use isPublished to create the scope in published ( ACTIVE) or draft ( DRAFT) state.

See also: AWS API Documentation

Request Syntax

response = client.create_scope(
    clientToken='string',
    scopeName='string',
    scopeDescription='string',
    scopeConfiguration={
        'accountFilter': {
            'includeAll': {}
            ,
            'include': {
                'accountIds': [
                    'string',
                ],
                'organizationalUnits': [
                    'string',
                ]
            },
            'exclude': {
                'accountIds': [
                    'string',
                ],
                'organizationalUnits': [
                    'string',
                ]
            }
        },
        'resourceScopes': {
            'string': {
                'includeAll': True|False,
                'include': {
                    'explicitArns': [
                        'string',
                    ],
                    'expression': {
                        'criteria': {
                            'tags': {
                                'string': 'string'
                            },
                            'albConfig': {
                                'scheme': 'internet-facing'|'internal',
                                'ipAddressType': 'ipv4'|'dualstack'|'dualstack-without-public-ipv4'
                            }
                        },
                        'and': [
                            {'... recursive ...'},
                        ],
                        'or': [
                            {'... recursive ...'},
                        ],
                        'not': {'... recursive ...'}
                    }
                },
                'exclude': {
                    'explicitArns': [
                        'string',
                    ],
                    'expression': {
                        'criteria': {
                            'tags': {
                                'string': 'string'
                            },
                            'albConfig': {
                                'scheme': 'internet-facing'|'internal',
                                'ipAddressType': 'ipv4'|'dualstack'|'dualstack-without-public-ipv4'
                            }
                        },
                        'and': [
                            {'... recursive ...'},
                        ],
                        'or': [
                            {'... recursive ...'},
                        ],
                        'not': {'... recursive ...'}
                    }
                }
            }
        }
    },
    isPublished=True|False,
    tags={
        'string': 'string'
    }
)
Parameters:
  • clientToken (string) –

    A unique, case-sensitive token that you provide to ensure that the operation completes no more than one time. If you retry a request with the same client token and the same parameters, the service returns the result of the original successful request.

    This field is autopopulated if not provided.

  • scopeName (string) –

    [REQUIRED]

    The name of the scope.

  • scopeDescription (string) – A description of the scope.

  • scopeConfiguration (dict) –

    [REQUIRED]

    The configuration that defines which accounts and resources are in scope.

    • accountFilter (dict) –

      The account filter that determines which accounts are in scope. When set, exactly one of includeAll, include, or exclude is set.

      Organization administrators must include an account filter in every scope configuration. Single-account administrators must omit it: a scope without an account filter applies only to the administrator’s own account. The presence of an account filter is fixed when the scope is created: an update can’t add an account filter to a scope that was created without one, or remove the account filter from a scope that was created with one.

      Note

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

      • includeAll (dict) –

        Includes all accounts. No account filtering is applied.

      • include (dict) –

        Includes only the specified accounts and organizational units.

        • accountIds (list) –

          The list of AWS account IDs.

          • (string) –

        • organizationalUnits (list) –

          The AWS Organizations organizational units (OUs) in the selection.

          • (string) –

      • exclude (dict) –

        Excludes the specified accounts and organizational units. All others are in scope.

        • accountIds (list) –

          The list of AWS account IDs.

          • (string) –

        • organizationalUnits (list) –

          The AWS Organizations organizational units (OUs) in the selection.

          • (string) –

    • resourceScopes (dict) – [REQUIRED]

      The resource-level scoping configuration, keyed by resource type, that defines which resources within the selected accounts are in scope.

      • (string) –

        • (dict) –

          Defines which resources of a given type are in scope. Exactly one of includeAll, include, or exclude is set.

          • includeAll (boolean) –

            Includes all resources of the resource type.

          • include (dict) –

            Includes the resources that match the specified criteria or explicit ARNs.

            • explicitArns (list) –

              An explicit list of resource ARNs.

              • (string) –

            • expression (dict) –

              A logical expression that selects resources by combining criteria with AND, OR, and NOT operators.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • criteria (dict) –

                A leaf condition that matches resources by tag or by resource-type-specific configuration.

                Note

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

                • tags (dict) –

                  Tag key-value pairs used to match resources.

                  • (string) –

                    • (string) –

                • albConfig (dict) –

                  Filter criteria specific to Application Load Balancers.

                  • scheme (string) –

                    The scheme of the Application Load Balancer, either internet-facing or internal.

                  • ipAddressType (string) –

                    The IP address type of the Application Load Balancer.

              • and (list) –

                A list of subexpressions that must all match.

                • (dict) –

                  A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • or (list) –

                A list of subexpressions of which at least one must match.

                • (dict) –

                  A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • not (dict) –

                A subexpression that must not match.

                Note

                This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

          • exclude (dict) –

            Excludes the resources that match the specified criteria or explicit ARNs.

            • explicitArns (list) –

              An explicit list of resource ARNs.

              • (string) –

            • expression (dict) –

              A logical expression that selects resources by combining criteria with AND, OR, and NOT operators.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • criteria (dict) –

                A leaf condition that matches resources by tag or by resource-type-specific configuration.

                Note

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

                • tags (dict) –

                  Tag key-value pairs used to match resources.

                  • (string) –

                    • (string) –

                • albConfig (dict) –

                  Filter criteria specific to Application Load Balancers.

                  • scheme (string) –

                    The scheme of the Application Load Balancer, either internet-facing or internal.

                  • ipAddressType (string) –

                    The IP address type of the Application Load Balancer.

              • and (list) –

                A list of subexpressions that must all match.

                • (dict) –

                  A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • or (list) –

                A list of subexpressions of which at least one must match.

                • (dict) –

                  A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

              • not (dict) –

                A subexpression that must not match.

                Note

                This is a Tagged Union structure. Only one of the following top level keys can be set: criteria, and, or, not.

  • isPublished (boolean) – Specifies whether to publish the resource. When true, the resource is saved in published ( ACTIVE) state. When false, it is saved as a draft ( DRAFT). Default: true.

  • tags (dict) –

    The tags to add to the resource when it is created.

    • (string) –

      • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'scopeId': 'string',
    'scopeArn': 'string',
    'scopeName': 'string',
    'scopeDescription': 'string',
    'scopeConfiguration': {
        'accountFilter': {
            'includeAll': {},
            'include': {
                'accountIds': [
                    'string',
                ],
                'organizationalUnits': [
                    'string',
                ]
            },
            'exclude': {
                'accountIds': [
                    'string',
                ],
                'organizationalUnits': [
                    'string',
                ]
            }
        },
        'resourceScopes': {
            'string': {
                'includeAll': True|False,
                'include': {
                    'explicitArns': [
                        'string',
                    ],
                    'expression': {
                        'criteria': {
                            'tags': {
                                'string': 'string'
                            },
                            'albConfig': {
                                'scheme': 'internet-facing'|'internal',
                                'ipAddressType': 'ipv4'|'dualstack'|'dualstack-without-public-ipv4'
                            }
                        },
                        'and': [
                            {'... recursive ...'},
                        ],
                        'or': [
                            {'... recursive ...'},
                        ],
                        'not': {'... recursive ...'}
                    }
                },
                'exclude': {
                    'explicitArns': [
                        'string',
                    ],
                    'expression': {
                        'criteria': {
                            'tags': {
                                'string': 'string'
                            },
                            'albConfig': {
                                'scheme': 'internet-facing'|'internal',
                                'ipAddressType': 'ipv4'|'dualstack'|'dualstack-without-public-ipv4'
                            }
                        },
                        'and': [
                            {'... recursive ...'},
                        ],
                        'or': [
                            {'... recursive ...'},
                        ],
                        'not': {'... recursive ...'}
                    }
                }
            }
        }
    },
    'status': 'DRAFT'|'ACTIVE'|'DISABLED',
    'version': 'string',
    'updateToken': 'string',
    'isSnapshot': True|False,
    'hasPublishedVersion': True|False,
    'updatedAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) –

    • scopeId (string) –

      The service-generated id of the scope.

    • scopeArn (string) –

      The Amazon Resource Name (ARN) of the scope.

    • scopeName (string) –

      The name of the scope.

    • scopeDescription (string) –

      A description of the scope.

    • scopeConfiguration (dict) –

      The configuration that defines which accounts and resources are in scope.

      • accountFilter (dict) –

        The account filter that determines which accounts are in scope. When set, exactly one of includeAll, include, or exclude is set.

        Organization administrators must include an account filter in every scope configuration. Single-account administrators must omit it: a scope without an account filter applies only to the administrator’s own account. The presence of an account filter is fixed when the scope is created: an update can’t add an account filter to a scope that was created without one, or remove the account filter from a scope that was created with one.

        Note

        This is a Tagged Union structure. Only one of the following top level keys will be set: includeAll, include, exclude. 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'}
        
        • includeAll (dict) –

          Includes all accounts. No account filtering is applied.

        • include (dict) –

          Includes only the specified accounts and organizational units.

          • accountIds (list) –

            The list of AWS account IDs.

            • (string) –

          • organizationalUnits (list) –

            The AWS Organizations organizational units (OUs) in the selection.

            • (string) –

        • exclude (dict) –

          Excludes the specified accounts and organizational units. All others are in scope.

          • accountIds (list) –

            The list of AWS account IDs.

            • (string) –

          • organizationalUnits (list) –

            The AWS Organizations organizational units (OUs) in the selection.

            • (string) –

      • resourceScopes (dict) –

        The resource-level scoping configuration, keyed by resource type, that defines which resources within the selected accounts are in scope.

        • (string) –

          • (dict) –

            Defines which resources of a given type are in scope. Exactly one of includeAll, include, or exclude is set.

            • includeAll (boolean) –

              Includes all resources of the resource type.

            • include (dict) –

              Includes the resources that match the specified criteria or explicit ARNs.

              • explicitArns (list) –

                An explicit list of resource ARNs.

                • (string) –

              • expression (dict) –

                A logical expression that selects resources by combining criteria with AND, OR, and NOT operators.

                Note

                This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                
                • criteria (dict) –

                  A leaf condition that matches resources by tag or by resource-type-specific configuration.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys will be set: tags, albConfig. 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'}
                  
                  • tags (dict) –

                    Tag key-value pairs used to match resources.

                    • (string) –

                      • (string) –

                  • albConfig (dict) –

                    Filter criteria specific to Application Load Balancers.

                    • scheme (string) –

                      The scheme of the Application Load Balancer, either internet-facing or internal.

                    • ipAddressType (string) –

                      The IP address type of the Application Load Balancer.

                • and (list) –

                  A list of subexpressions that must all match.

                  • (dict) –

                    A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                    
                • or (list) –

                  A list of subexpressions of which at least one must match.

                  • (dict) –

                    A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                    
                • not (dict) –

                  A subexpression that must not match.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                  
            • exclude (dict) –

              Excludes the resources that match the specified criteria or explicit ARNs.

              • explicitArns (list) –

                An explicit list of resource ARNs.

                • (string) –

              • expression (dict) –

                A logical expression that selects resources by combining criteria with AND, OR, and NOT operators.

                Note

                This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                
                • criteria (dict) –

                  A leaf condition that matches resources by tag or by resource-type-specific configuration.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys will be set: tags, albConfig. 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'}
                  
                  • tags (dict) –

                    Tag key-value pairs used to match resources.

                    • (string) –

                      • (string) –

                  • albConfig (dict) –

                    Filter criteria specific to Application Load Balancers.

                    • scheme (string) –

                      The scheme of the Application Load Balancer, either internet-facing or internal.

                    • ipAddressType (string) –

                      The IP address type of the Application Load Balancer.

                • and (list) –

                  A list of subexpressions that must all match.

                  • (dict) –

                    A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                    
                • or (list) –

                  A list of subexpressions of which at least one must match.

                  • (dict) –

                    A logical expression that selects resources. Exactly one of criteria, and, or, or not is set.

                    Note

                    This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                    
                • not (dict) –

                  A subexpression that must not match.

                  Note

                  This is a Tagged Union structure. Only one of the following top level keys will be set: criteria, and, or, not. 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'}
                  
    • status (string) –

      The current status of the resource: DRAFT (unpublished, editable) or ACTIVE (published, in use).

    • version (string) –

      The version of the resource.

    • updateToken (string) –

      A token used for optimistic concurrency control. Each read and write returns an updateToken. Provide the most recent value on your next update to detect and prevent conflicting concurrent modifications.

    • isSnapshot (boolean) –

      Specifies whether the resource is a snapshot of a published version.

    • hasPublishedVersion (boolean) –

      Specifies whether a published version of the resource exists.

    • updatedAt (datetime) –

      The time when the resource was last updated.

Exceptions

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.ValidationException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.ServiceQuotaExceededException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.ConflictException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.ServiceUnavailableException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.TagPolicyViolationException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.InternalServerException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.AccessDeniedException

  • NetworkSecurityManagerCustomerAPI.Client.exceptions.ThrottlingException