From 91a559f79e444c71ce70c0589a512d197e3bd994 Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Sat, 2 Feb 2019 10:48:18 -0800 Subject: [PATCH 01/16] add costandusagereport client --- aws/config.go | 3 + .../service/costandusagereportservice/api.go | 728 ++++++++++++++++++ .../interface.go | 79 ++ .../service/costandusagereportservice/doc.go | 28 + .../costandusagereportservice/errors.go | 34 + .../costandusagereportservice/service.go | 100 +++ vendor/modules.txt | 1 + 7 files changed, 973 insertions(+) create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/api.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/costandusagereportserviceiface/interface.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/errors.go create mode 100644 vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/service.go diff --git a/aws/config.go b/aws/config.go index 916d32c28c70..22440f582479 100644 --- a/aws/config.go +++ b/aws/config.go @@ -43,6 +43,7 @@ import ( "github.com/aws/aws-sdk-go/service/cognitoidentity" "github.com/aws/aws-sdk-go/service/cognitoidentityprovider" "github.com/aws/aws-sdk-go/service/configservice" + "github.com/aws/aws-sdk-go/service/costandusagereportservice" "github.com/aws/aws-sdk-go/service/databasemigrationservice" "github.com/aws/aws-sdk-go/service/datapipeline" "github.com/aws/aws-sdk-go/service/datasync" @@ -215,6 +216,7 @@ type AWSClient struct { cognitoconn *cognitoidentity.CognitoIdentity cognitoidpconn *cognitoidentityprovider.CognitoIdentityProvider configconn *configservice.ConfigService + costandusagereportconn *costandusagereportservice.CostandUsageReportService datapipelineconn *datapipeline.DataPipeline datasyncconn *datasync.DataSync daxconn *dax.DAX @@ -576,6 +578,7 @@ func (c *Config) Client() (interface{}, error) { client.cognitoconn = cognitoidentity.New(sess) client.cognitoidpconn = cognitoidentityprovider.New(sess) client.configconn = configservice.New(sess) + client.costandusagereportconn = costandusagereportservice.New(sess) client.datapipelineconn = datapipeline.New(sess) client.datasyncconn = datasync.New(sess) client.daxconn = dax.New(awsDynamoSess) diff --git a/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/api.go b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/api.go new file mode 100644 index 000000000000..a8e52b67712e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/api.go @@ -0,0 +1,728 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package costandusagereportservice + +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" + +// 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 +func (c *CostandUsageReportService) DeleteReportDefinitionRequest(input *DeleteReportDefinitionInput) (req *request.Request, output *DeleteReportDefinitionOutput) { + op := &request.Operation{ + Name: opDeleteReportDefinition, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteReportDefinitionInput{} + } + + output = &DeleteReportDefinitionOutput{} + req = c.newRequest(op, input, output) + return +} + +// 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. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DeleteReportDefinition +func (c *CostandUsageReportService) DeleteReportDefinition(input *DeleteReportDefinitionInput) (*DeleteReportDefinitionOutput, error) { + req, out := c.DeleteReportDefinitionRequest(input) + return out, req.Send() +} + +// 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 (c *CostandUsageReportService) DeleteReportDefinitionWithContext(ctx aws.Context, input *DeleteReportDefinitionInput, opts ...request.Option) (*DeleteReportDefinitionOutput, error) { + req, out := c.DeleteReportDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +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 +// 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 +func (c *CostandUsageReportService) DescribeReportDefinitionsRequest(input *DescribeReportDefinitionsInput) (req *request.Request, output *DescribeReportDefinitionsOutput) { + op := &request.Operation{ + Name: opDescribeReportDefinitions, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &DescribeReportDefinitionsInput{} + } + + output = &DescribeReportDefinitionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// 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. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/DescribeReportDefinitions +func (c *CostandUsageReportService) DescribeReportDefinitions(input *DescribeReportDefinitionsInput) (*DescribeReportDefinitionsOutput, error) { + req, out := c.DescribeReportDefinitionsRequest(input) + return out, req.Send() +} + +// 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 (c *CostandUsageReportService) DescribeReportDefinitionsWithContext(ctx aws.Context, input *DescribeReportDefinitionsInput, opts ...request.Option) (*DescribeReportDefinitionsOutput, error) { + req, out := c.DescribeReportDefinitionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// 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 (c *CostandUsageReportService) DescribeReportDefinitionsPages(input *DescribeReportDefinitionsInput, fn func(*DescribeReportDefinitionsOutput, bool) bool) error { + return c.DescribeReportDefinitionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// 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 (c *CostandUsageReportService) DescribeReportDefinitionsPagesWithContext(ctx aws.Context, input *DescribeReportDefinitionsInput, fn func(*DescribeReportDefinitionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *DescribeReportDefinitionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.DescribeReportDefinitionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*DescribeReportDefinitionsOutput), !p.HasNextPage()) + } + return p.Err() +} + +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 +// 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 +func (c *CostandUsageReportService) PutReportDefinitionRequest(input *PutReportDefinitionInput) (req *request.Request, output *PutReportDefinitionOutput) { + op := &request.Operation{ + Name: opPutReportDefinition, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutReportDefinitionInput{} + } + + 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 +// +// 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. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/cur-2017-01-06/PutReportDefinition +func (c *CostandUsageReportService) PutReportDefinition(input *PutReportDefinitionInput) (*PutReportDefinitionOutput, error) { + req, out := c.PutReportDefinitionRequest(input) + return out, req.Send() +} + +// 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. +func (c *CostandUsageReportService) PutReportDefinitionWithContext(ctx aws.Context, input *PutReportDefinitionInput, opts ...request.Option) (*PutReportDefinitionOutput, error) { + req, out := c.PutReportDefinitionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// Request of DeleteReportDefinition +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. + ReportName *string `type:"string"` +} + +// String returns the string representation +func (s DeleteReportDefinitionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteReportDefinitionInput) GoString() string { + return s.String() +} + +// SetReportName sets the ReportName field's value. +func (s *DeleteReportDefinitionInput) SetReportName(v string) *DeleteReportDefinitionInput { + s.ReportName = &v + return s +} + +// Response of DeleteReportDefinition +type DeleteReportDefinitionOutput struct { + _ struct{} `type:"structure"` + + // A message indicates if the deletion is successful. + ResponseMessage *string `type:"string"` +} + +// String returns the string representation +func (s DeleteReportDefinitionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteReportDefinitionOutput) GoString() string { + return s.String() +} + +// SetResponseMessage sets the ResponseMessage field's value. +func (s *DeleteReportDefinitionOutput) SetResponseMessage(v string) *DeleteReportDefinitionOutput { + s.ResponseMessage = &v + return s +} + +// Request of DescribeReportDefinitions +type DescribeReportDefinitionsInput struct { + _ struct{} `type:"structure"` + + // The max number of results returned by the operation. + MaxResults *int64 `min:"5" type:"integer"` + + // A generic string. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s DescribeReportDefinitionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeReportDefinitionsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DescribeReportDefinitionsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DescribeReportDefinitionsInput"} + if s.MaxResults != nil && *s.MaxResults < 5 { + invalidParams.Add(request.NewErrParamMinValue("MaxResults", 5)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *DescribeReportDefinitionsInput) SetMaxResults(v int64) *DescribeReportDefinitionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeReportDefinitionsInput) SetNextToken(v string) *DescribeReportDefinitionsInput { + s.NextToken = &v + return s +} + +// Response of DescribeReportDefinitions +type DescribeReportDefinitionsOutput struct { + _ struct{} `type:"structure"` + + // A generic string. + NextToken *string `type:"string"` + + // A list of report definitions. + ReportDefinitions []*ReportDefinition `type:"list"` +} + +// String returns the string representation +func (s DescribeReportDefinitionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DescribeReportDefinitionsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *DescribeReportDefinitionsOutput) SetNextToken(v string) *DescribeReportDefinitionsOutput { + s.NextToken = &v + return s +} + +// SetReportDefinitions sets the ReportDefinitions field's value. +func (s *DescribeReportDefinitionsOutput) SetReportDefinitions(v []*ReportDefinition) *DescribeReportDefinitionsOutput { + s.ReportDefinitions = v + return s +} + +// Request of PutReportDefinition +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. + // + // ReportDefinition is a required field + ReportDefinition *ReportDefinition `type:"structure" required:"true"` +} + +// String returns the string representation +func (s PutReportDefinitionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutReportDefinitionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutReportDefinitionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutReportDefinitionInput"} + if s.ReportDefinition == nil { + invalidParams.Add(request.NewErrParamRequired("ReportDefinition")) + } + if s.ReportDefinition != nil { + if err := s.ReportDefinition.Validate(); err != nil { + invalidParams.AddNested("ReportDefinition", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetReportDefinition sets the ReportDefinition field's value. +func (s *PutReportDefinitionInput) SetReportDefinition(v *ReportDefinition) *PutReportDefinitionInput { + s.ReportDefinition = v + return s +} + +// Response of PutReportDefinition +type PutReportDefinitionOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s PutReportDefinitionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +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. +type ReportDefinition struct { + _ struct{} `type:"structure"` + + // 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"` +} + +// String returns the string representation +func (s ReportDefinition) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ReportDefinition) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ReportDefinition) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ReportDefinition"} + if s.AdditionalSchemaElements == nil { + invalidParams.Add(request.NewErrParamRequired("AdditionalSchemaElements")) + } + if s.Compression == nil { + invalidParams.Add(request.NewErrParamRequired("Compression")) + } + if s.Format == nil { + invalidParams.Add(request.NewErrParamRequired("Format")) + } + if s.ReportName == nil { + invalidParams.Add(request.NewErrParamRequired("ReportName")) + } + if s.S3Bucket == nil { + invalidParams.Add(request.NewErrParamRequired("S3Bucket")) + } + if s.S3Prefix == nil { + invalidParams.Add(request.NewErrParamRequired("S3Prefix")) + } + if s.S3Region == nil { + invalidParams.Add(request.NewErrParamRequired("S3Region")) + } + if s.TimeUnit == nil { + invalidParams.Add(request.NewErrParamRequired("TimeUnit")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAdditionalArtifacts sets the AdditionalArtifacts field's value. +func (s *ReportDefinition) SetAdditionalArtifacts(v []*string) *ReportDefinition { + s.AdditionalArtifacts = v + return s +} + +// SetAdditionalSchemaElements sets the AdditionalSchemaElements field's value. +func (s *ReportDefinition) SetAdditionalSchemaElements(v []*string) *ReportDefinition { + s.AdditionalSchemaElements = v + return s +} + +// SetCompression sets the Compression field's value. +func (s *ReportDefinition) SetCompression(v string) *ReportDefinition { + s.Compression = &v + return s +} + +// SetFormat sets the Format field's value. +func (s *ReportDefinition) SetFormat(v string) *ReportDefinition { + s.Format = &v + return s +} + +// SetReportName sets the ReportName field's value. +func (s *ReportDefinition) SetReportName(v string) *ReportDefinition { + s.ReportName = &v + return s +} + +// SetS3Bucket sets the S3Bucket field's value. +func (s *ReportDefinition) SetS3Bucket(v string) *ReportDefinition { + s.S3Bucket = &v + return s +} + +// SetS3Prefix sets the S3Prefix field's value. +func (s *ReportDefinition) SetS3Prefix(v string) *ReportDefinition { + s.S3Prefix = &v + return s +} + +// SetS3Region sets the S3Region field's value. +func (s *ReportDefinition) SetS3Region(v string) *ReportDefinition { + s.S3Region = &v + return s +} + +// SetTimeUnit sets the TimeUnit field's value. +func (s *ReportDefinition) SetTimeUnit(v string) *ReportDefinition { + s.TimeUnit = &v + return s +} + +// Region of customer S3 bucket. +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" +) + +// Enable support for Redshift and/or QuickSight. +const ( + // AdditionalArtifactRedshift is a AdditionalArtifact enum value + AdditionalArtifactRedshift = "REDSHIFT" + + // AdditionalArtifactQuicksight is a AdditionalArtifact enum value + AdditionalArtifactQuicksight = "QUICKSIGHT" +) + +// Preferred compression format for report. +const ( + // CompressionFormatZip is a CompressionFormat enum value + CompressionFormatZip = "ZIP" + + // CompressionFormatGzip is a CompressionFormat enum value + CompressionFormatGzip = "GZIP" +) + +// Preferred format for report. +const ( + // ReportFormatTextOrcsv is a ReportFormat enum value + ReportFormatTextOrcsv = "textORcsv" +) + +// Preference of including Resource IDs. You can include additional details +// about individual resource IDs in your report. +const ( + // SchemaElementResources is a SchemaElement enum value + SchemaElementResources = "RESOURCES" +) + +// The frequency on which report data are measured and displayed. +const ( + // TimeUnitHourly is a TimeUnit enum value + TimeUnitHourly = "HOURLY" + + // TimeUnitDaily is a TimeUnit enum value + TimeUnitDaily = "DAILY" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/costandusagereportserviceiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/costandusagereportserviceiface/interface.go new file mode 100644 index 000000000000..6c552c5fbff8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/costandusagereportserviceiface/interface.go @@ -0,0 +1,79 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package costandusagereportserviceiface provides an interface to enable mocking the AWS Cost and Usage Report Service service client +// for testing your code. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package costandusagereportserviceiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/service/costandusagereportservice" +) + +// CostandUsageReportServiceAPI provides an interface to enable mocking the +// costandusagereportservice.CostandUsageReportService service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// The best way to use this interface is so the SDK's service client's calls +// can be stubbed out for unit testing your code with the SDK without needing +// to inject custom request handlers into the SDK's request pipeline. +// +// // myFunc uses an SDK service client to make a request to +// // AWS Cost and Usage Report Service. +// func myFunc(svc costandusagereportserviceiface.CostandUsageReportServiceAPI) bool { +// // Make svc.DeleteReportDefinition request +// } +// +// func main() { +// sess := session.New() +// svc := costandusagereportservice.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockCostandUsageReportServiceClient struct { +// costandusagereportserviceiface.CostandUsageReportServiceAPI +// } +// func (m *mockCostandUsageReportServiceClient) DeleteReportDefinition(input *costandusagereportservice.DeleteReportDefinitionInput) (*costandusagereportservice.DeleteReportDefinitionOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockCostandUsageReportServiceClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. Its suggested to use the pattern above for testing, or using +// tooling to generate mocks to satisfy the interfaces. +type CostandUsageReportServiceAPI interface { + DeleteReportDefinition(*costandusagereportservice.DeleteReportDefinitionInput) (*costandusagereportservice.DeleteReportDefinitionOutput, error) + DeleteReportDefinitionWithContext(aws.Context, *costandusagereportservice.DeleteReportDefinitionInput, ...request.Option) (*costandusagereportservice.DeleteReportDefinitionOutput, error) + DeleteReportDefinitionRequest(*costandusagereportservice.DeleteReportDefinitionInput) (*request.Request, *costandusagereportservice.DeleteReportDefinitionOutput) + + DescribeReportDefinitions(*costandusagereportservice.DescribeReportDefinitionsInput) (*costandusagereportservice.DescribeReportDefinitionsOutput, error) + DescribeReportDefinitionsWithContext(aws.Context, *costandusagereportservice.DescribeReportDefinitionsInput, ...request.Option) (*costandusagereportservice.DescribeReportDefinitionsOutput, error) + DescribeReportDefinitionsRequest(*costandusagereportservice.DescribeReportDefinitionsInput) (*request.Request, *costandusagereportservice.DescribeReportDefinitionsOutput) + + DescribeReportDefinitionsPages(*costandusagereportservice.DescribeReportDefinitionsInput, func(*costandusagereportservice.DescribeReportDefinitionsOutput, bool) bool) error + DescribeReportDefinitionsPagesWithContext(aws.Context, *costandusagereportservice.DescribeReportDefinitionsInput, func(*costandusagereportservice.DescribeReportDefinitionsOutput, bool) bool, ...request.Option) error + + PutReportDefinition(*costandusagereportservice.PutReportDefinitionInput) (*costandusagereportservice.PutReportDefinitionOutput, error) + PutReportDefinitionWithContext(aws.Context, *costandusagereportservice.PutReportDefinitionInput, ...request.Option) (*costandusagereportservice.PutReportDefinitionOutput, error) + PutReportDefinitionRequest(*costandusagereportservice.PutReportDefinitionInput) (*request.Request, *costandusagereportservice.PutReportDefinitionOutput) +} + +var _ CostandUsageReportServiceAPI = (*costandusagereportservice.CostandUsageReportService)(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go new file mode 100644 index 000000000000..5a3a4609872b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/doc.go @@ -0,0 +1,28 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// 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 contact AWS Cost and Usage Report Service with the SDK use the New function to create +// a new service client. With that client you can make API requests to the service. +// These clients are safe to use concurrently. +// +// See the SDK's documentation for more information on how to use the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws.Config documentation for more information on configuring SDK clients. +// 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 client for this service. +// https://docs.aws.amazon.com/sdk-for-go/api/service/costandusagereportservice/#New +package costandusagereportservice diff --git a/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/errors.go b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/errors.go new file mode 100644 index 000000000000..11a8d52097d7 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/errors.go @@ -0,0 +1,34 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package costandusagereportservice + +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" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/service.go b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/service.go new file mode 100644 index 000000000000..39e3cedfeae8 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/costandusagereportservice/service.go @@ -0,0 +1,100 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package costandusagereportservice + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/client" + "github.com/aws/aws-sdk-go/aws/client/metadata" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// 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. +type CostandUsageReportService struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// Service information constants +const ( + 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. +// 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 New(p client.ConfigProvider, cfgs ...*aws.Config) *CostandUsageReportService { + c := p.ClientConfig(EndpointsID, cfgs...) + if c.SigningNameDerived || len(c.SigningName) == 0 { + c.SigningName = "cur" + } + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *CostandUsageReportService { + svc := &CostandUsageReportService{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + ServiceID: ServiceID, + SigningName: signingName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2017-01-06", + JSONVersion: "1.1", + TargetPrefix: "AWSOrigamiServiceGatewayService", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a CostandUsageReportService operation and runs any +// custom request initialization. +func (c *CostandUsageReportService) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/modules.txt b/vendor/modules.txt index eab578f13d3b..d743884dc3ac 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -51,6 +51,7 @@ github.com/aws/aws-sdk-go/service/codepipeline github.com/aws/aws-sdk-go/service/cognitoidentity github.com/aws/aws-sdk-go/service/cognitoidentityprovider github.com/aws/aws-sdk-go/service/configservice +github.com/aws/aws-sdk-go/service/costandusagereportservice github.com/aws/aws-sdk-go/service/databasemigrationservice github.com/aws/aws-sdk-go/service/datapipeline github.com/aws/aws-sdk-go/service/datasync From 4a3b9fab81148d372f2a0f12952a83586df7f8a1 Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Sat, 2 Feb 2019 10:51:52 -0800 Subject: [PATCH 02/16] Add resource for Cost and Usage Report Definitions --- aws/data_source_aws_cur_report_definition.go | 59 ++++++ ...a_source_aws_cur_report_definition_test.go | 119 +++++++++++ aws/provider.go | 2 + aws/resource_aws_cur_report_definition.go | 190 ++++++++++++++++++ ...resource_aws_cur_report_definition_test.go | 162 +++++++++++++++ .../d/cur_report_definition.html.markdown | 38 ++++ .../r/cur_report_definition.html.markdown | 48 +++++ 7 files changed, 618 insertions(+) create mode 100644 aws/data_source_aws_cur_report_definition.go create mode 100644 aws/data_source_aws_cur_report_definition_test.go create mode 100644 aws/resource_aws_cur_report_definition.go create mode 100644 aws/resource_aws_cur_report_definition_test.go create mode 100644 website/docs/d/cur_report_definition.html.markdown create mode 100644 website/docs/r/cur_report_definition.html.markdown diff --git a/aws/data_source_aws_cur_report_definition.go b/aws/data_source_aws_cur_report_definition.go new file mode 100644 index 000000000000..734da5dd9a44 --- /dev/null +++ b/aws/data_source_aws_cur_report_definition.go @@ -0,0 +1,59 @@ +package aws + +import ( + "github.com/hashicorp/terraform/helper/schema" +) + +func dataSourceAwsCurReportDefinition() *schema.Resource { + return &schema.Resource{ + Read: dataSourceAwsCurReportDefinitionRead, + + Schema: map[string]*schema.Schema{ + "report_name": { + Type: schema.TypeString, + Required: true, + }, + "time_unit": { + Type: schema.TypeString, + Computed: true, + }, + "format": { + Type: schema.TypeString, + Computed: true, + }, + "compression": { + Type: schema.TypeString, + Computed: true, + }, + "additional_schema_elements": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Computed: true, + }, + "s3_bucket": { + Type: schema.TypeString, + Computed: true, + }, + "s3_prefix": { + Type: schema.TypeString, + Computed: true, + }, + "s3_region": { + Type: schema.TypeString, + Computed: true, + }, + "additional_artifacts": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + Computed: true, + }, + }, + } +} + +func dataSourceAwsCurReportDefinitionRead(d *schema.ResourceData, meta interface{}) error { + d.SetId(d.Get("report_name").(string)) + return resourceAwsCurReportDefinitionRead(d, meta) +} diff --git a/aws/data_source_aws_cur_report_definition_test.go b/aws/data_source_aws_cur_report_definition_test.go new file mode 100644 index 000000000000..48922eefb840 --- /dev/null +++ b/aws/data_source_aws_cur_report_definition_test.go @@ -0,0 +1,119 @@ +package aws + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" + "github.com/hashicorp/terraform/terraform" +) + +func TestAccDataSourceAwsCurReportDefinition_basic(t *testing.T) { + resourceName := "aws_cur_report_definition.test" + datasourceName := "data.aws_cur_report_definition.test" + + reportName := acctest.RandomWithPrefix("tf_acc_test") + bucketName := fmt.Sprintf("tf-test-bucket-%d", acctest.RandInt()) + bucketRegion := "us-east-1" + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: testAccDataSourceAwsCurReportDefinitionConfig_basic(reportName, bucketName, bucketRegion), + Check: resource.ComposeTestCheckFunc( + testAccDataSourceAwsCurReportDefinitionCheckExists(datasourceName, resourceName), + resource.TestCheckResourceAttr(datasourceName, "report_name", reportName), + resource.TestCheckResourceAttr(datasourceName, "time_unit", "DAILY"), + resource.TestCheckResourceAttr(datasourceName, "compression", "GZIP"), + resource.TestCheckResourceAttr(datasourceName, "additional_schema_elements.#", "1"), + resource.TestCheckResourceAttr(datasourceName, "s3_bucket", bucketName), + resource.TestCheckResourceAttr(datasourceName, "s3_prefix", ""), + resource.TestCheckResourceAttr(datasourceName, "s3_region", bucketRegion), + resource.TestCheckResourceAttr(datasourceName, "additional_artifacts.#", "2"), + ), + }, + }, + }) +} + +func testAccDataSourceAwsCurReportDefinitionCheckExists(datasourceName, resourceName string) resource.TestCheckFunc { + return func(s *terraform.State) error { + _, ok := s.RootModule().Resources[datasourceName] + if !ok { + return fmt.Errorf("root module has no data source called %s", datasourceName) + } + _, ok = s.RootModule().Resources[resourceName] + if !ok { + return fmt.Errorf("root module has no resource called %s", resourceName) + } + return nil + } +} + +// note: cur report definitions are currently only supported in us-east-1 +func testAccDataSourceAwsCurReportDefinitionConfig_basic(reportName string, bucketName string, bucketRegion string) string { + return fmt.Sprintf(` +provider "aws" { + region = "us-east-1" +} + +resource "aws_s3_bucket" "test" { + bucket = "%[2]s" + acl = "private" + force_destroy = true + region = "%[3]s" +} + +resource "aws_s3_bucket_policy" "test" { + bucket = "${aws_s3_bucket.test.id}" + policy = < Date: Sat, 2 Feb 2019 11:49:47 -0800 Subject: [PATCH 03/16] fix unreachable code --- aws/resource_aws_cur_report_definition.go | 1 - 1 file changed, 1 deletion(-) diff --git a/aws/resource_aws_cur_report_definition.go b/aws/resource_aws_cur_report_definition.go index b9ffde392afe..a54831b18e90 100644 --- a/aws/resource_aws_cur_report_definition.go +++ b/aws/resource_aws_cur_report_definition.go @@ -174,7 +174,6 @@ func resourceAwsCurReportDefinitionRead(d *schema.ResourceData, meta interface{} d.Set("additional_artifacts", aws.StringValueSlice(matchingReportDefinition.AdditionalArtifacts)) return nil } - return nil } func resourceAwsCurReportDefinitionDelete(d *schema.ResourceData, meta interface{}) error { From ae8d01f5e15edd555b470110141062006ea836be Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Tue, 12 Feb 2019 10:48:26 -0800 Subject: [PATCH 04/16] remove copypasta --- website/docs/r/cur_report_definition.html.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/website/docs/r/cur_report_definition.html.markdown b/website/docs/r/cur_report_definition.html.markdown index 1eee63cb815b..ce5bbdb06277 100644 --- a/website/docs/r/cur_report_definition.html.markdown +++ b/website/docs/r/cur_report_definition.html.markdown @@ -41,7 +41,6 @@ The following arguments are supported: ## Import Report Definitions can be imported using the `report_name`, e.g. -SQS Queues can be imported using the `queue url`, e.g. ``` $ terraform import aws_cur_report_definition.example_cur_report_definition example-cur-report-definition From bb1d7831053a9834543138e8e6fa0ac827d4803d Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 12 Feb 2019 10:52:27 -0800 Subject: [PATCH 05/16] Use aws_ Co-Authored-By: jbmchuck --- aws/data_source_aws_cur_report_definition_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_cur_report_definition_test.go b/aws/data_source_aws_cur_report_definition_test.go index 48922eefb840..a86255566c46 100644 --- a/aws/data_source_aws_cur_report_definition_test.go +++ b/aws/data_source_aws_cur_report_definition_test.go @@ -78,7 +78,7 @@ resource "aws_s3_bucket_policy" "test" { "Sid": "AllowCURBillingACLPolicy", "Effect": "Allow", "Principal": { - "AWS": "arn:aws:iam::386209384616:root" + "AWS": "${data.aws_billing_service_account.test.arn}" }, "Action": [ "s3:GetBucketAcl", From 5ade42e911fe190ef8486a7a64deeeba5928ce1e Mon Sep 17 00:00:00 2001 From: Brian Flad Date: Tue, 12 Feb 2019 10:54:25 -0800 Subject: [PATCH 06/16] Use aws_s3_bucket arn rather than handrolling an arn Co-Authored-By: jbmchuck --- aws/data_source_aws_cur_report_definition_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aws/data_source_aws_cur_report_definition_test.go b/aws/data_source_aws_cur_report_definition_test.go index a86255566c46..ad2b0243ef68 100644 --- a/aws/data_source_aws_cur_report_definition_test.go +++ b/aws/data_source_aws_cur_report_definition_test.go @@ -84,7 +84,7 @@ resource "aws_s3_bucket_policy" "test" { "s3:GetBucketAcl", "s3:GetBucketPolicy" ], - "Resource": "arn:aws:s3:::${aws_s3_bucket.test.id}" + "Resource": "${aws_s3_bucket.test.arn}" }, { "Sid": "AllowCURPutObject", From 10f4b4e6dd3d71b6678f668dca0ed12dc82e13bf Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Tue, 12 Feb 2019 10:58:27 -0800 Subject: [PATCH 07/16] clarify/simplify handling of reportName var --- aws/resource_aws_cur_report_definition.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aws/resource_aws_cur_report_definition.go b/aws/resource_aws_cur_report_definition.go index a54831b18e90..052e1bf6a9e4 100644 --- a/aws/resource_aws_cur_report_definition.go +++ b/aws/resource_aws_cur_report_definition.go @@ -98,10 +98,10 @@ func resourceAwsCurReportDefinition() *schema.Resource { func resourceAwsCurReportDefinitionCreate(d *schema.ResourceData, meta interface{}) error { conn := meta.(*AWSClient).costandusagereportconn - reportName := *aws.String(d.Get("report_name").(string)) + reportName := d.Get("report_name").(string) reportDefinition := &costandusagereportservice.ReportDefinition{ - ReportName: &reportName, + ReportName: aws.String(reportName), TimeUnit: aws.String(d.Get("time_unit").(string)), Format: aws.String(d.Get("format").(string)), Compression: aws.String(d.Get("compression").(string)), From f2c84c8c97646117e12eb4dba905391cfd0dda52 Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Tue, 12 Feb 2019 11:11:17 -0800 Subject: [PATCH 08/16] s3_prefix can be empty - make optional --- aws/resource_aws_cur_report_definition.go | 2 +- website/docs/r/cur_report_definition.html.markdown | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/aws/resource_aws_cur_report_definition.go b/aws/resource_aws_cur_report_definition.go index 052e1bf6a9e4..85533b473d2f 100644 --- a/aws/resource_aws_cur_report_definition.go +++ b/aws/resource_aws_cur_report_definition.go @@ -70,7 +70,7 @@ func resourceAwsCurReportDefinition() *schema.Resource { }, "s3_prefix": { Type: schema.TypeString, - Required: true, + Optional: true, ForceNew: true, ValidateFunc: validation.StringLenBetween(0, 256), }, diff --git a/website/docs/r/cur_report_definition.html.markdown b/website/docs/r/cur_report_definition.html.markdown index ce5bbdb06277..b670fbfa1704 100644 --- a/website/docs/r/cur_report_definition.html.markdown +++ b/website/docs/r/cur_report_definition.html.markdown @@ -18,7 +18,6 @@ resource "aws_cur_report_definition" "example_cur_report_definition" { compression = "GZIP" additional_schema_elements = ["RESOURCES"] s3_bucket = "example-bucket-name" - s3_prefix = "" s3_region = "us-east-1" additional_artifacts = ["REDSHIFT", "QUICKSIGHT"] } @@ -34,7 +33,7 @@ The following arguments are supported: * `compression` - (Required) Compression format for report. Valid values are: GZIP, ZIP. * `additional_schema_elements` - (Required) A list of schema elements. Valid values are: RESOURCES. * `s3_bucket` - (Required) Name of the existing S3 bucket to hold generated reports. -* `s3_prefix` - (Required) Report path prefix. Limited to 256 characters. +* `s3_prefix` - (Optional) Report path prefix. Limited to 256 characters. * `s3_region` - (Required) Region of the existing S3 bucket to hold generated reports. * `additional_artifacts` - (Required) A list of additional artifacts. Valid values are: REDSHIFT, QUICKSIGHT. From c33d39e303744206ac4a46e33bf4dd47e0276c14 Mon Sep 17 00:00:00 2001 From: Jon Michaelchuck Date: Tue, 12 Feb 2019 11:35:36 -0800 Subject: [PATCH 09/16] add sidebar content for cur report definitions. Fix sidebar_current strings --- website/aws.erb | 14 ++++++++++++++ website/docs/d/cur_report_definition.html.markdown | 2 +- website/docs/r/cur_report_definition.html.markdown | 2 +- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/website/aws.erb b/website/aws.erb index e7c98a568476..2f7ce48e1cc5 100644 --- a/website/aws.erb +++ b/website/aws.erb @@ -113,6 +113,9 @@ > aws_cognito_user_pools + > + aws_cur_report_definition + > aws_db_cluster_snapshot @@ -819,6 +822,17 @@ + > + Cost and Usage Report Resources + + + > Data Lifecycle Manager Resources