service.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudhsm
  3. import (
  4. "github.com/aws/aws-sdk-go/aws"
  5. "github.com/aws/aws-sdk-go/aws/defaults"
  6. "github.com/aws/aws-sdk-go/aws/request"
  7. "github.com/aws/aws-sdk-go/aws/service"
  8. "github.com/aws/aws-sdk-go/aws/service/serviceinfo"
  9. "github.com/aws/aws-sdk-go/internal/protocol/jsonrpc"
  10. "github.com/aws/aws-sdk-go/internal/signer/v4"
  11. )
  12. type CloudHSM struct {
  13. *service.Service
  14. }
  15. // Used for custom service initialization logic
  16. var initService func(*service.Service)
  17. // Used for custom request initialization logic
  18. var initRequest func(*request.Request)
  19. // New returns a new CloudHSM client.
  20. func New(config *aws.Config) *CloudHSM {
  21. service := &service.Service{
  22. ServiceInfo: serviceinfo.ServiceInfo{
  23. Config: defaults.DefaultConfig.Merge(config),
  24. ServiceName: "cloudhsm",
  25. APIVersion: "2014-05-30",
  26. JSONVersion: "1.1",
  27. TargetPrefix: "CloudHsmFrontendService",
  28. },
  29. }
  30. service.Initialize()
  31. // Handlers
  32. service.Handlers.Sign.PushBack(v4.Sign)
  33. service.Handlers.Build.PushBack(jsonrpc.Build)
  34. service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
  35. service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
  36. service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)
  37. // Run custom service initialization if present
  38. if initService != nil {
  39. initService(service)
  40. }
  41. return &CloudHSM{service}
  42. }
  43. // newRequest creates a new request for a CloudHSM operation and runs any
  44. // custom request initialization.
  45. func (c *CloudHSM) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  46. req := c.NewRequest(op, params, data)
  47. // Run custom request initialization if present
  48. if initRequest != nil {
  49. initRequest(req)
  50. }
  51. return req
  52. }