costandusagereportservice

package
v1.10.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package costandusagereportservice provides the client and types for making API requests to AWS Cost and Usage Report Service.

All public APIs for AWS Cost and Usage Report service

See https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06 for more information on this service.

See costandusagereportservice package documentation for more information. https://docs.aws.amazon.com/sdk-for-go/api/service/costandusagereportservice/

Using the Client

To use the client for AWS Cost and Usage Report Service you will first need to create a new instance of it.

When creating a client for an AWS service you'll first need to have a Session already created. The Session provides configuration that can be shared between multiple service clients. Additional configuration can be applied to the Session and service's client when they are constructed. The aws package's Config type contains several fields such as Region for the AWS Region the client should make API requests too. The optional Config value can be provided as the variadic argument for Sessions and client creation.

Once the service's client is created you can use it to make API requests the AWS service. These clients are safe to use concurrently.

// Create a session to share configuration, and load external configuration.
sess := session.Must(session.NewSession())

// Create the service's client with the session.
svc := costandusagereportservice.New(sess)

See the SDK's documentation for more information on how to use service clients. https://docs.aws.amazon.com/sdk-for-go/api/

See aws package's Config type for more information on configuration options. https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config

See the AWS Cost and Usage Report Service client CostandUsageReportService for more information on creating the service's client. https://docs.aws.amazon.com/sdk-for-go/api/service/costandusagereportservice/#New

Once the client is created you can make an API request to the service. Each API method takes a input parameter, and returns the service response and an error.

The API method will document which error codes the service can be returned by the operation if the service models the API operation's errors. These errors will also be available as const strings prefixed with "ErrCode".

result, err := svc.DeleteReportDefinition(params)
if err != nil {
    // Cast err to awserr.Error to handle specific error codes.
    aerr, ok := err.(awserr.Error)
    if ok && aerr.Code() == <error code to check for> {
        // Specific error code handling
    }
    return err
}

fmt.Println("DeleteReportDefinition result:")
fmt.Println(result)

Using the Client with Context

The service's client also provides methods to make API requests with a Context value. This allows you to control the timeout, and cancellation of pending requests. These methods also take request Option as variadic parameter to apply additional configuration to the API request.

ctx := context.Background()

result, err := svc.DeleteReportDefinitionWithContext(ctx, params)

See the request package documentation for more information on using Context pattern with the SDK. https://docs.aws.amazon.com/sdk-for-go/api/aws/request/

Index

Constants

View Source
const (
	// AWSRegionUsEast1 is a AWSRegion enum value
	AWSRegionUsEast1 = "us-east-1"

	// AWSRegionUsWest1 is a AWSRegion enum value
	AWSRegionUsWest1 = "us-west-1"

	// AWSRegionUsWest2 is a AWSRegion enum value
	AWSRegionUsWest2 = "us-west-2"

	// AWSRegionEuCentral1 is a AWSRegion enum value
	AWSRegionEuCentral1 = "eu-central-1"

	// AWSRegionEuWest1 is a AWSRegion enum value
	AWSRegionEuWest1 = "eu-west-1"

	// AWSRegionApSoutheast1 is a AWSRegion enum value
	AWSRegionApSoutheast1 = "ap-southeast-1"

	// AWSRegionApSoutheast2 is a AWSRegion enum value
	AWSRegionApSoutheast2 = "ap-southeast-2"

	// AWSRegionApNortheast1 is a AWSRegion enum value
	AWSRegionApNortheast1 = "ap-northeast-1"
)

Region of customer S3 bucket.

View Source
const (
	// AdditionalArtifactRedshift is a AdditionalArtifact enum value
	AdditionalArtifactRedshift = "REDSHIFT"

	// AdditionalArtifactQuicksight is a AdditionalArtifact enum value
	AdditionalArtifactQuicksight = "QUICKSIGHT"
)

Enable support for Redshift and/or QuickSight.

View Source
const (
	// CompressionFormatZip is a CompressionFormat enum value
	CompressionFormatZip = "ZIP"

	// CompressionFormatGzip is a CompressionFormat enum value
	CompressionFormatGzip = "GZIP"
)

Preferred compression format for report.

View Source
const (
	// TimeUnitHourly is a TimeUnit enum value
	TimeUnitHourly = "HOURLY"

	// TimeUnitDaily is a TimeUnit enum value
	TimeUnitDaily = "DAILY"
)

The frequency on which report data are measured and displayed.

View Source
const (

	// ErrCodeDuplicateReportNameException for service response error code
	// "DuplicateReportNameException".
	//
	// This exception is thrown when putting a report preference with a name that
	// already exists.
	ErrCodeDuplicateReportNameException = "DuplicateReportNameException"

	// ErrCodeInternalErrorException for service response error code
	// "InternalErrorException".
	//
	// This exception is thrown on a known dependency failure.
	ErrCodeInternalErrorException = "InternalErrorException"

	// ErrCodeReportLimitReachedException for service response error code
	// "ReportLimitReachedException".
	//
	// This exception is thrown when the number of report preference reaches max
	// limit. The max number is 5.
	ErrCodeReportLimitReachedException = "ReportLimitReachedException"

	// ErrCodeValidationException for service response error code
	// "ValidationException".
	//
	// This exception is thrown when providing an invalid input. eg. Put a report
	// preference with an invalid report name, or Delete a report preference with
	// an empty report name.
	ErrCodeValidationException = "ValidationException"
)
View Source
const (
	ServiceName = "cur"       // Service endpoint prefix API calls made to.
	EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)

Service information constants

View Source
const (
	// ReportFormatTextOrcsv is a ReportFormat enum value
	ReportFormatTextOrcsv = "textORcsv"
)

Preferred format for report.

View Source
const (
	// SchemaElementResources is a SchemaElement enum value
	SchemaElementResources = "RESOURCES"
)

Preference of including Resource IDs. You can include additional details about individual resource IDs in your report.

Variables

This section is empty.

Functions

This section is empty.

Types

type 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.

func New

New creates a new instance of the CostandUsageReportService client with a session. If additional configuration is needed for the client instance use the optional aws.Config parameter to add your extra config.

Example:

// Create a CostandUsageReportService client from just a session.
svc := costandusagereportservice.New(mySession)

// Create a CostandUsageReportService client with additional configuration
svc := costandusagereportservice.New(mySession, aws.NewConfig().WithRegion("us-west-2"))

func (*CostandUsageReportService) DeleteReportDefinition

DeleteReportDefinition API operation for AWS Cost and Usage Report Service.

Delete a specified report definition

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" This exception is thrown on a known dependency failure.

  • ErrCodeValidationException "ValidationException" This exception is thrown when providing an invalid input. eg. Put a report preference with an invalid report name, or Delete a report preference with an empty report name.

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

func (*CostandUsageReportService) 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 can be used to capture response data after the request's "Send" method is called.

See DeleteReportDefinition for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DeleteReportDefinition method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// 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)
}

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

func (*CostandUsageReportService) DeleteReportDefinitionWithContext added in v1.8.0

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.

func (*CostandUsageReportService) DescribeReportDefinitions

DescribeReportDefinitions API operation for AWS Cost and Usage Report Service.

Describe a list of report definitions owned by the 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" This exception is thrown on a known dependency failure.

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

func (*CostandUsageReportService) 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
    })

func (*CostandUsageReportService) DescribeReportDefinitionsPagesWithContext added in v1.8.0

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.

func (*CostandUsageReportService) 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 can be used to capture response data after the request's "Send" method is called.

See DescribeReportDefinitions for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the DescribeReportDefinitions method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// 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)
}

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

func (*CostandUsageReportService) DescribeReportDefinitionsWithContext added in v1.8.0

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.

func (*CostandUsageReportService) PutReportDefinition

PutReportDefinition API operation for AWS Cost and Usage Report Service.

Create a new report definition

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" This exception is thrown when putting a report preference with a name that already exists.

  • ErrCodeReportLimitReachedException "ReportLimitReachedException" This exception is thrown when the number of report preference reaches max limit. The max number is 5.

  • ErrCodeInternalErrorException "InternalErrorException" This exception is thrown on a known dependency failure.

  • ErrCodeValidationException "ValidationException" This exception is thrown when providing an invalid input. eg. Put a report preference with an invalid report name, or Delete a report preference with an empty report name.

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

func (*CostandUsageReportService) 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 can be used to capture response data after the request's "Send" method is called.

See PutReportDefinition for usage and error information.

Creating a request object using this method should be used when you want to inject custom logic into the request's lifecycle using a custom handler, or if you want to access properties on the request object before or after sending the request. If you just want the service response, call the PutReportDefinition method directly instead.

Note: You must call the "Send" method on the returned request object in order to execute the request.

// 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)
}

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

func (*CostandUsageReportService) PutReportDefinitionWithContext added in v1.8.0

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.

type DeleteReportDefinitionInput

type DeleteReportDefinitionInput struct {

	// Preferred name for a report, it has to be unique. Must starts with a number/letter,
	// case sensitive. Limited to 256 characters.
	ReportName *string `type:"string"`
	// contains filtered or unexported fields
}

Request of DeleteReportDefinition Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinitionRequest

func (DeleteReportDefinitionInput) GoString

func (s DeleteReportDefinitionInput) GoString() string

GoString returns the string representation

func (*DeleteReportDefinitionInput) SetReportName

SetReportName sets the ReportName field's value.

func (DeleteReportDefinitionInput) String

String returns the string representation

type DeleteReportDefinitionOutput

type DeleteReportDefinitionOutput struct {

	// A message indicates if the deletion is successful.
	ResponseMessage *string `type:"string"`
	// contains filtered or unexported fields
}

Response of DeleteReportDefinition Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinitionResponse

func (DeleteReportDefinitionOutput) GoString

func (s DeleteReportDefinitionOutput) GoString() string

GoString returns the string representation

func (*DeleteReportDefinitionOutput) SetResponseMessage

SetResponseMessage sets the ResponseMessage field's value.

func (DeleteReportDefinitionOutput) String

String returns the string representation

type DescribeReportDefinitionsInput

type DescribeReportDefinitionsInput struct {

	// The max number of results returned by the operation.
	MaxResults *int64 `min:"5" type:"integer"`

	// A generic string.
	NextToken *string `type:"string"`
	// contains filtered or unexported fields
}

Request of DescribeReportDefinitions Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DescribeReportDefinitionsRequest

func (DescribeReportDefinitionsInput) GoString

GoString returns the string representation

func (*DescribeReportDefinitionsInput) SetMaxResults

SetMaxResults sets the MaxResults field's value.

func (*DescribeReportDefinitionsInput) SetNextToken

SetNextToken sets the NextToken field's value.

func (DescribeReportDefinitionsInput) String

String returns the string representation

func (*DescribeReportDefinitionsInput) Validate

func (s *DescribeReportDefinitionsInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type DescribeReportDefinitionsOutput

type DescribeReportDefinitionsOutput struct {

	// A generic string.
	NextToken *string `type:"string"`

	// A list of report definitions.
	ReportDefinitions []*ReportDefinition `type:"list"`
	// contains filtered or unexported fields
}

Response of DescribeReportDefinitions Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DescribeReportDefinitionsResponse

func (DescribeReportDefinitionsOutput) GoString

GoString returns the string representation

func (*DescribeReportDefinitionsOutput) SetNextToken

SetNextToken sets the NextToken field's value.

func (*DescribeReportDefinitionsOutput) SetReportDefinitions

SetReportDefinitions sets the ReportDefinitions field's value.

func (DescribeReportDefinitionsOutput) String

String returns the string representation

type PutReportDefinitionInput

type PutReportDefinitionInput struct {

	// 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.
	//
	// ReportDefinition is a required field
	ReportDefinition *ReportDefinition `type:"structure" required:"true"`
	// contains filtered or unexported fields
}

Request of PutReportDefinition Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/PutReportDefinitionRequest

func (PutReportDefinitionInput) GoString

func (s PutReportDefinitionInput) GoString() string

GoString returns the string representation

func (*PutReportDefinitionInput) SetReportDefinition

SetReportDefinition sets the ReportDefinition field's value.

func (PutReportDefinitionInput) String

func (s PutReportDefinitionInput) String() string

String returns the string representation

func (*PutReportDefinitionInput) Validate

func (s *PutReportDefinitionInput) Validate() error

Validate inspects the fields of the type to determine if they are valid.

type PutReportDefinitionOutput

type PutReportDefinitionOutput struct {
	// contains filtered or unexported fields
}

Response of PutReportDefinition Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/PutReportDefinitionResponse

func (PutReportDefinitionOutput) GoString

func (s PutReportDefinitionOutput) GoString() string

GoString returns the string representation

func (PutReportDefinitionOutput) String

func (s PutReportDefinitionOutput) String() string

String returns the string representation

type ReportDefinition

type ReportDefinition struct {

	// A list of additional artifacts.
	AdditionalArtifacts []*string `type:"list"`

	// A list of schema elements.
	//
	// AdditionalSchemaElements is a required field
	AdditionalSchemaElements []*string `type:"list" required:"true"`

	// Preferred compression format for report.
	//
	// Compression is a required field
	Compression *string `type:"string" required:"true" enum:"CompressionFormat"`

	// Preferred format for report.
	//
	// Format is a required field
	Format *string `type:"string" required:"true" enum:"ReportFormat"`

	// Preferred name for a report, it has to be unique. Must starts with a number/letter,
	// case sensitive. Limited to 256 characters.
	//
	// ReportName is a required field
	ReportName *string `type:"string" required:"true"`

	// Name of customer S3 bucket.
	//
	// S3Bucket is a required field
	S3Bucket *string `type:"string" required:"true"`

	// Preferred report path prefix. Limited to 256 characters.
	//
	// S3Prefix is a required field
	S3Prefix *string `type:"string" required:"true"`

	// Region of customer S3 bucket.
	//
	// S3Region is a required field
	S3Region *string `type:"string" required:"true" enum:"AWSRegion"`

	// The frequency on which report data are measured and displayed.
	//
	// TimeUnit is a required field
	TimeUnit *string `type:"string" required:"true" enum:"TimeUnit"`
	// contains filtered or unexported fields
}

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. Please also see https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/ReportDefinition

func (ReportDefinition) GoString

func (s ReportDefinition) GoString() string

GoString returns the string representation

func (*ReportDefinition) SetAdditionalArtifacts

func (s *ReportDefinition) SetAdditionalArtifacts(v []*string) *ReportDefinition

SetAdditionalArtifacts sets the AdditionalArtifacts field's value.

func (*ReportDefinition) SetAdditionalSchemaElements

func (s *ReportDefinition) SetAdditionalSchemaElements(v []*string) *ReportDefinition

SetAdditionalSchemaElements sets the AdditionalSchemaElements field's value.

func (*ReportDefinition) SetCompression

func (s *ReportDefinition) SetCompression(v string) *ReportDefinition

SetCompression sets the Compression field's value.

func (*ReportDefinition) SetFormat

func (s *ReportDefinition) SetFormat(v string) *ReportDefinition

SetFormat sets the Format field's value.

func (*ReportDefinition) SetReportName

func (s *ReportDefinition) SetReportName(v string) *ReportDefinition

SetReportName sets the ReportName field's value.

func (*ReportDefinition) SetS3Bucket

func (s *ReportDefinition) SetS3Bucket(v string) *ReportDefinition

SetS3Bucket sets the S3Bucket field's value.

func (*ReportDefinition) SetS3Prefix

func (s *ReportDefinition) SetS3Prefix(v string) *ReportDefinition

SetS3Prefix sets the S3Prefix field's value.

func (*ReportDefinition) SetS3Region

func (s *ReportDefinition) SetS3Region(v string) *ReportDefinition

SetS3Region sets the S3Region field's value.

func (*ReportDefinition) SetTimeUnit

func (s *ReportDefinition) SetTimeUnit(v string) *ReportDefinition

SetTimeUnit sets the TimeUnit field's value.

func (ReportDefinition) String

func (s ReportDefinition) String() string

String returns the string representation

func (*ReportDefinition) Validate

func (s *ReportDefinition) Validate() error

Validate inspects the fields of the type to determine if they are valid.

Directories

Path Synopsis
Package costandusagereportserviceiface provides an interface to enable mocking the AWS Cost and Usage Report Service service client for testing your code.
Package costandusagereportserviceiface provides an interface to enable mocking the AWS Cost and Usage Report Service service client for testing your code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL