1// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
2
3package snowball
4
5import (
6	"github.com/aws/aws-sdk-go/aws"
7	"github.com/aws/aws-sdk-go/aws/client"
8	"github.com/aws/aws-sdk-go/aws/client/metadata"
9	"github.com/aws/aws-sdk-go/aws/request"
10	"github.com/aws/aws-sdk-go/aws/signer/v4"
11	"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
12)
13
14// Snowball provides the API operation methods for making requests to
15// Amazon Import/Export Snowball. See this package's package overview docs
16// for details on the service.
17//
18// Snowball methods are safe to use concurrently. It is not safe to
19// modify mutate any of the struct's properties though.
20type Snowball struct {
21	*client.Client
22}
23
24// Used for custom client initialization logic
25var initClient func(*client.Client)
26
27// Used for custom request initialization logic
28var initRequest func(*request.Request)
29
30// Service information constants
31const (
32	ServiceName = "snowball"  // Name of service.
33	EndpointsID = ServiceName // ID to lookup a service endpoint with.
34	ServiceID   = "Snowball"  // ServiceID is a unique identifer of a specific service.
35)
36
37// New creates a new instance of the Snowball client with a session.
38// If additional configuration is needed for the client instance use the optional
39// aws.Config parameter to add your extra config.
40//
41// Example:
42//     // Create a Snowball client from just a session.
43//     svc := snowball.New(mySession)
44//
45//     // Create a Snowball client with additional configuration
46//     svc := snowball.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
47func New(p client.ConfigProvider, cfgs ...*aws.Config) *Snowball {
48	c := p.ClientConfig(EndpointsID, cfgs...)
49	return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
50}
51
52// newClient creates, initializes and returns a new service client instance.
53func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Snowball {
54	svc := &Snowball{
55		Client: client.New(
56			cfg,
57			metadata.ClientInfo{
58				ServiceName:   ServiceName,
59				ServiceID:     ServiceID,
60				SigningName:   signingName,
61				SigningRegion: signingRegion,
62				Endpoint:      endpoint,
63				APIVersion:    "2016-06-30",
64				JSONVersion:   "1.1",
65				TargetPrefix:  "AWSIESnowballJobManagementService",
66			},
67			handlers,
68		),
69	}
70
71	// Handlers
72	svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
73	svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
74	svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
75	svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
76	svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
77
78	// Run custom client initialization if present
79	if initClient != nil {
80		initClient(svc.Client)
81	}
82
83	return svc
84}
85
86// newRequest creates a new request for a Snowball operation and runs any
87// custom request initialization.
88func (c *Snowball) newRequest(op *request.Operation, params, data interface{}) *request.Request {
89	req := c.NewRequest(op, params, data)
90
91	// Run custom request initialization if present
92	if initRequest != nil {
93		initRequest(req)
94	}
95
96	return req
97}
98