mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-05-31 04:30:44 +00:00
Update Go AWS SDK to the latest version
This commit is contained in:
committed by
Andrey Smirnov
parent
d08be990ef
commit
94a72b23ff
+102
-54
@@ -6,6 +6,8 @@ import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awsutil"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/private/protocol"
|
||||
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
|
||||
)
|
||||
|
||||
const opDeleteReportDefinition = "DeleteReportDefinition"
|
||||
@@ -13,7 +15,7 @@ const opDeleteReportDefinition = "DeleteReportDefinition"
|
||||
// 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
|
||||
// successfuly.
|
||||
// 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.
|
||||
@@ -52,7 +54,7 @@ func (c *CostandUsageReportService) DeleteReportDefinitionRequest(input *DeleteR
|
||||
|
||||
// DeleteReportDefinition API operation for AWS Cost and Usage Report Service.
|
||||
//
|
||||
// Delete a specified report definition
|
||||
// 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
|
||||
@@ -63,12 +65,11 @@ func (c *CostandUsageReportService) DeleteReportDefinitionRequest(input *DeleteR
|
||||
//
|
||||
// Returned Error Codes:
|
||||
// * ErrCodeInternalErrorException "InternalErrorException"
|
||||
// This exception is thrown on a known dependency failure.
|
||||
// An error on the server occurred during the processing of your request. Try
|
||||
// again later.
|
||||
//
|
||||
// * 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.
|
||||
// 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
|
||||
func (c *CostandUsageReportService) DeleteReportDefinition(input *DeleteReportDefinitionInput) (*DeleteReportDefinitionOutput, error) {
|
||||
@@ -97,7 +98,7 @@ const opDescribeReportDefinitions = "DescribeReportDefinitions"
|
||||
// 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
|
||||
// successfuly.
|
||||
// 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.
|
||||
@@ -142,7 +143,7 @@ func (c *CostandUsageReportService) DescribeReportDefinitionsRequest(input *Desc
|
||||
|
||||
// DescribeReportDefinitions API operation for AWS Cost and Usage Report Service.
|
||||
//
|
||||
// Describe a list of report definitions owned by the account
|
||||
// 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
|
||||
@@ -153,7 +154,8 @@ func (c *CostandUsageReportService) DescribeReportDefinitionsRequest(input *Desc
|
||||
//
|
||||
// Returned Error Codes:
|
||||
// * ErrCodeInternalErrorException "InternalErrorException"
|
||||
// This exception is thrown on a known dependency failure.
|
||||
// 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
|
||||
func (c *CostandUsageReportService) DescribeReportDefinitions(input *DescribeReportDefinitionsInput) (*DescribeReportDefinitionsOutput, error) {
|
||||
@@ -188,7 +190,7 @@ func (c *CostandUsageReportService) DescribeReportDefinitionsWithContext(ctx aws
|
||||
// // Example iterating over at most 3 pages of a DescribeReportDefinitions operation.
|
||||
// pageNum := 0
|
||||
// err := client.DescribeReportDefinitionsPages(params,
|
||||
// func(page *DescribeReportDefinitionsOutput, lastPage bool) bool {
|
||||
// func(page *costandusagereportservice.DescribeReportDefinitionsOutput, lastPage bool) bool {
|
||||
// pageNum++
|
||||
// fmt.Println(page)
|
||||
// return pageNum <= 3
|
||||
@@ -232,7 +234,7 @@ const opPutReportDefinition = "PutReportDefinition"
|
||||
// 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
|
||||
// successfuly.
|
||||
// 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.
|
||||
@@ -266,12 +268,13 @@ func (c *CostandUsageReportService) PutReportDefinitionRequest(input *PutReportD
|
||||
|
||||
output = &PutReportDefinitionOutput{}
|
||||
req = c.newRequest(op, input, output)
|
||||
req.Handlers.Unmarshal.Swap(jsonrpc.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler)
|
||||
return
|
||||
}
|
||||
|
||||
// PutReportDefinition API operation for AWS Cost and Usage Report Service.
|
||||
//
|
||||
// Create a new report definition
|
||||
// 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
|
||||
@@ -282,20 +285,19 @@ func (c *CostandUsageReportService) PutReportDefinitionRequest(input *PutReportD
|
||||
//
|
||||
// Returned Error Codes:
|
||||
// * ErrCodeDuplicateReportNameException "DuplicateReportNameException"
|
||||
// This exception is thrown when putting a report preference with a name that
|
||||
// already exists.
|
||||
// A report with the specified name already exists in the account. Specify a
|
||||
// different report name.
|
||||
//
|
||||
// * ErrCodeReportLimitReachedException "ReportLimitReachedException"
|
||||
// This exception is thrown when the number of report preference reaches max
|
||||
// limit. The max number is 5.
|
||||
// This account already has five reports defined. To define a new report, you
|
||||
// must delete an existing report.
|
||||
//
|
||||
// * ErrCodeInternalErrorException "InternalErrorException"
|
||||
// This exception is thrown on a known dependency failure.
|
||||
// An error on the server occurred during the processing of your request. Try
|
||||
// again later.
|
||||
//
|
||||
// * 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.
|
||||
// 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
|
||||
func (c *CostandUsageReportService) PutReportDefinition(input *PutReportDefinitionInput) (*PutReportDefinitionOutput, error) {
|
||||
@@ -319,12 +321,12 @@ func (c *CostandUsageReportService) PutReportDefinitionWithContext(ctx aws.Conte
|
||||
return out, req.Send()
|
||||
}
|
||||
|
||||
// Request of DeleteReportDefinition
|
||||
// Deletes the specified report.
|
||||
type DeleteReportDefinitionInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// Preferred name for a report, it has to be unique. Must starts with a number/letter,
|
||||
// case sensitive. Limited to 256 characters.
|
||||
// The name of the report that you want to create. The name must be unique,
|
||||
// is case sensitive, and can't include spaces.
|
||||
ReportName *string `type:"string"`
|
||||
}
|
||||
|
||||
@@ -344,11 +346,11 @@ func (s *DeleteReportDefinitionInput) SetReportName(v string) *DeleteReportDefin
|
||||
return s
|
||||
}
|
||||
|
||||
// Response of DeleteReportDefinition
|
||||
// If the action is successful, the service sends back an HTTP 200 response.
|
||||
type DeleteReportDefinitionOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// A message indicates if the deletion is successful.
|
||||
// Whether the deletion was successful or not.
|
||||
ResponseMessage *string `type:"string"`
|
||||
}
|
||||
|
||||
@@ -368,11 +370,11 @@ func (s *DeleteReportDefinitionOutput) SetResponseMessage(v string) *DeleteRepor
|
||||
return s
|
||||
}
|
||||
|
||||
// Request of DescribeReportDefinitions
|
||||
// Requests a list of AWS Cost and Usage reports owned by the account.
|
||||
type DescribeReportDefinitionsInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// The max number of results returned by the operation.
|
||||
// The maximum number of results that AWS returns for the operation.
|
||||
MaxResults *int64 `min:"5" type:"integer"`
|
||||
|
||||
// A generic string.
|
||||
@@ -414,14 +416,14 @@ func (s *DescribeReportDefinitionsInput) SetNextToken(v string) *DescribeReportD
|
||||
return s
|
||||
}
|
||||
|
||||
// Response of DescribeReportDefinitions
|
||||
// If the action is successful, the service sends back an HTTP 200 response.
|
||||
type DescribeReportDefinitionsOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// A generic string.
|
||||
NextToken *string `type:"string"`
|
||||
|
||||
// A list of report definitions.
|
||||
// A list of AWS Cost and Usage reports owned by the account.
|
||||
ReportDefinitions []*ReportDefinition `type:"list"`
|
||||
}
|
||||
|
||||
@@ -447,13 +449,12 @@ func (s *DescribeReportDefinitionsOutput) SetReportDefinitions(v []*ReportDefini
|
||||
return s
|
||||
}
|
||||
|
||||
// Request of PutReportDefinition
|
||||
// Creates a Cost and Usage Report.
|
||||
type PutReportDefinitionInput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// 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.
|
||||
// Represents the output of the PutReportDefinition operation. The content consists
|
||||
// of the detailed metadata and data file information.
|
||||
//
|
||||
// ReportDefinition is a required field
|
||||
ReportDefinition *ReportDefinition `type:"structure" required:"true"`
|
||||
@@ -493,7 +494,8 @@ func (s *PutReportDefinitionInput) SetReportDefinition(v *ReportDefinition) *Put
|
||||
return s
|
||||
}
|
||||
|
||||
// Response of PutReportDefinition
|
||||
// If the action is successful, the service sends back an HTTP 200 response
|
||||
// with an empty HTTP body.
|
||||
type PutReportDefinitionOutput struct {
|
||||
_ struct{} `type:"structure"`
|
||||
}
|
||||
@@ -508,52 +510,64 @@ func (s PutReportDefinitionOutput) GoString() string {
|
||||
return s.String()
|
||||
}
|
||||
|
||||
// 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.
|
||||
// The definition of AWS 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.
|
||||
type ReportDefinition struct {
|
||||
_ struct{} `type:"structure"`
|
||||
|
||||
// A list of additional artifacts.
|
||||
// A list of manifests that you want Amazon Web Services to create for this
|
||||
// report.
|
||||
AdditionalArtifacts []*string `type:"list"`
|
||||
|
||||
// A list of schema elements.
|
||||
// A list of strings that indicate additional content that Amazon Web Services
|
||||
// includes in the report, such as individual resource IDs.
|
||||
//
|
||||
// AdditionalSchemaElements is a required field
|
||||
AdditionalSchemaElements []*string `type:"list" required:"true"`
|
||||
|
||||
// Preferred compression format for report.
|
||||
// The compression format that AWS uses for the report.
|
||||
//
|
||||
// Compression is a required field
|
||||
Compression *string `type:"string" required:"true" enum:"CompressionFormat"`
|
||||
|
||||
// Preferred format for report.
|
||||
// The format that AWS saves the report in.
|
||||
//
|
||||
// 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.
|
||||
// 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.
|
||||
RefreshClosedReports *bool `type:"boolean"`
|
||||
|
||||
// The name of the report that you want to create. The name must be unique,
|
||||
// is case sensitive, and can't include spaces.
|
||||
//
|
||||
// ReportName is a required field
|
||||
ReportName *string `type:"string" required:"true"`
|
||||
|
||||
// Name of customer S3 bucket.
|
||||
// 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.
|
||||
ReportVersioning *string `type:"string" enum:"ReportVersioning"`
|
||||
|
||||
// The S3 bucket where AWS delivers the report.
|
||||
//
|
||||
// S3Bucket is a required field
|
||||
S3Bucket *string `type:"string" required:"true"`
|
||||
|
||||
// Preferred report path prefix. Limited to 256 characters.
|
||||
// The prefix that AWS adds to the report name when AWS delivers the report.
|
||||
// Your prefix can't include spaces.
|
||||
//
|
||||
// S3Prefix is a required field
|
||||
S3Prefix *string `type:"string" required:"true"`
|
||||
|
||||
// Region of customer S3 bucket.
|
||||
// The region of the S3 bucket that AWS delivers the report into.
|
||||
//
|
||||
// S3Region is a required field
|
||||
S3Region *string `type:"string" required:"true" enum:"AWSRegion"`
|
||||
|
||||
// The frequency on which report data are measured and displayed.
|
||||
// The length of time covered by the report.
|
||||
//
|
||||
// TimeUnit is a required field
|
||||
TimeUnit *string `type:"string" required:"true" enum:"TimeUnit"`
|
||||
@@ -627,12 +641,24 @@ func (s *ReportDefinition) SetFormat(v string) *ReportDefinition {
|
||||
return s
|
||||
}
|
||||
|
||||
// SetRefreshClosedReports sets the RefreshClosedReports field's value.
|
||||
func (s *ReportDefinition) SetRefreshClosedReports(v bool) *ReportDefinition {
|
||||
s.RefreshClosedReports = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetReportName sets the ReportName field's value.
|
||||
func (s *ReportDefinition) SetReportName(v string) *ReportDefinition {
|
||||
s.ReportName = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetReportVersioning sets the ReportVersioning field's value.
|
||||
func (s *ReportDefinition) SetReportVersioning(v string) *ReportDefinition {
|
||||
s.ReportVersioning = &v
|
||||
return s
|
||||
}
|
||||
|
||||
// SetS3Bucket sets the S3Bucket field's value.
|
||||
func (s *ReportDefinition) SetS3Bucket(v string) *ReportDefinition {
|
||||
s.S3Bucket = &v
|
||||
@@ -657,7 +683,7 @@ func (s *ReportDefinition) SetTimeUnit(v string) *ReportDefinition {
|
||||
return s
|
||||
}
|
||||
|
||||
// Region of customer S3 bucket.
|
||||
// The region of the S3 bucket that AWS delivers the report into.
|
||||
const (
|
||||
// AWSRegionUsEast1 is a AWSRegion enum value
|
||||
AWSRegionUsEast1 = "us-east-1"
|
||||
@@ -682,40 +708,62 @@ const (
|
||||
|
||||
// AWSRegionApNortheast1 is a AWSRegion enum value
|
||||
AWSRegionApNortheast1 = "ap-northeast-1"
|
||||
|
||||
// AWSRegionEuNorth1 is a AWSRegion enum value
|
||||
AWSRegionEuNorth1 = "eu-north-1"
|
||||
|
||||
// AWSRegionApNortheast3 is a AWSRegion enum value
|
||||
AWSRegionApNortheast3 = "ap-northeast-3"
|
||||
)
|
||||
|
||||
// Enable support for Redshift and/or QuickSight.
|
||||
// The types of manifest that you want AWS to create for this report.
|
||||
const (
|
||||
// AdditionalArtifactRedshift is a AdditionalArtifact enum value
|
||||
AdditionalArtifactRedshift = "REDSHIFT"
|
||||
|
||||
// AdditionalArtifactQuicksight is a AdditionalArtifact enum value
|
||||
AdditionalArtifactQuicksight = "QUICKSIGHT"
|
||||
|
||||
// AdditionalArtifactAthena is a AdditionalArtifact enum value
|
||||
AdditionalArtifactAthena = "ATHENA"
|
||||
)
|
||||
|
||||
// Preferred compression format for report.
|
||||
// The compression format that AWS uses for the report.
|
||||
const (
|
||||
// CompressionFormatZip is a CompressionFormat enum value
|
||||
CompressionFormatZip = "ZIP"
|
||||
|
||||
// CompressionFormatGzip is a CompressionFormat enum value
|
||||
CompressionFormatGzip = "GZIP"
|
||||
|
||||
// CompressionFormatParquet is a CompressionFormat enum value
|
||||
CompressionFormatParquet = "Parquet"
|
||||
)
|
||||
|
||||
// Preferred format for report.
|
||||
// The format that AWS saves the report in.
|
||||
const (
|
||||
// ReportFormatTextOrcsv is a ReportFormat enum value
|
||||
ReportFormatTextOrcsv = "textORcsv"
|
||||
|
||||
// ReportFormatParquet is a ReportFormat enum value
|
||||
ReportFormatParquet = "Parquet"
|
||||
)
|
||||
|
||||
// Preference of including Resource IDs. You can include additional details
|
||||
// about individual resource IDs in your report.
|
||||
const (
|
||||
// ReportVersioningCreateNewReport is a ReportVersioning enum value
|
||||
ReportVersioningCreateNewReport = "CREATE_NEW_REPORT"
|
||||
|
||||
// ReportVersioningOverwriteReport is a ReportVersioning enum value
|
||||
ReportVersioningOverwriteReport = "OVERWRITE_REPORT"
|
||||
)
|
||||
|
||||
// Whether or not AWS includes resource IDs in the report.
|
||||
const (
|
||||
// SchemaElementResources is a SchemaElement enum value
|
||||
SchemaElementResources = "RESOURCES"
|
||||
)
|
||||
|
||||
// The frequency on which report data are measured and displayed.
|
||||
// The length of time covered by the report.
|
||||
const (
|
||||
// TimeUnitHourly is a TimeUnit enum value
|
||||
TimeUnitHourly = "HOURLY"
|
||||
|
||||
+14
-1
@@ -3,7 +3,20 @@
|
||||
// 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
|
||||
// The AWS Cost and Usage Report API enables you to programmatically create,
|
||||
// query, and delete AWS Cost and Usage report definitions.
|
||||
//
|
||||
// AWS Cost and Usage reports track the monthly AWS costs and usage associated
|
||||
// with your AWS account. The report contains line items for each unique combination
|
||||
// of AWS product, usage type, and operation that your AWS account uses. You
|
||||
// can configure the AWS Cost and Usage report to show only the data that you
|
||||
// want, using the AWS Cost and Usage API.
|
||||
//
|
||||
// Service Endpoint
|
||||
//
|
||||
// The AWS Cost and Usage Report API provides the following endpoint:
|
||||
//
|
||||
// * cur.us-east-1.amazonaws.com
|
||||
//
|
||||
// See https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06 for more information on this service.
|
||||
//
|
||||
|
||||
+7
-8
@@ -7,28 +7,27 @@ const (
|
||||
// ErrCodeDuplicateReportNameException for service response error code
|
||||
// "DuplicateReportNameException".
|
||||
//
|
||||
// This exception is thrown when putting a report preference with a name that
|
||||
// already exists.
|
||||
// A report with the specified name already exists in the account. Specify a
|
||||
// different report name.
|
||||
ErrCodeDuplicateReportNameException = "DuplicateReportNameException"
|
||||
|
||||
// ErrCodeInternalErrorException for service response error code
|
||||
// "InternalErrorException".
|
||||
//
|
||||
// This exception is thrown on a known dependency failure.
|
||||
// An error on the server occurred during the processing of your request. Try
|
||||
// again later.
|
||||
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.
|
||||
// This account already has five reports defined. To define a new report, you
|
||||
// must delete an existing report.
|
||||
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.
|
||||
// The input fails to satisfy the constraints specified by an AWS service.
|
||||
ErrCodeValidationException = "ValidationException"
|
||||
)
|
||||
|
||||
Generated
Vendored
+136
@@ -0,0 +1,136 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
package costandusagereportservice_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/aws/aws-sdk-go/service/costandusagereportservice"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ strings.Reader
|
||||
var _ aws.Config
|
||||
|
||||
func parseTime(layout, value string) *time.Time {
|
||||
t, err := time.Parse(layout, value)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return &t
|
||||
}
|
||||
|
||||
// To delete the AWS Cost and Usage report named ExampleReport.
|
||||
//
|
||||
// The following example deletes the AWS Cost and Usage report named ExampleReport.
|
||||
func ExampleCostandUsageReportService_DeleteReportDefinition_shared00() {
|
||||
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 {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To list the AWS Cost and Usage reports for the account.
|
||||
//
|
||||
// The following example lists the AWS Cost and Usage reports for the account.
|
||||
func ExampleCostandUsageReportService_DescribeReportDefinitions_shared00() {
|
||||
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 {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
|
||||
// To create a report named ExampleReport.
|
||||
//
|
||||
// The following example creates a AWS Cost and Usage report named ExampleReport.
|
||||
func ExampleCostandUsageReportService_PutReportDefinition_shared00() {
|
||||
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 {
|
||||
// Print the error, cast err to awserr.Error to get the Code and
|
||||
// Message from an error.
|
||||
fmt.Println(err.Error())
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(result)
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
||||
|
||||
// +build go1.10,integration
|
||||
|
||||
package costandusagereportservice_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/awstesting/integration"
|
||||
"github.com/aws/aws-sdk-go/service/costandusagereportservice"
|
||||
)
|
||||
|
||||
var _ aws.Config
|
||||
var _ awserr.Error
|
||||
var _ request.Request
|
||||
|
||||
func TestInteg_00_DescribeReportDefinitions(t *testing.T) {
|
||||
ctx, cancelFn := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancelFn()
|
||||
|
||||
sess := integration.SessionWithDefaultRegion("us-east-1")
|
||||
svc := costandusagereportservice.New(sess)
|
||||
params := &costandusagereportservice.DescribeReportDefinitionsInput{}
|
||||
_, err := svc.DescribeReportDefinitionsWithContext(ctx, params)
|
||||
if err != nil {
|
||||
t.Errorf("expect no error, got %v", err)
|
||||
}
|
||||
}
|
||||
+4
-2
@@ -29,8 +29,9 @@ var initRequest func(*request.Request)
|
||||
|
||||
// Service information constants
|
||||
const (
|
||||
ServiceName = "cur" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
ServiceName = "cur" // Name of service.
|
||||
EndpointsID = ServiceName // ID to lookup a service endpoint with.
|
||||
ServiceID = "Cost and Usage Report Service" // ServiceID is a unique identifer of a specific service.
|
||||
)
|
||||
|
||||
// New creates a new instance of the CostandUsageReportService client with a session.
|
||||
@@ -58,6 +59,7 @@ func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
ServiceID: ServiceID,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
|
||||
Reference in New Issue
Block a user