AWS SDK for Go (PILOT)
API Reference

PREVIEW DOCUMENTATION - This is a preview of a new format for the AWS SDK for Go API Reference documentation. For the current AWS SDK for Go API Reference, see https://docs.aws.amazon.com/sdk-for-go/api/.

We welcome your feedback on this new version of the documentation. Send your comments to aws-sdkdocs-feedback@amazon.com.

CostandUsageReportService

import "github.com/aws/aws-sdk-go/service/costandusagereportservice"

type CostandUsageReportService struct { *client.Client }

CostandUsageReportService provides the API operation methods for making requests to AWS Cost and Usage Report Service. See this package's package overview docs for details on the service.

CostandUsageReportService methods are safe to use concurrently. It is not safe to modify mutate any of the struct's properties though.

Client

Type: *client.Client

Method

DeleteReportDefinition

func (c *CostandUsageReportService) DeleteReportDefinition(input *DeleteReportDefinitionInput) (*DeleteReportDefinitionOutput, error)

DeleteReportDefinition API operation for AWS Cost and Usage Report Service.

Deletes the specified report.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Cost and Usage Report Service's API operation DeleteReportDefinition for usage and error information.

Returned Error Codes:

  • ErrCodeInternalErrorException "InternalErrorException" An error on the server occurred during the processing of your request. Try again later.

  • ErrCodeValidationException "ValidationException" The input fails to satisfy the constraints specified by an AWS service.

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition

Example

CostandUsageReportService DeleteReportDefinition shared00

To delete the AWS Cost and Usage report named ExampleReport.

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

{ svc := costandusagereportservice.New(session.New()) input := &costandusagereportservice.DeleteReportDefinitionInput{ ReportName: aws.String("ExampleReport"), } result, err := svc.DeleteReportDefinition(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case costandusagereportservice.ErrCodeInternalErrorException: fmt.Println(costandusagereportservice.ErrCodeInternalErrorException, aerr.Error()) case costandusagereportservice.ErrCodeValidationException: fmt.Println(costandusagereportservice.ErrCodeValidationException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DeleteReportDefinitionRequest

func (c *CostandUsageReportService) DeleteReportDefinitionRequest(input *DeleteReportDefinitionInput) (req *request.Request, output *DeleteReportDefinitionOutput)

DeleteReportDefinitionRequest generates a "aws/request.Request" representing the client's request for the DeleteReportDefinition operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DeleteReportDefinition for more information on using the DeleteReportDefinition API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DeleteReportDefinitionRequest method. req, resp := client.DeleteReportDefinitionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition

DeleteReportDefinitionWithContext

func (c *CostandUsageReportService) DeleteReportDefinitionWithContext(ctx aws.Context, input *DeleteReportDefinitionInput, opts ...request.Option) (*DeleteReportDefinitionOutput, error)

DeleteReportDefinitionWithContext is the same as DeleteReportDefinition with the addition of the ability to pass a context and additional request options.

See DeleteReportDefinition for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeReportDefinitions

func (c *CostandUsageReportService) DescribeReportDefinitions(input *DescribeReportDefinitionsInput) (*DescribeReportDefinitionsOutput, error)

DescribeReportDefinitions API operation for AWS Cost and Usage Report Service.

Lists the AWS Cost and Usage reports available to this account.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Cost and Usage Report Service's API operation DescribeReportDefinitions for usage and error information.

Returned Error Codes:

  • ErrCodeInternalErrorException "InternalErrorException" An error on the server occurred during the processing of your request. Try again later.

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DescribeReportDefinitions

Example

CostandUsageReportService DescribeReportDefinitions shared00

To list the AWS Cost and Usage reports for the account.

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

{ svc := costandusagereportservice.New(session.New()) input := &costandusagereportservice.DescribeReportDefinitionsInput{ MaxResults: aws.Int64(5), } result, err := svc.DescribeReportDefinitions(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case costandusagereportservice.ErrCodeInternalErrorException: fmt.Println(costandusagereportservice.ErrCodeInternalErrorException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

DescribeReportDefinitionsPages

func (c *CostandUsageReportService) DescribeReportDefinitionsPages(input *DescribeReportDefinitionsInput, fn func(*DescribeReportDefinitionsOutput, bool) bool) error

DescribeReportDefinitionsPages iterates over the pages of a DescribeReportDefinitions operation, calling the "fn" function with the response data for each page. To stop iterating, return false from the fn function.

See DescribeReportDefinitions method for more information on how to use this operation.

Note: This operation can generate multiple requests to a service.

// Example iterating over at most 3 pages of a DescribeReportDefinitions operation. pageNum := 0 err := client.DescribeReportDefinitionsPages(params, func(page *DescribeReportDefinitionsOutput, lastPage bool) bool { pageNum++ fmt.Println(page) return pageNum <= 3 })

See Also

For more information about using this API, see AWS API Documentation.

DescribeReportDefinitionsPagesWithContext

func (c *CostandUsageReportService) DescribeReportDefinitionsPagesWithContext(ctx aws.Context, input *DescribeReportDefinitionsInput, fn func(*DescribeReportDefinitionsOutput, bool) bool, opts ...request.Option) error

DescribeReportDefinitionsPagesWithContext same as DescribeReportDefinitionsPages except it takes a Context and allows setting request options on the pages.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

DescribeReportDefinitionsRequest

func (c *CostandUsageReportService) DescribeReportDefinitionsRequest(input *DescribeReportDefinitionsInput) (req *request.Request, output *DescribeReportDefinitionsOutput)

DescribeReportDefinitionsRequest generates a "aws/request.Request" representing the client's request for the DescribeReportDefinitions operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See DescribeReportDefinitions for more information on using the DescribeReportDefinitions API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the DescribeReportDefinitionsRequest method. req, resp := client.DescribeReportDefinitionsRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DescribeReportDefinitions

DescribeReportDefinitionsWithContext

func (c *CostandUsageReportService) DescribeReportDefinitionsWithContext(ctx aws.Context, input *DescribeReportDefinitionsInput, opts ...request.Option) (*DescribeReportDefinitionsOutput, error)

DescribeReportDefinitionsWithContext is the same as DescribeReportDefinitions with the addition of the ability to pass a context and additional request options.

See DescribeReportDefinitions for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

PutReportDefinition

func (c *CostandUsageReportService) PutReportDefinition(input *PutReportDefinitionInput) (*PutReportDefinitionOutput, error)

PutReportDefinition API operation for AWS Cost and Usage Report Service.

Creates a new report using the description that you provide.

Returns awserr.Error for service API and SDK errors. Use runtime type assertions with awserr.Error's Code and Message methods to get detailed information about the error.

See the AWS API reference guide for AWS Cost and Usage Report Service's API operation PutReportDefinition for usage and error information.

Returned Error Codes:

  • ErrCodeDuplicateReportNameException "DuplicateReportNameException" A report with the specified name already exists in the account. Specify a different report name.

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

  • ErrCodeInternalErrorException "InternalErrorException" An error on the server occurred during the processing of your request. Try again later.

  • ErrCodeValidationException "ValidationException" The input fails to satisfy the constraints specified by an AWS service.

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/PutReportDefinition

Example

CostandUsageReportService PutReportDefinition shared00

To create a report named ExampleReport.

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

{ svc := costandusagereportservice.New(session.New()) input := &costandusagereportservice.PutReportDefinitionInput{ ReportDefinition: &costandusagereportservice.ReportDefinition{ AdditionalArtifacts: []*string{ aws.String("REDSHIFT"), aws.String("QUICKSIGHT"), }, AdditionalSchemaElements: []*string{ aws.String("RESOURCES"), }, Compression: aws.String("ZIP"), Format: aws.String("textORcsv"), ReportName: aws.String("ExampleReport"), S3Bucket: aws.String("example-s3-bucket"), S3Prefix: aws.String("exampleprefix"), S3Region: aws.String("us-east-1"), TimeUnit: aws.String("DAILY"), }, } result, err := svc.PutReportDefinition(input) if err != nil { if aerr, ok := err.(awserr.Error); ok { switch aerr.Code() { case costandusagereportservice.ErrCodeDuplicateReportNameException: fmt.Println(costandusagereportservice.ErrCodeDuplicateReportNameException, aerr.Error()) case costandusagereportservice.ErrCodeReportLimitReachedException: fmt.Println(costandusagereportservice.ErrCodeReportLimitReachedException, aerr.Error()) case costandusagereportservice.ErrCodeInternalErrorException: fmt.Println(costandusagereportservice.ErrCodeInternalErrorException, aerr.Error()) case costandusagereportservice.ErrCodeValidationException: fmt.Println(costandusagereportservice.ErrCodeValidationException, aerr.Error()) default: fmt.Println(aerr.Error()) } } else { fmt.Println(err.Error()) } return } fmt.Println(result) }

PutReportDefinitionRequest

func (c *CostandUsageReportService) PutReportDefinitionRequest(input *PutReportDefinitionInput) (req *request.Request, output *PutReportDefinitionOutput)

PutReportDefinitionRequest generates a "aws/request.Request" representing the client's request for the PutReportDefinition operation. The "output" return value will be populated with the request's response once the request completes successfully.

Use "Send" method on the returned Request to send the API call to the service. the "output" return value is not valid until after Send returns without error.

See PutReportDefinition for more information on using the PutReportDefinition API call, and error handling.

This method is useful when you want to inject custom logic or configuration into the SDK's request lifecycle. Such as custom headers, or retry logic.

// Example sending a request using the PutReportDefinitionRequest method. req, resp := client.PutReportDefinitionRequest(params) err := req.Send() if err == nil { // resp is now filled fmt.Println(resp) }

See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/PutReportDefinition

PutReportDefinitionWithContext

func (c *CostandUsageReportService) PutReportDefinitionWithContext(ctx aws.Context, input *PutReportDefinitionInput, opts ...request.Option) (*PutReportDefinitionOutput, error)

PutReportDefinitionWithContext is the same as PutReportDefinition with the addition of the ability to pass a context and additional request options.

See PutReportDefinition for details on how to use this API operation.

The context must be non-nil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create sub-contexts for http.Requests. See https://golang.org/pkg/context/ for more information on using Contexts.

See Also

For more information about using this API, see AWS API Documentation.

On this page: