enable

Inspector2.Client.enable(**kwargs)

Enables Amazon Inspector scans for one or more Amazon Web Services accounts.

See also: AWS API Documentation

Request Syntax

response = client.enable(
    accountIds=[
        'string',
    ],
    clientToken='string',
    resourceTypes=[
        'EC2'|'ECR'|'LAMBDA',
    ]
)
Parameters
  • accountIds (list) --

    A list of account IDs you want to enable Amazon Inspector scans for.

    • (string) --
  • clientToken (string) --

    The idempotency token for the request.

    This field is autopopulated if not provided.

  • resourceTypes (list) --

    [REQUIRED]

    The resource scan types you want to enable.

    • (string) --
Return type

dict

Returns

Response Syntax

{
    'accounts': [
        {
            'accountId': 'string',
            'resourceStatus': {
                'ec2': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                'ecr': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                'lambda': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
            },
            'status': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
        },
    ],
    'failedAccounts': [
        {
            'accountId': 'string',
            'errorCode': 'ALREADY_ENABLED'|'ENABLE_IN_PROGRESS'|'DISABLE_IN_PROGRESS'|'SUSPEND_IN_PROGRESS'|'RESOURCE_NOT_FOUND'|'ACCESS_DENIED'|'INTERNAL_ERROR'|'SSM_UNAVAILABLE'|'SSM_THROTTLED'|'EVENTBRIDGE_UNAVAILABLE'|'EVENTBRIDGE_THROTTLED'|'RESOURCE_SCAN_NOT_DISABLED'|'DISASSOCIATE_ALL_MEMBERS'|'ACCOUNT_IS_ISOLATED',
            'errorMessage': 'string',
            'resourceStatus': {
                'ec2': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                'ecr': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED',
                'lambda': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
            },
            'status': 'ENABLING'|'ENABLED'|'DISABLING'|'DISABLED'|'SUSPENDING'|'SUSPENDED'
        },
    ]
}

Response Structure

  • (dict) --

    • accounts (list) --

      Information on the accounts that have had Amazon Inspector scans successfully enabled. Details are provided for each account.

      • (dict) --

        An Amazon Web Services account within your environment that Amazon Inspector has been enabled for.

        • accountId (string) --

          The ID of the Amazon Web Services account.

        • resourceStatus (dict) --

          Details of the status of Amazon Inspector scans by resource type.

          • ec2 (string) --

            The status of Amazon Inspector scanning for Amazon EC2 resources.

          • ecr (string) --

            The status of Amazon Inspector scanning for Amazon ECR resources.

          • lambda (string) --

            The status of Amazon Inspector scanning for AWS Lambda function resources.

        • status (string) --

          The status of Amazon Inspector for the account.

    • failedAccounts (list) --

      Information on any accounts for which Amazon Inspector scans could not be enabled. Details are provided for each account.

      • (dict) --

        An object with details on why an account failed to enable Amazon Inspector.

        • accountId (string) --

          The Amazon Web Services account ID.

        • errorCode (string) --

          The error code explaining why the account failed to enable Amazon Inspector.

        • errorMessage (string) --

          The error message received when the account failed to enable Amazon Inspector.

        • resourceStatus (dict) --

          An object detailing which resources Amazon Inspector is enabled to scan for the account.

          • ec2 (string) --

            The status of Amazon Inspector scanning for Amazon EC2 resources.

          • ecr (string) --

            The status of Amazon Inspector scanning for Amazon ECR resources.

          • lambda (string) --

            The status of Amazon Inspector scanning for AWS Lambda function resources.

        • status (string) --

          The status of Amazon Inspector for the account.

Exceptions

  • Inspector2.Client.exceptions.ValidationException
  • Inspector2.Client.exceptions.AccessDeniedException
  • Inspector2.Client.exceptions.ResourceNotFoundException
  • Inspector2.Client.exceptions.ThrottlingException
  • Inspector2.Client.exceptions.InternalServerException