Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood
2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483197 additions and 5918 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,116 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package budgetsiface provides an interface to enable mocking the AWS Budgets 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 budgetsiface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/budgets"
)
// BudgetsAPI provides an interface to enable mocking the
// budgets.Budgets 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 the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // AWS Budgets.
// func myFunc(svc budgetsiface.BudgetsAPI) bool {
// // Make svc.CreateBudget request
// }
//
// func main() {
// sess := session.New()
// svc := budgets.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockBudgetsClient struct {
// budgetsiface.BudgetsAPI
// }
// func (m *mockBudgetsClient) CreateBudget(input *budgets.CreateBudgetInput) (*budgets.CreateBudgetOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockBudgetsClient{}
//
// 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 BudgetsAPI interface {
CreateBudget(*budgets.CreateBudgetInput) (*budgets.CreateBudgetOutput, error)
CreateBudgetWithContext(aws.Context, *budgets.CreateBudgetInput, ...request.Option) (*budgets.CreateBudgetOutput, error)
CreateBudgetRequest(*budgets.CreateBudgetInput) (*request.Request, *budgets.CreateBudgetOutput)
CreateNotification(*budgets.CreateNotificationInput) (*budgets.CreateNotificationOutput, error)
CreateNotificationWithContext(aws.Context, *budgets.CreateNotificationInput, ...request.Option) (*budgets.CreateNotificationOutput, error)
CreateNotificationRequest(*budgets.CreateNotificationInput) (*request.Request, *budgets.CreateNotificationOutput)
CreateSubscriber(*budgets.CreateSubscriberInput) (*budgets.CreateSubscriberOutput, error)
CreateSubscriberWithContext(aws.Context, *budgets.CreateSubscriberInput, ...request.Option) (*budgets.CreateSubscriberOutput, error)
CreateSubscriberRequest(*budgets.CreateSubscriberInput) (*request.Request, *budgets.CreateSubscriberOutput)
DeleteBudget(*budgets.DeleteBudgetInput) (*budgets.DeleteBudgetOutput, error)
DeleteBudgetWithContext(aws.Context, *budgets.DeleteBudgetInput, ...request.Option) (*budgets.DeleteBudgetOutput, error)
DeleteBudgetRequest(*budgets.DeleteBudgetInput) (*request.Request, *budgets.DeleteBudgetOutput)
DeleteNotification(*budgets.DeleteNotificationInput) (*budgets.DeleteNotificationOutput, error)
DeleteNotificationWithContext(aws.Context, *budgets.DeleteNotificationInput, ...request.Option) (*budgets.DeleteNotificationOutput, error)
DeleteNotificationRequest(*budgets.DeleteNotificationInput) (*request.Request, *budgets.DeleteNotificationOutput)
DeleteSubscriber(*budgets.DeleteSubscriberInput) (*budgets.DeleteSubscriberOutput, error)
DeleteSubscriberWithContext(aws.Context, *budgets.DeleteSubscriberInput, ...request.Option) (*budgets.DeleteSubscriberOutput, error)
DeleteSubscriberRequest(*budgets.DeleteSubscriberInput) (*request.Request, *budgets.DeleteSubscriberOutput)
DescribeBudget(*budgets.DescribeBudgetInput) (*budgets.DescribeBudgetOutput, error)
DescribeBudgetWithContext(aws.Context, *budgets.DescribeBudgetInput, ...request.Option) (*budgets.DescribeBudgetOutput, error)
DescribeBudgetRequest(*budgets.DescribeBudgetInput) (*request.Request, *budgets.DescribeBudgetOutput)
DescribeBudgets(*budgets.DescribeBudgetsInput) (*budgets.DescribeBudgetsOutput, error)
DescribeBudgetsWithContext(aws.Context, *budgets.DescribeBudgetsInput, ...request.Option) (*budgets.DescribeBudgetsOutput, error)
DescribeBudgetsRequest(*budgets.DescribeBudgetsInput) (*request.Request, *budgets.DescribeBudgetsOutput)
DescribeNotificationsForBudget(*budgets.DescribeNotificationsForBudgetInput) (*budgets.DescribeNotificationsForBudgetOutput, error)
DescribeNotificationsForBudgetWithContext(aws.Context, *budgets.DescribeNotificationsForBudgetInput, ...request.Option) (*budgets.DescribeNotificationsForBudgetOutput, error)
DescribeNotificationsForBudgetRequest(*budgets.DescribeNotificationsForBudgetInput) (*request.Request, *budgets.DescribeNotificationsForBudgetOutput)
DescribeSubscribersForNotification(*budgets.DescribeSubscribersForNotificationInput) (*budgets.DescribeSubscribersForNotificationOutput, error)
DescribeSubscribersForNotificationWithContext(aws.Context, *budgets.DescribeSubscribersForNotificationInput, ...request.Option) (*budgets.DescribeSubscribersForNotificationOutput, error)
DescribeSubscribersForNotificationRequest(*budgets.DescribeSubscribersForNotificationInput) (*request.Request, *budgets.DescribeSubscribersForNotificationOutput)
UpdateBudget(*budgets.UpdateBudgetInput) (*budgets.UpdateBudgetOutput, error)
UpdateBudgetWithContext(aws.Context, *budgets.UpdateBudgetInput, ...request.Option) (*budgets.UpdateBudgetOutput, error)
UpdateBudgetRequest(*budgets.UpdateBudgetInput) (*request.Request, *budgets.UpdateBudgetOutput)
UpdateNotification(*budgets.UpdateNotificationInput) (*budgets.UpdateNotificationOutput, error)
UpdateNotificationWithContext(aws.Context, *budgets.UpdateNotificationInput, ...request.Option) (*budgets.UpdateNotificationOutput, error)
UpdateNotificationRequest(*budgets.UpdateNotificationInput) (*request.Request, *budgets.UpdateNotificationOutput)
UpdateSubscriber(*budgets.UpdateSubscriberInput) (*budgets.UpdateSubscriberOutput, error)
UpdateSubscriberWithContext(aws.Context, *budgets.UpdateSubscriberInput, ...request.Option) (*budgets.UpdateSubscriberOutput, error)
UpdateSubscriberRequest(*budgets.UpdateSubscriberInput) (*request.Request, *budgets.UpdateSubscriberOutput)
}
var _ BudgetsAPI = (*budgets.Budgets)(nil)
+78
View File
@@ -0,0 +1,78 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package budgets provides the client and types for making API
// requests to AWS Budgets.
//
// All public APIs for AWS Budgets
//
// See budgets package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/budgets/
//
// Using the Client
//
// To use the client for AWS Budgets you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := budgets.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the AWS Budgets client Budgets for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/budgets/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.CreateBudget(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("CreateBudget result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.CreateBudgetWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package budgets
+53
View File
@@ -0,0 +1,53 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package budgets
const (
// ErrCodeCreationLimitExceededException for service response error code
// "CreationLimitExceededException".
//
// The exception is thrown when customer tries to create a record (e.g. budget),
// but the number this record already exceeds the limitation.
ErrCodeCreationLimitExceededException = "CreationLimitExceededException"
// ErrCodeDuplicateRecordException for service response error code
// "DuplicateRecordException".
//
// The exception is thrown when customer tries to create a record (e.g. budget)
// that already exists.
ErrCodeDuplicateRecordException = "DuplicateRecordException"
// ErrCodeExpiredNextTokenException for service response error code
// "ExpiredNextTokenException".
//
// This exception is thrown if the paging token is expired - past its TTL
ErrCodeExpiredNextTokenException = "ExpiredNextTokenException"
// ErrCodeInternalErrorException for service response error code
// "InternalErrorException".
//
// This exception is thrown on an unknown internal failure.
ErrCodeInternalErrorException = "InternalErrorException"
// ErrCodeInvalidNextTokenException for service response error code
// "InvalidNextTokenException".
//
// This exception is thrown if paging token signature didn't match the token,
// or the paging token isn't for this request
ErrCodeInvalidNextTokenException = "InvalidNextTokenException"
// ErrCodeInvalidParameterException for service response error code
// "InvalidParameterException".
//
// This exception is thrown if any request is given an invalid parameter. E.g.,
// if a required Date field is null.
ErrCodeInvalidParameterException = "InvalidParameterException"
// ErrCodeNotFoundException for service response error code
// "NotFoundException".
//
// This exception is thrown if a requested entity is not found. E.g., if a budget
// id doesn't exist for an account ID.
ErrCodeNotFoundException = "NotFoundException"
)
+455
View File
@@ -0,0 +1,455 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package budgets_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/budgets"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleBudgets_CreateBudget() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.CreateBudgetInput{
AccountId: aws.String("AccountId"), // Required
Budget: &budgets.Budget{ // Required
BudgetLimit: &budgets.Spend{ // Required
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
BudgetName: aws.String("BudgetName"), // Required
BudgetType: aws.String("BudgetType"), // Required
CostTypes: &budgets.CostTypes{ // Required
IncludeSubscription: aws.Bool(true), // Required
IncludeTax: aws.Bool(true), // Required
UseBlended: aws.Bool(true), // Required
},
TimePeriod: &budgets.TimePeriod{ // Required
End: aws.Time(time.Now()), // Required
Start: aws.Time(time.Now()), // Required
},
TimeUnit: aws.String("TimeUnit"), // Required
CalculatedSpend: &budgets.CalculatedSpend{
ActualSpend: &budgets.Spend{ // Required
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
ForecastedSpend: &budgets.Spend{
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
},
CostFilters: map[string][]*string{
"Key": { // Required
aws.String("GenericString"), // Required
// More values...
},
// More values...
},
},
NotificationsWithSubscribers: []*budgets.NotificationWithSubscribers{
{ // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
Subscribers: []*budgets.Subscriber{ // Required
{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
// More values...
},
},
// More values...
},
}
resp, err := svc.CreateBudget(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)
}
func ExampleBudgets_CreateNotification() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.CreateNotificationInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
Subscribers: []*budgets.Subscriber{ // Required
{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
// More values...
},
}
resp, err := svc.CreateNotification(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)
}
func ExampleBudgets_CreateSubscriber() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.CreateSubscriberInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
Subscriber: &budgets.Subscriber{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
}
resp, err := svc.CreateSubscriber(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)
}
func ExampleBudgets_DeleteBudget() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DeleteBudgetInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
}
resp, err := svc.DeleteBudget(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)
}
func ExampleBudgets_DeleteNotification() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DeleteNotificationInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
}
resp, err := svc.DeleteNotification(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)
}
func ExampleBudgets_DeleteSubscriber() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DeleteSubscriberInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
Subscriber: &budgets.Subscriber{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
}
resp, err := svc.DeleteSubscriber(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)
}
func ExampleBudgets_DescribeBudget() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DescribeBudgetInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
}
resp, err := svc.DescribeBudget(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)
}
func ExampleBudgets_DescribeBudgets() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DescribeBudgetsInput{
AccountId: aws.String("AccountId"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("GenericString"),
}
resp, err := svc.DescribeBudgets(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)
}
func ExampleBudgets_DescribeNotificationsForBudget() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DescribeNotificationsForBudgetInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("GenericString"),
}
resp, err := svc.DescribeNotificationsForBudget(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)
}
func ExampleBudgets_DescribeSubscribersForNotification() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.DescribeSubscribersForNotificationInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
MaxResults: aws.Int64(1),
NextToken: aws.String("GenericString"),
}
resp, err := svc.DescribeSubscribersForNotification(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)
}
func ExampleBudgets_UpdateBudget() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.UpdateBudgetInput{
AccountId: aws.String("AccountId"), // Required
NewBudget: &budgets.Budget{ // Required
BudgetLimit: &budgets.Spend{ // Required
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
BudgetName: aws.String("BudgetName"), // Required
BudgetType: aws.String("BudgetType"), // Required
CostTypes: &budgets.CostTypes{ // Required
IncludeSubscription: aws.Bool(true), // Required
IncludeTax: aws.Bool(true), // Required
UseBlended: aws.Bool(true), // Required
},
TimePeriod: &budgets.TimePeriod{ // Required
End: aws.Time(time.Now()), // Required
Start: aws.Time(time.Now()), // Required
},
TimeUnit: aws.String("TimeUnit"), // Required
CalculatedSpend: &budgets.CalculatedSpend{
ActualSpend: &budgets.Spend{ // Required
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
ForecastedSpend: &budgets.Spend{
Amount: aws.String("NumericValue"), // Required
Unit: aws.String("GenericString"), // Required
},
},
CostFilters: map[string][]*string{
"Key": { // Required
aws.String("GenericString"), // Required
// More values...
},
// More values...
},
},
}
resp, err := svc.UpdateBudget(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)
}
func ExampleBudgets_UpdateNotification() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.UpdateNotificationInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
NewNotification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
OldNotification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
}
resp, err := svc.UpdateNotification(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)
}
func ExampleBudgets_UpdateSubscriber() {
sess := session.Must(session.NewSession())
svc := budgets.New(sess)
params := &budgets.UpdateSubscriberInput{
AccountId: aws.String("AccountId"), // Required
BudgetName: aws.String("BudgetName"), // Required
NewSubscriber: &budgets.Subscriber{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
Notification: &budgets.Notification{ // Required
ComparisonOperator: aws.String("ComparisonOperator"), // Required
NotificationType: aws.String("NotificationType"), // Required
Threshold: aws.Float64(1.0), // Required
},
OldSubscriber: &budgets.Subscriber{ // Required
Address: aws.String("GenericString"), // Required
SubscriptionType: aws.String("SubscriptionType"), // Required
},
}
resp, err := svc.UpdateSubscriber(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)
}
+95
View File
@@ -0,0 +1,95 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package budgets
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"
)
// Budgets provides the API operation methods for making requests to
// AWS Budgets. See this package's package overview docs
// for details on the service.
//
// Budgets methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Budgets 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 = "budgets" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Budgets 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 Budgets client from just a session.
// svc := budgets.New(mySession)
//
// // Create a Budgets client with additional configuration
// svc := budgets.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Budgets {
c := p.ClientConfig(EndpointsID, cfgs...)
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) *Budgets {
svc := &Budgets{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-10-20",
JSONVersion: "1.1",
TargetPrefix: "AWSBudgetServiceGateway",
},
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 Budgets operation and runs any
// custom request initialization.
func (c *Budgets) 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
}