CostandUsageReportService

Client

class CostandUsageReportService.Client

A low-level client representing AWS Cost and Usage Report Service:

client = session.create_client('cur')

These are the available methods:

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.
delete_report_definition(**kwargs)

Delete a specified report definition

See also: AWS API Documentation

Request Syntax

response = client.delete_report_definition(
    ReportName='string'
)
Parameters
ReportName (string) -- Preferred name for a report, it has to be unique. Must starts with a number/letter, case sensitive. Limited to 256 characters.
Return type
dict
Returns
Response Syntax
{
    'ResponseMessage': 'string'
}

Response Structure

  • (dict) -- Response of DeleteReportDefinition
    • ResponseMessage (string) -- A message indicates if the deletion is successful.
describe_report_definitions(**kwargs)

Describe a list of report definitions owned by the account

See also: AWS API Documentation

Request Syntax

response = client.describe_report_definitions(
    MaxResults=123,
    NextToken='string'
)
Parameters
  • MaxResults (integer) -- The max number of results returned by the operation.
  • NextToken (string) -- A generic string.
Return type

dict

Returns

Response Syntax

{
    'ReportDefinitions': [
        {
            'ReportName': 'string',
            'TimeUnit': 'HOURLY'|'DAILY',
            'Format': 'textORcsv',
            'Compression': 'ZIP'|'GZIP',
            'AdditionalSchemaElements': [
                'RESOURCES',
            ],
            'S3Bucket': 'string',
            'S3Prefix': 'string',
            'S3Region': 'us-east-1'|'us-west-1'|'us-west-2'|'eu-central-1'|'eu-west-1'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1',
            'AdditionalArtifacts': [
                'REDSHIFT'|'QUICKSIGHT',
            ]
        },
    ],
    'NextToken': 'string'
}

Response Structure

  • (dict) -- Response of DescribeReportDefinitions
    • ReportDefinitions (list) -- A list of report definitions.
      • (dict) -- The definition of AWS Cost and Usage Report. Customer can specify the report name, time unit, report format, compression format, S3 bucket and additional artifacts and schema elements in the definition.
        • ReportName (string) -- Preferred name for a report, it has to be unique. Must starts with a number/letter, case sensitive. Limited to 256 characters.
        • TimeUnit (string) -- The frequency on which report data are measured and displayed.
        • Format (string) -- Preferred format for report.
        • Compression (string) -- Preferred compression format for report.
        • AdditionalSchemaElements (list) -- A list of schema elements.
          • (string) -- Preference of including Resource IDs. You can include additional details about individual resource IDs in your report.
        • S3Bucket (string) -- Name of customer S3 bucket.
        • S3Prefix (string) -- Preferred report path prefix. Limited to 256 characters.
        • S3Region (string) -- Region of customer S3 bucket.
        • AdditionalArtifacts (list) -- A list of additional artifacts.
          • (string) -- Enable support for Redshift and/or QuickSight.
    • NextToken (string) -- A generic string.

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
put_report_definition(**kwargs)

Create a new report definition

See also: AWS API Documentation

Request Syntax

response = client.put_report_definition(
    ReportDefinition={
        'ReportName': 'string',
        'TimeUnit': 'HOURLY'|'DAILY',
        'Format': 'textORcsv',
        'Compression': 'ZIP'|'GZIP',
        'AdditionalSchemaElements': [
            'RESOURCES',
        ],
        'S3Bucket': 'string',
        'S3Prefix': 'string',
        'S3Region': 'us-east-1'|'us-west-1'|'us-west-2'|'eu-central-1'|'eu-west-1'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1',
        'AdditionalArtifacts': [
            'REDSHIFT'|'QUICKSIGHT',
        ]
    }
)
Parameters
ReportDefinition (dict) --

[REQUIRED] The definition of AWS Cost and Usage Report. Customer can specify the report name, time unit, report format, compression format, S3 bucket and additional artifacts and schema elements in the definition.

  • ReportName (string) -- [REQUIRED] Preferred name for a report, it has to be unique. Must starts with a number/letter, case sensitive. Limited to 256 characters.
  • TimeUnit (string) -- [REQUIRED] The frequency on which report data are measured and displayed.
  • Format (string) -- [REQUIRED] Preferred format for report.
  • Compression (string) -- [REQUIRED] Preferred compression format for report.
  • AdditionalSchemaElements (list) -- [REQUIRED] A list of schema elements.
    • (string) -- Preference of including Resource IDs. You can include additional details about individual resource IDs in your report.
  • S3Bucket (string) -- [REQUIRED] Name of customer S3 bucket.
  • S3Prefix (string) -- [REQUIRED] Preferred report path prefix. Limited to 256 characters.
  • S3Region (string) -- [REQUIRED] Region of customer S3 bucket.
  • AdditionalArtifacts (list) -- A list of additional artifacts.
    • (string) -- Enable support for Redshift and/or QuickSight.
Return type
dict
Returns
Response Syntax
{}

Response Structure

  • (dict) -- Response of PutReportDefinition

Paginators

The available paginators are:

class CostandUsageReportService.Paginator.DescribeReportDefinitions
paginator = client.get_paginator('describe_report_definitions')
paginate(**kwargs)

Creates an iterator that will paginate through responses from CostandUsageReportService.Client.describe_report_definitions().

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
{
    'ReportDefinitions': [
        {
            'ReportName': 'string',
            'TimeUnit': 'HOURLY'|'DAILY',
            'Format': 'textORcsv',
            'Compression': 'ZIP'|'GZIP',
            'AdditionalSchemaElements': [
                'RESOURCES',
            ],
            'S3Bucket': 'string',
            'S3Prefix': 'string',
            'S3Region': 'us-east-1'|'us-west-1'|'us-west-2'|'eu-central-1'|'eu-west-1'|'ap-southeast-1'|'ap-southeast-2'|'ap-northeast-1',
            'AdditionalArtifacts': [
                'REDSHIFT'|'QUICKSIGHT',
            ]
        },
    ],

}

Response Structure

  • (dict) -- Response of DescribeReportDefinitions
    • ReportDefinitions (list) -- A list of report definitions.
      • (dict) -- The definition of AWS Cost and Usage Report. Customer can specify the report name, time unit, report format, compression format, S3 bucket and additional artifacts and schema elements in the definition.
        • ReportName (string) -- Preferred name for a report, it has to be unique. Must starts with a number/letter, case sensitive. Limited to 256 characters.
        • TimeUnit (string) -- The frequency on which report data are measured and displayed.
        • Format (string) -- Preferred format for report.
        • Compression (string) -- Preferred compression format for report.
        • AdditionalSchemaElements (list) -- A list of schema elements.
          • (string) -- Preference of including Resource IDs. You can include additional details about individual resource IDs in your report.
        • S3Bucket (string) -- Name of customer S3 bucket.
        • S3Prefix (string) -- Preferred report path prefix. Limited to 256 characters.
        • S3Region (string) -- Region of customer S3 bucket.
        • AdditionalArtifacts (list) -- A list of additional artifacts.
          • (string) -- Enable support for Redshift and/or QuickSight.