Macie

Client

class Macie.Client

A low-level client representing Amazon Macie:

client = session.create_client('macie')

These are the available methods:

associate_member_account(**kwargs)

Associates a specified AWS account with Amazon Macie Classic as a member account.

See also: AWS API Documentation

Request Syntax

response = client.associate_member_account(
    memberAccountId='string'
)
Parameters
memberAccountId (string) --

[REQUIRED]

The ID of the AWS account that you want to associate with Amazon Macie Classic as a member account.

Returns
None

Exceptions

associate_s3_resources(**kwargs)

Associates specified S3 resources with Amazon Macie Classic for monitoring and data classification. If memberAccountId isn't specified, the action associates specified S3 resources with Macie Classic for the current master account. If memberAccountId is specified, the action associates specified S3 resources with Macie Classic for the specified member account.

See also: AWS API Documentation

Request Syntax

response = client.associate_s3_resources(
    memberAccountId='string',
    s3Resources=[
        {
            'bucketName': 'string',
            'prefix': 'string',
            'classificationType': {
                'oneTime': 'FULL'|'NONE',
                'continuous': 'FULL'
            }
        },
    ]
)
Parameters
  • memberAccountId (string) -- The ID of the Amazon Macie Classic member account whose resources you want to associate with Macie Classic.
  • s3Resources (list) --

    [REQUIRED]

    The S3 resources that you want to associate with Amazon Macie Classic for monitoring and data classification.

    • (dict) --

      The S3 resources that you want to associate with Amazon Macie Classic for monitoring and data classification. This data type is used as a request parameter in the AssociateS3Resources action and a response parameter in the ListS3Resources action.

      • bucketName (string) -- [REQUIRED]

        The name of the S3 bucket that you want to associate with Amazon Macie Classic.

      • prefix (string) --

        The prefix of the S3 bucket that you want to associate with Amazon Macie Classic.

      • classificationType (dict) -- [REQUIRED]

        The classification type that you want to specify for the resource associated with Amazon Macie Classic.

        • oneTime (string) -- [REQUIRED]

          A one-time classification of all of the existing objects in a specified S3 bucket.

        • continuous (string) -- [REQUIRED]

          A continuous classification of the objects that are added to a specified S3 bucket. Amazon Macie Classic begins performing continuous classification after a bucket is successfully associated with Amazon Macie Classic.

Return type

dict

Returns

Response Syntax

{
    'failedS3Resources': [
        {
            'failedItem': {
                'bucketName': 'string',
                'prefix': 'string'
            },
            'errorCode': 'string',
            'errorMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • failedS3Resources (list) --

      S3 resources that couldn't be associated with Amazon Macie Classic. An error code and an error message are provided for each failed item.

      • (dict) --

        Includes details about the failed S3 resources.

        • failedItem (dict) --

          The failed S3 resources.

          • bucketName (string) --

            The name of the S3 bucket.

          • prefix (string) --

            The prefix of the S3 bucket.

        • errorCode (string) --

          The status code of a failed item.

        • errorMessage (string) --

          The error message of a failed item.

Exceptions

can_paginate(operation_name)

Check if an operation can be paginated.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Returns
True if the operation can be paginated, False otherwise.
disassociate_member_account(**kwargs)

Removes the specified member account from Amazon Macie Classic.

See also: AWS API Documentation

Request Syntax

response = client.disassociate_member_account(
    memberAccountId='string'
)
Parameters
memberAccountId (string) --

[REQUIRED]

The ID of the member account that you want to remove from Amazon Macie Classic.

Returns
None

Exceptions

disassociate_s3_resources(**kwargs)

Removes specified S3 resources from being monitored by Amazon Macie Classic. If memberAccountId isn't specified, the action removes specified S3 resources from Macie Classic for the current master account. If memberAccountId is specified, the action removes specified S3 resources from Macie Classic for the specified member account.

See also: AWS API Documentation

Request Syntax

response = client.disassociate_s3_resources(
    memberAccountId='string',
    associatedS3Resources=[
        {
            'bucketName': 'string',
            'prefix': 'string'
        },
    ]
)
Parameters
  • memberAccountId (string) -- The ID of the Amazon Macie Classic member account whose resources you want to remove from being monitored by Amazon Macie Classic.
  • associatedS3Resources (list) --

    [REQUIRED]

    The S3 resources (buckets or prefixes) that you want to remove from being monitored and classified by Amazon Macie Classic.

    • (dict) --

      Contains information about the S3 resource. This data type is used as a request parameter in the DisassociateS3Resources action and can be used as a response parameter in the AssociateS3Resources and UpdateS3Resources actions.

      • bucketName (string) -- [REQUIRED]

        The name of the S3 bucket.

      • prefix (string) --

        The prefix of the S3 bucket.

Return type

dict

Returns

Response Syntax

{
    'failedS3Resources': [
        {
            'failedItem': {
                'bucketName': 'string',
                'prefix': 'string'
            },
            'errorCode': 'string',
            'errorMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • failedS3Resources (list) --

      S3 resources that couldn't be removed from being monitored and classified by Amazon Macie Classic. An error code and an error message are provided for each failed item.

      • (dict) --

        Includes details about the failed S3 resources.

        • failedItem (dict) --

          The failed S3 resources.

          • bucketName (string) --

            The name of the S3 bucket.

          • prefix (string) --

            The prefix of the S3 bucket.

        • errorCode (string) --

          The status code of a failed item.

        • errorMessage (string) --

          The error message of a failed item.

Exceptions

generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)

Generate a presigned url given a client, its method, and arguments

Parameters
  • ClientMethod (string) -- The client method to presign for
  • Params (dict) -- The parameters normally passed to ClientMethod.
  • ExpiresIn (int) -- The number of seconds the presigned url is valid for. By default it expires in an hour (3600 seconds)
  • HttpMethod (string) -- The http method to use on the generated url. By default, the http method is whatever is used in the method's model.
Returns

The presigned url

get_paginator(operation_name)

Create a paginator for an operation.

Parameters
operation_name (string) -- The operation name. This is the same name as the method name on the client. For example, if the method name is create_foo, and you'd normally invoke the operation as client.create_foo(**kwargs), if the create_foo operation can be paginated, you can use the call client.get_paginator("create_foo").
Raises OperationNotPageableError
Raised if the operation is not pageable. You can use the client.can_paginate method to check if an operation is pageable.
Return type
L{botocore.paginate.Paginator}
Returns
A paginator object.
get_waiter(waiter_name)

Returns an object that can wait for some condition.

Parameters
waiter_name (str) -- The name of the waiter to get. See the waiters section of the service docs for a list of available waiters.
Returns
The specified waiter object.
Return type
botocore.waiter.Waiter
list_member_accounts(**kwargs)

Lists all Amazon Macie Classic member accounts for the current Amazon Macie Classic master account.

See also: AWS API Documentation

Request Syntax

response = client.list_member_accounts(
    nextToken='string',
    maxResults=123
)
Parameters
  • nextToken (string) -- Use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListMemberAccounts action. Subsequent calls to the action fill nextToken in the request with the value of nextToken from the previous response to continue listing data.
  • maxResults (integer) -- Use this parameter to indicate the maximum number of items that you want in the response. The default value is 250.
Return type

dict

Returns

Response Syntax

{
    'memberAccounts': [
        {
            'accountId': 'string'
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • memberAccounts (list) --

      A list of the Amazon Macie Classic member accounts returned by the action. The current master account is also included in this list.

      • (dict) --

        Contains information about the Amazon Macie Classic member account.

        • accountId (string) --

          The AWS account ID of the Amazon Macie Classic member account.

    • nextToken (string) --

      When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.

Exceptions

list_s3_resources(**kwargs)

Lists all the S3 resources associated with Amazon Macie Classic. If memberAccountId isn't specified, the action lists the S3 resources associated with Amazon Macie Classic for the current master account. If memberAccountId is specified, the action lists the S3 resources associated with Amazon Macie Classic for the specified member account.

See also: AWS API Documentation

Request Syntax

response = client.list_s3_resources(
    memberAccountId='string',
    nextToken='string',
    maxResults=123
)
Parameters
  • memberAccountId (string) -- The Amazon Macie Classic member account ID whose associated S3 resources you want to list.
  • nextToken (string) -- Use this parameter when paginating results. Set its value to null on your first call to the ListS3Resources action. Subsequent calls to the action fill nextToken in the request with the value of nextToken from the previous response to continue listing data.
  • maxResults (integer) -- Use this parameter to indicate the maximum number of items that you want in the response. The default value is 250.
Return type

dict

Returns

Response Syntax

{
    's3Resources': [
        {
            'bucketName': 'string',
            'prefix': 'string',
            'classificationType': {
                'oneTime': 'FULL'|'NONE',
                'continuous': 'FULL'
            }
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • s3Resources (list) --

      A list of the associated S3 resources returned by the action.

      • (dict) --

        The S3 resources that you want to associate with Amazon Macie Classic for monitoring and data classification. This data type is used as a request parameter in the AssociateS3Resources action and a response parameter in the ListS3Resources action.

        • bucketName (string) --

          The name of the S3 bucket that you want to associate with Amazon Macie Classic.

        • prefix (string) --

          The prefix of the S3 bucket that you want to associate with Amazon Macie Classic.

        • classificationType (dict) --

          The classification type that you want to specify for the resource associated with Amazon Macie Classic.

          • oneTime (string) --

            A one-time classification of all of the existing objects in a specified S3 bucket.

          • continuous (string) --

            A continuous classification of the objects that are added to a specified S3 bucket. Amazon Macie Classic begins performing continuous classification after a bucket is successfully associated with Amazon Macie Classic.

    • nextToken (string) --

      When a response is generated, if there is more data to be listed, this parameter is present in the response and contains the value to use for the nextToken parameter in a subsequent pagination request. If there is no more data to be listed, this parameter is set to null.

Exceptions

update_s3_resources(**kwargs)

Updates the classification types for the specified S3 resources. If memberAccountId isn't specified, the action updates the classification types of the S3 resources associated with Amazon Macie Classic for the current master account. If memberAccountId is specified, the action updates the classification types of the S3 resources associated with Amazon Macie Classic for the specified member account.

See also: AWS API Documentation

Request Syntax

response = client.update_s3_resources(
    memberAccountId='string',
    s3ResourcesUpdate=[
        {
            'bucketName': 'string',
            'prefix': 'string',
            'classificationTypeUpdate': {
                'oneTime': 'FULL'|'NONE',
                'continuous': 'FULL'
            }
        },
    ]
)
Parameters
  • memberAccountId (string) -- The AWS ID of the Amazon Macie Classic member account whose S3 resources' classification types you want to update.
  • s3ResourcesUpdate (list) --

    [REQUIRED]

    The S3 resources whose classification types you want to update.

    • (dict) --

      The S3 resources whose classification types you want to update. This data type is used as a request parameter in the UpdateS3Resources action.

      • bucketName (string) -- [REQUIRED]

        The name of the S3 bucket whose classification types you want to update.

      • prefix (string) --

        The prefix of the S3 bucket whose classification types you want to update.

      • classificationTypeUpdate (dict) -- [REQUIRED]

        The classification type that you want to update for the resource associated with Amazon Macie Classic.

        • oneTime (string) --

          A one-time classification of all of the existing objects in a specified S3 bucket.

        • continuous (string) --

          A continuous classification of the objects that are added to a specified S3 bucket. Amazon Macie Classic begins performing continuous classification after a bucket is successfully associated with Amazon Macie Classic.

Return type

dict

Returns

Response Syntax

{
    'failedS3Resources': [
        {
            'failedItem': {
                'bucketName': 'string',
                'prefix': 'string'
            },
            'errorCode': 'string',
            'errorMessage': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • failedS3Resources (list) --

      The S3 resources whose classification types can't be updated. An error code and an error message are provided for each failed item.

      • (dict) --

        Includes details about the failed S3 resources.

        • failedItem (dict) --

          The failed S3 resources.

          • bucketName (string) --

            The name of the S3 bucket.

          • prefix (string) --

            The prefix of the S3 bucket.

        • errorCode (string) --

          The status code of a failed item.

        • errorMessage (string) --

          The error message of a failed item.

Exceptions

Client Exceptions

Client exceptions are available on a client instance via the exceptions property. For more detailed instructions and examples on the exact usage of client exceptions, see the error handling user guide.

The available client exceptions are:

class Macie.Client.exceptions.AccessDeniedException

You do not have required permissions to access the requested resource.

Example

try:
  ...
except client.exceptions.AccessDeniedException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'message': 'string',
    'resourceType': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    You do not have required permissions to access the requested resource.

    • message (string) --
    • resourceType (string) -- Resource type that caused the exception
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class Macie.Client.exceptions.InternalException

Internal server error.

Example

try:
  ...
except client.exceptions.InternalException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'errorCode': 'string',
    'message': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    Internal server error.

    • errorCode (string) -- Error code for the exception
    • message (string) --
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class Macie.Client.exceptions.InvalidInputException

The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

Example

try:
  ...
except client.exceptions.InvalidInputException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'errorCode': 'string',
    'message': 'string',
    'fieldName': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The request was rejected because an invalid or out-of-range value was supplied for an input parameter.

    • errorCode (string) -- Error code for the exception
    • message (string) --
    • fieldName (string) -- Field that has invalid input
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.
class Macie.Client.exceptions.LimitExceededException

The request was rejected because it attempted to create resources beyond the current AWS account limits. The error code describes the limit exceeded.

Example

try:
  ...
except client.exceptions.LimitExceededException as e:
  print(e.response)
response

The parsed error response. All exceptions have a top level Error key that provides normalized access to common exception atrributes. All other keys are specific to this service or exception class.

Syntax

{
    'errorCode': 'string',
    'message': 'string',
    'resourceType': 'string',
    'Error': {
        'Code': 'string',
        'Message': 'string'
    }
}

Structure

  • (dict) --

    The request was rejected because it attempted to create resources beyond the current AWS account limits. The error code describes the limit exceeded.

    • errorCode (string) -- Error code for the exception
    • message (string) --
    • resourceType (string) -- Resource type that caused the exception
    • Error (dict) -- Normalized access to common exception attributes.
      • Code (string) -- An identifier specifying the exception type.
      • Message (string) -- A descriptive message explaining why the exception occured.

Paginators

The available paginators are:

class Macie.Paginator.ListMemberAccounts
paginator = client.get_paginator('list_member_accounts')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Macie.Client.list_member_accounts().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
PaginationConfig (dict) --

A dictionary that provides parameters to control pagination.

  • MaxItems (integer) --

    The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

  • PageSize (integer) --

    The size of each page.

  • StartingToken (string) --

    A token to specify where to start paginating. This is the NextToken from a previous response.

Return type
dict
Returns
Response Syntax
{
    'memberAccounts': [
        {
            'accountId': 'string'
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --
    • memberAccounts (list) --

      A list of the Amazon Macie Classic member accounts returned by the action. The current master account is also included in this list.

      • (dict) --

        Contains information about the Amazon Macie Classic member account.

        • accountId (string) --

          The AWS account ID of the Amazon Macie Classic member account.

    • NextToken (string) --

      A token to resume pagination.

class Macie.Paginator.ListS3Resources
paginator = client.get_paginator('list_s3_resources')
paginate(**kwargs)

Creates an iterator that will paginate through responses from Macie.Client.list_s3_resources().

See also: AWS API Documentation

Request Syntax

response_iterator = paginator.paginate(
    memberAccountId='string',
    PaginationConfig={
        'MaxItems': 123,
        'PageSize': 123,
        'StartingToken': 'string'
    }
)
Parameters
  • memberAccountId (string) -- The Amazon Macie Classic member account ID whose associated S3 resources you want to list.
  • PaginationConfig (dict) --

    A dictionary that provides parameters to control pagination.

    • MaxItems (integer) --

      The total number of items to return. If the total number of items available is more than the value specified in max-items then a NextToken will be provided in the output that you can use to resume pagination.

    • PageSize (integer) --

      The size of each page.

    • StartingToken (string) --

      A token to specify where to start paginating. This is the NextToken from a previous response.

Return type

dict

Returns

Response Syntax

{
    's3Resources': [
        {
            'bucketName': 'string',
            'prefix': 'string',
            'classificationType': {
                'oneTime': 'FULL'|'NONE',
                'continuous': 'FULL'
            }
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) --

    • s3Resources (list) --

      A list of the associated S3 resources returned by the action.

      • (dict) --

        The S3 resources that you want to associate with Amazon Macie Classic for monitoring and data classification. This data type is used as a request parameter in the AssociateS3Resources action and a response parameter in the ListS3Resources action.

        • bucketName (string) --

          The name of the S3 bucket that you want to associate with Amazon Macie Classic.

        • prefix (string) --

          The prefix of the S3 bucket that you want to associate with Amazon Macie Classic.

        • classificationType (dict) --

          The classification type that you want to specify for the resource associated with Amazon Macie Classic.

          • oneTime (string) --

            A one-time classification of all of the existing objects in a specified S3 bucket.

          • continuous (string) --

            A continuous classification of the objects that are added to a specified S3 bucket. Amazon Macie Classic begins performing continuous classification after a bucket is successfully associated with Amazon Macie Classic.

    • NextToken (string) --

      A token to resume pagination.