service.go 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cognitoidentityprovider
  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. // Using the Amazon Cognito Your User Pools API, you can create a user pool
  12. // to manage directories and users. You can authenticate a user to obtain tokens
  13. // related to user identity and access policies.
  14. //
  15. // This API reference provides information about user pools in Amazon Cognito
  16. // Your User Pools.
  17. //
  18. // For more information, see the Amazon Cognito Documentation.
  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 CognitoIdentityProvider 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 = "cognito-idp"
  30. // New creates a new instance of the CognitoIdentityProvider 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 CognitoIdentityProvider client from just a session.
  36. // svc := cognitoidentityprovider.New(mySession)
  37. //
  38. // // Create a CognitoIdentityProvider client with additional configuration
  39. // svc := cognitoidentityprovider.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  40. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoIdentityProvider {
  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) *CognitoIdentityProvider {
  46. svc := &CognitoIdentityProvider{
  47. Client: client.New(
  48. cfg,
  49. metadata.ClientInfo{
  50. ServiceName: ServiceName,
  51. SigningRegion: signingRegion,
  52. Endpoint: endpoint,
  53. APIVersion: "2016-04-18",
  54. JSONVersion: "1.1",
  55. TargetPrefix: "AWSCognitoIdentityProviderService",
  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 CognitoIdentityProvider operation and runs any
  73. // custom request initialization.
  74. func (c *CognitoIdentityProvider) 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. }