2018-10-24 13:15:06 +00:00
|
|
|
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
|
2015-09-16 20:05:04 +00:00
|
|
|
|
|
|
|
package ec2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/aws/aws-sdk-go/aws"
|
2016-11-03 15:37:23 +00:00
|
|
|
"github.com/aws/aws-sdk-go/aws/client"
|
|
|
|
"github.com/aws/aws-sdk-go/aws/client/metadata"
|
2015-09-16 20:05:04 +00:00
|
|
|
"github.com/aws/aws-sdk-go/aws/request"
|
2016-11-03 15:37:23 +00:00
|
|
|
"github.com/aws/aws-sdk-go/aws/signer/v4"
|
|
|
|
"github.com/aws/aws-sdk-go/private/protocol/ec2query"
|
2015-09-16 20:05:04 +00:00
|
|
|
)
|
|
|
|
|
2018-10-24 13:15:06 +00:00
|
|
|
// EC2 provides the API operation methods for making requests to
|
|
|
|
// Amazon Elastic Compute Cloud. See this package's package overview docs
|
|
|
|
// for details on the service.
|
|
|
|
//
|
|
|
|
// EC2 methods are safe to use concurrently. It is not safe to
|
|
|
|
// modify mutate any of the struct's properties though.
|
2015-09-16 20:05:04 +00:00
|
|
|
type EC2 struct {
|
2016-11-03 15:37:23 +00:00
|
|
|
*client.Client
|
2015-09-16 20:05:04 +00:00
|
|
|
}
|
|
|
|
|
2016-11-03 15:37:23 +00:00
|
|
|
// Used for custom client initialization logic
|
|
|
|
var initClient func(*client.Client)
|
2015-09-16 20:05:04 +00:00
|
|
|
|
|
|
|
// Used for custom request initialization logic
|
|
|
|
var initRequest func(*request.Request)
|
|
|
|
|
2018-10-24 13:15:06 +00:00
|
|
|
// Service information constants
|
|
|
|
const (
|
2019-05-20 18:08:26 +00:00
|
|
|
ServiceName = "ec2" // Name of service.
|
|
|
|
EndpointsID = ServiceName // ID to lookup a service endpoint with.
|
2020-02-17 21:13:33 +00:00
|
|
|
ServiceID = "EC2" // ServiceID is a unique identifier of a specific service.
|
2018-10-24 13:15:06 +00:00
|
|
|
)
|
2016-11-03 15:37:23 +00:00
|
|
|
|
|
|
|
// New creates a new instance of the EC2 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:
|
2019-12-09 23:16:18 +00:00
|
|
|
// mySession := session.Must(session.NewSession())
|
|
|
|
//
|
2016-11-03 15:37:23 +00:00
|
|
|
// // Create a EC2 client from just a session.
|
|
|
|
// svc := ec2.New(mySession)
|
|
|
|
//
|
|
|
|
// // Create a EC2 client with additional configuration
|
|
|
|
// svc := ec2.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
|
|
|
func New(p client.ConfigProvider, cfgs ...*aws.Config) *EC2 {
|
2018-10-24 13:15:06 +00:00
|
|
|
c := p.ClientConfig(EndpointsID, cfgs...)
|
2019-12-09 23:16:18 +00:00
|
|
|
return newClient(*c.Config, c.Handlers, c.PartitionID, c.Endpoint, c.SigningRegion, c.SigningName)
|
2016-11-03 15:37:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// newClient creates, initializes and returns a new service client instance.
|
2019-12-09 23:16:18 +00:00
|
|
|
func newClient(cfg aws.Config, handlers request.Handlers, partitionID, endpoint, signingRegion, signingName string) *EC2 {
|
2016-11-03 15:37:23 +00:00
|
|
|
svc := &EC2{
|
|
|
|
Client: client.New(
|
|
|
|
cfg,
|
|
|
|
metadata.ClientInfo{
|
|
|
|
ServiceName: ServiceName,
|
2019-05-20 18:08:26 +00:00
|
|
|
ServiceID: ServiceID,
|
2018-10-24 13:15:06 +00:00
|
|
|
SigningName: signingName,
|
2016-11-03 15:37:23 +00:00
|
|
|
SigningRegion: signingRegion,
|
2019-12-09 23:16:18 +00:00
|
|
|
PartitionID: partitionID,
|
2016-11-03 15:37:23 +00:00
|
|
|
Endpoint: endpoint,
|
2018-10-24 13:15:06 +00:00
|
|
|
APIVersion: "2016-11-15",
|
2016-11-03 15:37:23 +00:00
|
|
|
},
|
|
|
|
handlers,
|
|
|
|
),
|
2015-09-16 20:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Handlers
|
2016-11-03 15:37:23 +00:00
|
|
|
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
|
|
|
svc.Handlers.Build.PushBackNamed(ec2query.BuildHandler)
|
|
|
|
svc.Handlers.Unmarshal.PushBackNamed(ec2query.UnmarshalHandler)
|
|
|
|
svc.Handlers.UnmarshalMeta.PushBackNamed(ec2query.UnmarshalMetaHandler)
|
|
|
|
svc.Handlers.UnmarshalError.PushBackNamed(ec2query.UnmarshalErrorHandler)
|
2015-09-16 20:05:04 +00:00
|
|
|
|
2016-11-03 15:37:23 +00:00
|
|
|
// Run custom client initialization if present
|
|
|
|
if initClient != nil {
|
|
|
|
initClient(svc.Client)
|
2015-09-16 20:05:04 +00:00
|
|
|
}
|
|
|
|
|
2016-11-03 15:37:23 +00:00
|
|
|
return svc
|
2015-09-16 20:05:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// newRequest creates a new request for a EC2 operation and runs any
|
|
|
|
// custom request initialization.
|
|
|
|
func (c *EC2) 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
|
|
|
|
}
|