service.go 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudsearch
  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/query"
  10. )
  11. // You use the Amazon CloudSearch configuration service to create, configure,
  12. // and manage search domains. Configuration service requests are submitted using
  13. // the AWS Query protocol. AWS Query requests are HTTP or HTTPS requests submitted
  14. // via HTTP GET or POST with a query parameter named Action.
  15. //
  16. // The endpoint for configuration service requests is region-specific: cloudsearch.region.amazonaws.com.
  17. // For example, cloudsearch.us-east-1.amazonaws.com. For a current list of supported
  18. // regions and endpoints, see Regions and Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#cloudsearch_region"
  19. // target="_blank).
  20. //The service client's operations are safe to be used concurrently.
  21. // It is not safe to mutate any of the client's properties though.
  22. type CloudSearch struct {
  23. *client.Client
  24. }
  25. // Used for custom client initialization logic
  26. var initClient func(*client.Client)
  27. // Used for custom request initialization logic
  28. var initRequest func(*request.Request)
  29. // A ServiceName is the name of the service the client will make API calls to.
  30. const ServiceName = "cloudsearch"
  31. // New creates a new instance of the CloudSearch client with a session.
  32. // If additional configuration is needed for the client instance use the optional
  33. // aws.Config parameter to add your extra config.
  34. //
  35. // Example:
  36. // // Create a CloudSearch client from just a session.
  37. // svc := cloudsearch.New(mySession)
  38. //
  39. // // Create a CloudSearch client with additional configuration
  40. // svc := cloudsearch.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  41. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearch {
  42. c := p.ClientConfig(ServiceName, cfgs...)
  43. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  44. }
  45. // newClient creates, initializes and returns a new service client instance.
  46. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudSearch {
  47. svc := &CloudSearch{
  48. Client: client.New(
  49. cfg,
  50. metadata.ClientInfo{
  51. ServiceName: ServiceName,
  52. SigningRegion: signingRegion,
  53. Endpoint: endpoint,
  54. APIVersion: "2013-01-01",
  55. },
  56. handlers,
  57. ),
  58. }
  59. // Handlers
  60. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  61. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  62. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  63. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  64. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  65. // Run custom client initialization if present
  66. if initClient != nil {
  67. initClient(svc.Client)
  68. }
  69. return svc
  70. }
  71. // newRequest creates a new request for a CloudSearch operation and runs any
  72. // custom request initialization.
  73. func (c *CloudSearch) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  74. req := c.NewRequest(op, params, data)
  75. // Run custom request initialization if present
  76. if initRequest != nil {
  77. initRequest(req)
  78. }
  79. return req
  80. }