service.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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. //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 CloudSearch 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 = "cloudsearch"
  30. // New creates a new instance of the CloudSearch 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 CloudSearch client from just a session.
  36. // svc := cloudsearch.New(mySession)
  37. //
  38. // // Create a CloudSearch client with additional configuration
  39. // svc := cloudsearch.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  40. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearch {
  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) *CloudSearch {
  46. svc := &CloudSearch{
  47. Client: client.New(
  48. cfg,
  49. metadata.ClientInfo{
  50. ServiceName: ServiceName,
  51. SigningRegion: signingRegion,
  52. Endpoint: endpoint,
  53. APIVersion: "2013-01-01",
  54. },
  55. handlers,
  56. ),
  57. }
  58. // Handlers
  59. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  60. svc.Handlers.Build.PushBackNamed(query.BuildHandler)
  61. svc.Handlers.Unmarshal.PushBackNamed(query.UnmarshalHandler)
  62. svc.Handlers.UnmarshalMeta.PushBackNamed(query.UnmarshalMetaHandler)
  63. svc.Handlers.UnmarshalError.PushBackNamed(query.UnmarshalErrorHandler)
  64. // Run custom client initialization if present
  65. if initClient != nil {
  66. initClient(svc.Client)
  67. }
  68. return svc
  69. }
  70. // newRequest creates a new request for a CloudSearch operation and runs any
  71. // custom request initialization.
  72. func (c *CloudSearch) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  73. req := c.NewRequest(op, params, data)
  74. // Run custom request initialization if present
  75. if initRequest != nil {
  76. initRequest(req)
  77. }
  78. return req
  79. }