service.go 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudsearchdomain
  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. // You use the AmazonCloudSearch2013 API to upload documents to a search domain
  12. // and search those documents.
  13. //
  14. // The endpoints for submitting UploadDocuments, Search, and Suggest requests
  15. // are domain-specific. To get the endpoints for your domain, use the Amazon
  16. // CloudSearch configuration service DescribeDomains action. The domain endpoints
  17. // are also displayed on the domain dashboard in the Amazon CloudSearch console.
  18. // You submit suggest requests to the search endpoint.
  19. //
  20. // For more information, see the Amazon CloudSearch Developer Guide (http://docs.aws.amazon.com/cloudsearch/latest/developerguide).
  21. //The service client's operations are safe to be used concurrently.
  22. // It is not safe to mutate any of the client's properties though.
  23. type CloudSearchDomain struct {
  24. *client.Client
  25. }
  26. // Used for custom client initialization logic
  27. var initClient func(*client.Client)
  28. // Used for custom request initialization logic
  29. var initRequest func(*request.Request)
  30. // A ServiceName is the name of the service the client will make API calls to.
  31. const ServiceName = "cloudsearchdomain"
  32. // New creates a new instance of the CloudSearchDomain client with a session.
  33. // If additional configuration is needed for the client instance use the optional
  34. // aws.Config parameter to add your extra config.
  35. //
  36. // Example:
  37. // // Create a CloudSearchDomain client from just a session.
  38. // svc := cloudsearchdomain.New(mySession)
  39. //
  40. // // Create a CloudSearchDomain client with additional configuration
  41. // svc := cloudsearchdomain.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  42. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearchDomain {
  43. c := p.ClientConfig(ServiceName, cfgs...)
  44. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  45. }
  46. // newClient creates, initializes and returns a new service client instance.
  47. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CloudSearchDomain {
  48. svc := &CloudSearchDomain{
  49. Client: client.New(
  50. cfg,
  51. metadata.ClientInfo{
  52. ServiceName: ServiceName,
  53. SigningName: "cloudsearch",
  54. SigningRegion: signingRegion,
  55. Endpoint: endpoint,
  56. APIVersion: "2013-01-01",
  57. },
  58. handlers,
  59. ),
  60. }
  61. // Handlers
  62. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  63. svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
  64. svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
  65. svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
  66. svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
  67. // Run custom client initialization if present
  68. if initClient != nil {
  69. initClient(svc.Client)
  70. }
  71. return svc
  72. }
  73. // newRequest creates a new request for a CloudSearchDomain operation and runs any
  74. // custom request initialization.
  75. func (c *CloudSearchDomain) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  76. req := c.NewRequest(op, params, data)
  77. // Run custom request initialization if present
  78. if initRequest != nil {
  79. initRequest(req)
  80. }
  81. return req
  82. }