forked from aws/aws-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
service/marketplacemetering: Add support for new AWS Marketplace Mete…
…ring Service AWS Marketplace Metering Service The AWS Marketplace Metering Service enables sellers to price their products along new pricing dimensions.
- Loading branch information
Showing
7 changed files
with
478 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
{ | ||
"version":"2.0", | ||
"metadata":{ | ||
"apiVersion":"2016-01-14", | ||
"endpointPrefix":"metering.marketplace", | ||
"jsonVersion":"1.1", | ||
"protocol":"json", | ||
"serviceFullName":"AWSMarketplace Metering", | ||
"signatureVersion":"v4", | ||
"signingName":"aws-marketplace", | ||
"targetPrefix":"AWSMPMeteringService" | ||
}, | ||
"operations":{ | ||
"MeterUsage":{ | ||
"name":"MeterUsage", | ||
"http":{ | ||
"method":"POST", | ||
"requestUri":"/" | ||
}, | ||
"input":{"shape":"MeterUsageRequest"}, | ||
"output":{"shape":"MeterUsageResult"}, | ||
"errors":[ | ||
{"shape":"InternalServiceErrorException"}, | ||
{"shape":"InvalidProductCodeException"}, | ||
{"shape":"InvalidUsageDimensionException"}, | ||
{"shape":"InvalidEndpointRegionException"}, | ||
{"shape":"TimestampOutOfBoundsException"}, | ||
{"shape":"DuplicateRequestException"}, | ||
{"shape":"ThrottlingException"} | ||
] | ||
} | ||
}, | ||
"shapes":{ | ||
"Boolean":{"type":"boolean"}, | ||
"DuplicateRequestException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"InternalServiceErrorException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true, | ||
"fault":true | ||
}, | ||
"InvalidEndpointRegionException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"InvalidProductCodeException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"InvalidUsageDimensionException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"MeterUsageRequest":{ | ||
"type":"structure", | ||
"required":[ | ||
"ProductCode", | ||
"Timestamp", | ||
"UsageDimension", | ||
"UsageQuantity", | ||
"DryRun" | ||
], | ||
"members":{ | ||
"ProductCode":{"shape":"ProductCode"}, | ||
"Timestamp":{"shape":"Timestamp"}, | ||
"UsageDimension":{"shape":"UsageDimension"}, | ||
"UsageQuantity":{"shape":"UsageQuantity"}, | ||
"DryRun":{"shape":"Boolean"} | ||
} | ||
}, | ||
"MeterUsageResult":{ | ||
"type":"structure", | ||
"members":{ | ||
"MeteringRecordId":{"shape":"String"} | ||
} | ||
}, | ||
"ProductCode":{ | ||
"type":"string", | ||
"max":255, | ||
"min":1 | ||
}, | ||
"String":{"type":"string"}, | ||
"ThrottlingException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"Timestamp":{"type":"timestamp"}, | ||
"TimestampOutOfBoundsException":{ | ||
"type":"structure", | ||
"members":{ | ||
"message":{"shape":"errorMessage"} | ||
}, | ||
"exception":true | ||
}, | ||
"UsageDimension":{ | ||
"type":"string", | ||
"max":255, | ||
"min":1 | ||
}, | ||
"UsageQuantity":{ | ||
"type":"integer", | ||
"max":10000, | ||
"min":0 | ||
}, | ||
"errorMessage":{"type":"string"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"version": "2.0", | ||
"service": "<fullname>AWS Marketplace Metering Service</fullname> <p>This reference provides descriptions of the low-level AWS Marketplace Metering Service API. </p> <p>AWS Marketplace sellers can use this API to submit usage data for custom usage dimensions.</p> <p><b>Submitting Metering Records</b></p> <ul> <li> <p><i>MeterUsage</i>- Submits the metering record for a Marketplace product.</p> </li> </ul>", | ||
"operations": { | ||
"MeterUsage": "<p>API to emit metering records. For identical requests, the API is idempotent. It simply returns the metering record ID. </p>" | ||
}, | ||
"shapes": { | ||
"Boolean": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageRequest$DryRun": "<p>Checks whether you have the permissions required for the action, but does not make the request. If you have the permissions, the request returns DryRunOperation; otherwise, it returns UnauthorizedException. </p>" | ||
} | ||
}, | ||
"DuplicateRequestException": { | ||
"base": "<p>A metering record has already been emitted by the same EC2 instance for the given {usageDimension, timestamp} with a different usageQuantity. </p>", | ||
"refs": { | ||
} | ||
}, | ||
"InternalServiceErrorException": { | ||
"base": "<p>An internal error has occurred. Retry your request. If the problem persists, post a message with details on the AWS forums.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"InvalidEndpointRegionException": { | ||
"base": "<p>The endpoint being called is in a region different from your EC2 instance. The region of the Metering service endpoint and the region of the EC2 instance must match.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"InvalidProductCodeException": { | ||
"base": "<p>The product code passed does not match the product code used for publishing the product.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"InvalidUsageDimensionException": { | ||
"base": "<p>The usage dimension does not match one of the UsageDimensions associated with products.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"MeterUsageRequest": { | ||
"base": null, | ||
"refs": { | ||
} | ||
}, | ||
"MeterUsageResult": { | ||
"base": null, | ||
"refs": { | ||
} | ||
}, | ||
"ProductCode": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageRequest$ProductCode": "<p>Product code is used to uniquely identify a product in AWS Marketplace. The product code should be the same as the one used during the publishing of a new product.</p>" | ||
} | ||
}, | ||
"String": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageResult$MeteringRecordId": null | ||
} | ||
}, | ||
"ThrottlingException": { | ||
"base": "<p>The calls to the MeterUsage API are throttled.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"Timestamp": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageRequest$Timestamp": "<p>Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions of the timestamp will be ignored. </p>" | ||
} | ||
}, | ||
"TimestampOutOfBoundsException": { | ||
"base": "<p>The timestamp value passed in the meterUsage() is out of allowed range.</p>", | ||
"refs": { | ||
} | ||
}, | ||
"UsageDimension": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageRequest$UsageDimension": "<p>It will be one of the 'fcp dimension name' provided during the publishing of the product.</p>" | ||
} | ||
}, | ||
"UsageQuantity": { | ||
"base": null, | ||
"refs": { | ||
"MeterUsageRequest$UsageQuantity": "<p>Consumption value for the hour.</p>" | ||
} | ||
}, | ||
"errorMessage": { | ||
"base": null, | ||
"refs": { | ||
"DuplicateRequestException$message": null, | ||
"InternalServiceErrorException$message": null, | ||
"InvalidEndpointRegionException$message": null, | ||
"InvalidProductCodeException$message": null, | ||
"InvalidUsageDimensionException$message": null, | ||
"ThrottlingException$message": null, | ||
"TimestampOutOfBoundsException$message": null | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "1.0", | ||
"examples": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
|
||
// Package marketplacemetering provides a client for AWSMarketplace Metering. | ||
package marketplacemetering | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/aws/awsutil" | ||
"github.com/aws/aws-sdk-go/aws/request" | ||
) | ||
|
||
const opMeterUsage = "MeterUsage" | ||
|
||
// MeterUsageRequest generates a request for the MeterUsage operation. | ||
func (c *MarketplaceMetering) MeterUsageRequest(input *MeterUsageInput) (req *request.Request, output *MeterUsageOutput) { | ||
op := &request.Operation{ | ||
Name: opMeterUsage, | ||
HTTPMethod: "POST", | ||
HTTPPath: "/", | ||
} | ||
|
||
if input == nil { | ||
input = &MeterUsageInput{} | ||
} | ||
|
||
req = c.newRequest(op, input, output) | ||
output = &MeterUsageOutput{} | ||
req.Data = output | ||
return | ||
} | ||
|
||
// API to emit metering records. For identical requests, the API is idempotent. | ||
// It simply returns the metering record ID. | ||
func (c *MarketplaceMetering) MeterUsage(input *MeterUsageInput) (*MeterUsageOutput, error) { | ||
req, out := c.MeterUsageRequest(input) | ||
err := req.Send() | ||
return out, err | ||
} | ||
|
||
type MeterUsageInput struct { | ||
_ struct{} `type:"structure"` | ||
|
||
// Checks whether you have the permissions required for the action, but does | ||
// not make the request. If you have the permissions, the request returns DryRunOperation; | ||
// otherwise, it returns UnauthorizedException. | ||
DryRun *bool `type:"boolean" required:"true"` | ||
|
||
// Product code is used to uniquely identify a product in AWS Marketplace. The | ||
// product code should be the same as the one used during the publishing of | ||
// a new product. | ||
ProductCode *string `min:"1" type:"string" required:"true"` | ||
|
||
// Timestamp of the hour, recorded in UTC. The seconds and milliseconds portions | ||
// of the timestamp will be ignored. | ||
Timestamp *time.Time `type:"timestamp" timestampFormat:"unix" required:"true"` | ||
|
||
// It will be one of the 'fcp dimension name' provided during the publishing | ||
// of the product. | ||
UsageDimension *string `min:"1" type:"string" required:"true"` | ||
|
||
// Consumption value for the hour. | ||
UsageQuantity *int64 `type:"integer" required:"true"` | ||
} | ||
|
||
// String returns the string representation | ||
func (s MeterUsageInput) String() string { | ||
return awsutil.Prettify(s) | ||
} | ||
|
||
// GoString returns the string representation | ||
func (s MeterUsageInput) GoString() string { | ||
return s.String() | ||
} | ||
|
||
type MeterUsageOutput struct { | ||
_ struct{} `type:"structure"` | ||
|
||
MeteringRecordId *string `type:"string"` | ||
} | ||
|
||
// String returns the string representation | ||
func (s MeterUsageOutput) String() string { | ||
return awsutil.Prettify(s) | ||
} | ||
|
||
// GoString returns the string representation | ||
func (s MeterUsageOutput) GoString() string { | ||
return s.String() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
|
||
package marketplacemetering_test | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"time" | ||
|
||
"github.com/aws/aws-sdk-go/aws" | ||
"github.com/aws/aws-sdk-go/aws/session" | ||
"github.com/aws/aws-sdk-go/service/marketplacemetering" | ||
) | ||
|
||
var _ time.Duration | ||
var _ bytes.Buffer | ||
|
||
func ExampleMarketplaceMetering_MeterUsage() { | ||
svc := marketplacemetering.New(session.New()) | ||
|
||
params := &marketplacemetering.MeterUsageInput{ | ||
DryRun: aws.Bool(true), // Required | ||
ProductCode: aws.String("ProductCode"), // Required | ||
Timestamp: aws.Time(time.Now()), // Required | ||
UsageDimension: aws.String("UsageDimension"), // Required | ||
UsageQuantity: aws.Int64(1), // Required | ||
} | ||
resp, err := svc.MeterUsage(params) | ||
|
||
if err != nil { | ||
// Print the error, cast err to awserr.Error to get the Code and | ||
// Message from an error. | ||
fmt.Println(err.Error()) | ||
return | ||
} | ||
|
||
// Pretty-print the response data. | ||
fmt.Println(resp) | ||
} |
18 changes: 18 additions & 0 deletions
18
service/marketplacemetering/marketplacemeteringiface/interface.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. | ||
|
||
// Package marketplacemeteringiface provides an interface for the AWSMarketplace Metering. | ||
package marketplacemeteringiface | ||
|
||
import ( | ||
"github.com/aws/aws-sdk-go/aws/request" | ||
"github.com/aws/aws-sdk-go/service/marketplacemetering" | ||
) | ||
|
||
// MarketplaceMeteringAPI is the interface type for marketplacemetering.MarketplaceMetering. | ||
type MarketplaceMeteringAPI interface { | ||
MeterUsageRequest(*marketplacemetering.MeterUsageInput) (*request.Request, *marketplacemetering.MeterUsageOutput) | ||
|
||
MeterUsage(*marketplacemetering.MeterUsageInput) (*marketplacemetering.MeterUsageOutput, error) | ||
} | ||
|
||
var _ MarketplaceMeteringAPI = (*marketplacemetering.MarketplaceMetering)(nil) |
Oops, something went wrong.