service.go 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package snowball
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/client"
  6. "github.com/aws/aws-sdk-go/aws/client/metadata"
  7. "github.com/aws/aws-sdk-go/aws/request"
  8. "github.com/aws/aws-sdk-go/aws/signer/v4"
  9. "github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
  10. )
  11. // AWS Import/Export Snowball is a petabyte-scale data transport solution that
  12. // uses secure appliances to transfer large amounts of data between your on-premises
  13. // data centers and Amazon Simple Storage Service (Amazon S3). The Snowball
  14. // commands described here provide access to the same functionality that is
  15. // available in the AWS Snowball Management Console, which enables you to create
  16. // and manage jobs for Snowball. To transfer data locally with a Snowball appliance,
  17. // you'll need to use the Snowball client or the Amazon S3 API adapter for Snowball.
  18. // For more information, see the User Guide (http://docs.aws.amazon.com/AWSImportExport/latest/ug/api-reference.html).
  19. //The service client's operations are safe to be used concurrently.
  20. // It is not safe to mutate any of the client's properties though.
  21. type Snowball struct {
  22. *client.Client
  23. }
  24. // Used for custom client initialization logic
  25. var initClient func(*client.Client)
  26. // Used for custom request initialization logic
  27. var initRequest func(*request.Request)
  28. // A ServiceName is the name of the service the client will make API calls to.
  29. const ServiceName = "snowball"
  30. // New creates a new instance of the Snowball client with a session.
  31. // If additional configuration is needed for the client instance use the optional
  32. // aws.Config parameter to add your extra config.
  33. //
  34. // Example:
  35. // // Create a Snowball client from just a session.
  36. // svc := snowball.New(mySession)
  37. //
  38. // // Create a Snowball client with additional configuration
  39. // svc := snowball.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  40. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Snowball {
  41. c := p.ClientConfig(ServiceName, cfgs...)
  42. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  43. }
  44. // newClient creates, initializes and returns a new service client instance.
  45. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *Snowball {
  46. svc := &Snowball{
  47. Client: client.New(
  48. cfg,
  49. metadata.ClientInfo{
  50. ServiceName: ServiceName,
  51. SigningRegion: signingRegion,
  52. Endpoint: endpoint,
  53. APIVersion: "2016-06-30",
  54. JSONVersion: "1.1",
  55. TargetPrefix: "AWSIESnowballJobManagementService",
  56. },
  57. handlers,
  58. ),
  59. }
  60. // Handlers
  61. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  62. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  63. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  64. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  65. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  66. // Run custom client initialization if present
  67. if initClient != nil {
  68. initClient(svc.Client)
  69. }
  70. return svc
  71. }
  72. // newRequest creates a new request for a Snowball operation and runs any
  73. // custom request initialization.
  74. func (c *Snowball) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  75. req := c.NewRequest(op, params, data)
  76. // Run custom request initialization if present
  77. if initRequest != nil {
  78. initRequest(req)
  79. }
  80. return req
  81. }