service.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
  2. package chime
  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/restjson"
  10. )
  11. // Chime provides the API operation methods for making requests to
  12. // Amazon Chime. See this package's package overview docs
  13. // for details on the service.
  14. //
  15. // Chime methods are safe to use concurrently. It is not safe to
  16. // modify mutate any of the struct's properties though.
  17. type Chime struct {
  18. *client.Client
  19. }
  20. // Used for custom client initialization logic
  21. var initClient func(*client.Client)
  22. // Used for custom request initialization logic
  23. var initRequest func(*request.Request)
  24. // Service information constants
  25. const (
  26. ServiceName = "Chime" // Name of service.
  27. EndpointsID = "chime" // ID to lookup a service endpoint with.
  28. ServiceID = "Chime" // ServiceID is a unique identifer of a specific service.
  29. )
  30. // New creates a new instance of the Chime 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 Chime client from just a session.
  36. // svc := chime.New(mySession)
  37. //
  38. // // Create a Chime client with additional configuration
  39. // svc := chime.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  40. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Chime {
  41. c := p.ClientConfig(EndpointsID, cfgs...)
  42. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
  43. }
  44. // newClient creates, initializes and returns a new service client instance.
  45. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Chime {
  46. svc := &Chime{
  47. Client: client.New(
  48. cfg,
  49. metadata.ClientInfo{
  50. ServiceName: ServiceName,
  51. ServiceID: ServiceID,
  52. SigningName: signingName,
  53. SigningRegion: signingRegion,
  54. Endpoint: endpoint,
  55. APIVersion: "2018-05-01",
  56. },
  57. handlers,
  58. ),
  59. }
  60. // Handlers
  61. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  62. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  63. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  64. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  65. svc.Handlers.UnmarshalError.PushBackNamed(restjson.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 Chime operation and runs any
  73. // custom request initialization.
  74. func (c *Chime) 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. }