SDK for PHP 3.x

Client: Aws\CostandUsageReportService\CostandUsageReportServiceClient
Service ID: cur
Version: 2017-01-06

This page describes the parameters and results for the operations of the AWS Cost and Usage Report Service (2017-01-06), and shows how to use the Aws\CostandUsageReportService\CostandUsageReportServiceClient object to call the described operations. This documentation is specific to the 2017-01-06 API version of the service.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

DeleteReportDefinition ( array $params = [] )
Deletes the specified report.
DescribeReportDefinitions ( array $params = [] )
Lists the Amazon Web Services Cost and Usage Report available to this account.
ListTagsForResource ( array $params = [] )
Lists the tags associated with the specified report definition.
ModifyReportDefinition ( array $params = [] )
Allows you to programmatically update your report preferences.
PutReportDefinition ( array $params = [] )
Creates a new report using the description that you provide.
TagResource ( array $params = [] )
Associates a set of tags with a report definition.
UntagResource ( array $params = [] )
Disassociates a set of tags from a report definition.

Paginators

Paginators handle automatically iterating over paginated API results. Paginators are associated with specific API operations, and they accept the parameters that the corresponding API operation accepts. You can get a paginator from a client class using getPaginator($paginatorName, $operationParameters). This client supports the following paginators:

DescribeReportDefinitions

Operations

DeleteReportDefinition

$result = $client->deleteReportDefinition([/* ... */]);
$promise = $client->deleteReportDefinitionAsync([/* ... */]);

Deletes the specified report. Any tags associated with the report are also deleted.

Parameter Syntax

$result = $client->deleteReportDefinition([
    'ReportName' => '<string>', // REQUIRED
]);

Parameter Details

Members
ReportName
Required: Yes
Type: string

The name of the report that you want to delete. The name must be unique, is case sensitive, and can't include spaces.

Result Syntax

[
    'ResponseMessage' => '<string>',
]

Result Details

Members
ResponseMessage
Type: string

Whether the deletion was successful or not.

Errors

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

Examples

Example 1: To delete the AWS Cost and Usage report named ExampleReport.

The following example deletes the AWS Cost and Usage report named ExampleReport.

$result = $client->deleteReportDefinition([
    'ReportName' => 'ExampleReport',
]);

DescribeReportDefinitions

$result = $client->describeReportDefinitions([/* ... */]);
$promise = $client->describeReportDefinitionsAsync([/* ... */]);

Lists the Amazon Web Services Cost and Usage Report available to this account.

Parameter Syntax

$result = $client->describeReportDefinitions([
    'MaxResults' => <integer>,
    'NextToken' => '<string>',
]);

Parameter Details

Members
MaxResults
Type: int

The maximum number of results that Amazon Web Services returns for the operation.

NextToken
Type: string

A generic string.

Result Syntax

[
    'NextToken' => '<string>',
    'ReportDefinitions' => [
        [
            'AdditionalArtifacts' => ['<string>', ...],
            'AdditionalSchemaElements' => ['<string>', ...],
            'BillingViewArn' => '<string>',
            'Compression' => 'ZIP|GZIP|Parquet',
            'Format' => 'textORcsv|Parquet',
            'RefreshClosedReports' => true || false,
            'ReportName' => '<string>',
            'ReportStatus' => [
                'lastDelivery' => '<string>',
                'lastStatus' => 'SUCCESS|ERROR_PERMISSIONS|ERROR_NO_BUCKET',
            ],
            'ReportVersioning' => 'CREATE_NEW_REPORT|OVERWRITE_REPORT',
            'S3Bucket' => '<string>',
            'S3Prefix' => '<string>',
            'S3Region' => 'af-south-1|ap-east-1|ap-south-1|ap-south-2|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-northeast-1|ap-northeast-2|ap-northeast-3|ca-central-1|eu-central-1|eu-central-2|eu-west-1|eu-west-2|eu-west-3|eu-north-1|eu-south-1|eu-south-2|me-central-1|me-south-1|sa-east-1|us-east-1|us-east-2|us-west-1|us-west-2|cn-north-1|cn-northwest-1',
            'TimeUnit' => 'HOURLY|DAILY|MONTHLY',
        ],
        // ...
    ],
]

Result Details

Members
NextToken
Type: string

A generic string.

ReportDefinitions
Type: Array of ReportDefinition structures

An Amazon Web Services Cost and Usage Report list owned by the account.

Errors

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

Examples

Example 1: To list the AWS Cost and Usage reports for the account.

The following example lists the AWS Cost and Usage reports for the account.

$result = $client->describeReportDefinitions([
    'MaxResults' => 5,
]);

Result syntax:

[
    'ReportDefinitions' => [
        [
            'AdditionalArtifacts' => [
                'QUICKSIGHT',
            ],
            'AdditionalSchemaElements' => [
                'RESOURCES',
            ],
            'Compression' => 'GZIP',
            'Format' => 'textORcsv',
            'ReportName' => 'ExampleReport',
            'S3Bucket' => 'example-s3-bucket',
            'S3Prefix' => 'exampleprefix',
            'S3Region' => 'us-east-1',
            'TimeUnit' => 'HOURLY',
        ],
        [
            'AdditionalArtifacts' => [
                'QUICKSIGHT',
            ],
            'AdditionalSchemaElements' => [
                'RESOURCES',
            ],
            'Compression' => 'GZIP',
            'Format' => 'textORcsv',
            'ReportName' => 'ExampleReport2',
            'S3Bucket' => 'example-s3-bucket',
            'S3Prefix' => 'exampleprefix',
            'S3Region' => 'us-east-1',
            'TimeUnit' => 'HOURLY',
        ],
    ],
]

ListTagsForResource

$result = $client->listTagsForResource([/* ... */]);
$promise = $client->listTagsForResourceAsync([/* ... */]);

Lists the tags associated with the specified report definition.

Parameter Syntax

$result = $client->listTagsForResource([
    'ReportName' => '<string>', // REQUIRED
]);

Parameter Details

Members
ReportName
Required: Yes
Type: string

The report name of the report definition that tags are to be returned for.

Result Syntax

[
    'Tags' => [
        [
            'Key' => '<string>',
            'Value' => '<string>',
        ],
        // ...
    ],
]

Result Details

Members
Tags
Type: Array of Tag structures

The tags assigned to the report definition resource.

Errors

ResourceNotFoundException:

The specified report (ReportName) in the request doesn't exist.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

ModifyReportDefinition

$result = $client->modifyReportDefinition([/* ... */]);
$promise = $client->modifyReportDefinitionAsync([/* ... */]);

Allows you to programmatically update your report preferences.

Parameter Syntax

$result = $client->modifyReportDefinition([
    'ReportDefinition' => [ // REQUIRED
        'AdditionalArtifacts' => ['<string>', ...],
        'AdditionalSchemaElements' => ['<string>', ...], // REQUIRED
        'BillingViewArn' => '<string>',
        'Compression' => 'ZIP|GZIP|Parquet', // REQUIRED
        'Format' => 'textORcsv|Parquet', // REQUIRED
        'RefreshClosedReports' => true || false,
        'ReportName' => '<string>', // REQUIRED
        'ReportStatus' => [
            'lastDelivery' => '<string>',
            'lastStatus' => 'SUCCESS|ERROR_PERMISSIONS|ERROR_NO_BUCKET',
        ],
        'ReportVersioning' => 'CREATE_NEW_REPORT|OVERWRITE_REPORT',
        'S3Bucket' => '<string>', // REQUIRED
        'S3Prefix' => '<string>', // REQUIRED
        'S3Region' => 'af-south-1|ap-east-1|ap-south-1|ap-south-2|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-northeast-1|ap-northeast-2|ap-northeast-3|ca-central-1|eu-central-1|eu-central-2|eu-west-1|eu-west-2|eu-west-3|eu-north-1|eu-south-1|eu-south-2|me-central-1|me-south-1|sa-east-1|us-east-1|us-east-2|us-west-1|us-west-2|cn-north-1|cn-northwest-1', // REQUIRED
        'TimeUnit' => 'HOURLY|DAILY|MONTHLY', // REQUIRED
    ],
    'ReportName' => '<string>', // REQUIRED
]);

Parameter Details

Members
ReportDefinition
Required: Yes
Type: ReportDefinition structure

The definition of Amazon Web Services Cost and Usage Report. You can specify the report name, time unit, report format, compression format, S3 bucket, additional artifacts, and schema elements in the definition.

ReportName
Required: Yes
Type: string

The name of the report that you want to create. The name must be unique, is case sensitive, and can't include spaces.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

PutReportDefinition

$result = $client->putReportDefinition([/* ... */]);
$promise = $client->putReportDefinitionAsync([/* ... */]);

Creates a new report using the description that you provide.

Parameter Syntax

$result = $client->putReportDefinition([
    'ReportDefinition' => [ // REQUIRED
        'AdditionalArtifacts' => ['<string>', ...],
        'AdditionalSchemaElements' => ['<string>', ...], // REQUIRED
        'BillingViewArn' => '<string>',
        'Compression' => 'ZIP|GZIP|Parquet', // REQUIRED
        'Format' => 'textORcsv|Parquet', // REQUIRED
        'RefreshClosedReports' => true || false,
        'ReportName' => '<string>', // REQUIRED
        'ReportStatus' => [
            'lastDelivery' => '<string>',
            'lastStatus' => 'SUCCESS|ERROR_PERMISSIONS|ERROR_NO_BUCKET',
        ],
        'ReportVersioning' => 'CREATE_NEW_REPORT|OVERWRITE_REPORT',
        'S3Bucket' => '<string>', // REQUIRED
        'S3Prefix' => '<string>', // REQUIRED
        'S3Region' => 'af-south-1|ap-east-1|ap-south-1|ap-south-2|ap-southeast-1|ap-southeast-2|ap-southeast-3|ap-northeast-1|ap-northeast-2|ap-northeast-3|ca-central-1|eu-central-1|eu-central-2|eu-west-1|eu-west-2|eu-west-3|eu-north-1|eu-south-1|eu-south-2|me-central-1|me-south-1|sa-east-1|us-east-1|us-east-2|us-west-1|us-west-2|cn-north-1|cn-northwest-1', // REQUIRED
        'TimeUnit' => 'HOURLY|DAILY|MONTHLY', // REQUIRED
    ],
    'Tags' => [
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
ReportDefinition
Required: Yes
Type: ReportDefinition structure

Represents the output of the PutReportDefinition operation. The content consists of the detailed metadata and data file information.

Tags
Type: Array of Tag structures

The tags to be assigned to the report definition resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

DuplicateReportNameException:

A report with the specified name already exists in the account. Specify a different report name.

ReportLimitReachedException:

This account already has five reports defined. To define a new report, you must delete an existing report.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

ResourceNotFoundException:

The specified report (ReportName) in the request doesn't exist.

Examples

Example 1: To create a report named ExampleReport.

The following example creates a AWS Cost and Usage report named ExampleReport.

$result = $client->putReportDefinition([
    'ReportDefinition' => [
        'AdditionalArtifacts' => [
            'REDSHIFT',
            'QUICKSIGHT',
        ],
        'AdditionalSchemaElements' => [
            'RESOURCES',
        ],
        'Compression' => 'ZIP',
        'Format' => 'textORcsv',
        'ReportName' => 'ExampleReport',
        'S3Bucket' => 'example-s3-bucket',
        'S3Prefix' => 'exampleprefix',
        'S3Region' => 'us-east-1',
        'TimeUnit' => 'DAILY',
    ],
]);

TagResource

$result = $client->tagResource([/* ... */]);
$promise = $client->tagResourceAsync([/* ... */]);

Associates a set of tags with a report definition.

Parameter Syntax

$result = $client->tagResource([
    'ReportName' => '<string>', // REQUIRED
    'Tags' => [ // REQUIRED
        [
            'Key' => '<string>', // REQUIRED
            'Value' => '<string>', // REQUIRED
        ],
        // ...
    ],
]);

Parameter Details

Members
ReportName
Required: Yes
Type: string

The report name of the report definition that tags are to be associated with.

Tags
Required: Yes
Type: Array of Tag structures

The tags to be assigned to the report definition resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified report (ReportName) in the request doesn't exist.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

UntagResource

$result = $client->untagResource([/* ... */]);
$promise = $client->untagResourceAsync([/* ... */]);

Disassociates a set of tags from a report definition.

Parameter Syntax

$result = $client->untagResource([
    'ReportName' => '<string>', // REQUIRED
    'TagKeys' => ['<string>', ...], // REQUIRED
]);

Parameter Details

Members
ReportName
Required: Yes
Type: string

The report name of the report definition that tags are to be disassociated from.

TagKeys
Required: Yes
Type: Array of strings

The tags to be disassociated from the report definition resource.

Result Syntax

[]

Result Details

The results for this operation are always empty.

Errors

ResourceNotFoundException:

The specified report (ReportName) in the request doesn't exist.

InternalErrorException:

An error on the server occurred during the processing of your request. Try again later.

ValidationException:

The input fails to satisfy the constraints specified by an Amazon Web Services service.

Shapes

DuplicateReportNameException

Description

A report with the specified name already exists in the account. Specify a different report name.

Members
Message
Type: string

A message to show the detail of the exception.

InternalErrorException

Description

An error on the server occurred during the processing of your request. Try again later.

Members
Message
Type: string

A message to show the detail of the exception.

ReportDefinition

Description

The definition of Amazon Web Services Cost and Usage Report. You can specify the report name, time unit, report format, compression format, S3 bucket, additional artifacts, and schema elements in the definition.

Members
AdditionalArtifacts
Type: Array of strings

A list of manifests that you want Amazon Web Services to create for this report.

AdditionalSchemaElements
Required: Yes
Type: Array of strings

A list of strings that indicate additional content that Amazon Web Services includes in the report, such as individual resource IDs.

BillingViewArn
Type: string

The Amazon resource name of the billing view. The BillingViewArn is needed to create Amazon Web Services Cost and Usage Report for each billing group maintained in the Amazon Web Services Billing Conductor service. The BillingViewArn for a billing group can be constructed as: arn:aws:billing::payer-account-id:billingview/billing-group-primary-account-id

Compression
Required: Yes
Type: string

The compression format that Amazon Web Services uses for the report.

Format
Required: Yes
Type: string

The format that Amazon Web Services saves the report in.

RefreshClosedReports
Type: boolean

Whether you want Amazon Web Services to update your reports after they have been finalized if Amazon Web Services detects charges related to previous months. These charges can include refunds, credits, or support fees.

ReportName
Required: Yes
Type: string

The name of the report that you want to create. The name must be unique, is case sensitive, and can't include spaces.

ReportStatus
Type: ReportStatus structure

The status of the report.

ReportVersioning
Type: string

Whether you want Amazon Web Services to overwrite the previous version of each report or to deliver the report in addition to the previous versions.

S3Bucket
Required: Yes
Type: string

The S3 bucket where Amazon Web Services delivers the report.

S3Prefix
Required: Yes
Type: string

The prefix that Amazon Web Services adds to the report name when Amazon Web Services delivers the report. Your prefix can't include spaces.

S3Region
Required: Yes
Type: string

The region of the S3 bucket that Amazon Web Services delivers the report into.

TimeUnit
Required: Yes
Type: string

The length of time covered by the report.

ReportLimitReachedException

Description

This account already has five reports defined. To define a new report, you must delete an existing report.

Members
Message
Type: string

A message to show the detail of the exception.

ReportStatus

Description

A two element dictionary with a lastDelivery and lastStatus key whose values describe the date and status of the last delivered report for a particular report definition.

Members
lastDelivery
Type: string

A timestamp that gives the date of a report delivery.

lastStatus
Type: string

An enum that gives the status of a report delivery.

ResourceNotFoundException

Description

The specified report (ReportName) in the request doesn't exist.

Members
Message
Type: string

A message to show the detail of the exception.

Tag

Description

Describes a tag. A tag is a key-value pair. You can add up to 50 tags to a report definition.

Members
Key
Required: Yes
Type: string

The key of the tag. Tag keys are case sensitive. Each report definition can only have up to one tag with the same key. If you try to add an existing tag with the same key, the existing tag value will be updated to the new value.

Value
Required: Yes
Type: string

The value of the tag. Tag values are case-sensitive. This can be an empty string.

ValidationException

Description

The input fails to satisfy the constraints specified by an Amazon Web Services service.

Members
Message
Type: string

A message to show the detail of the exception.