service.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package inspector
  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. // Amazon Inspector enables you to analyze the behavior of your AWS resources
  12. // and to identify potential security issues. For more information, see Amazon
  13. // Inspector User Guide (http://docs.aws.amazon.com/inspector/latest/userguide/inspector_introduction.html).
  14. //The service client's operations are safe to be used concurrently.
  15. // It is not safe to mutate any of the client's properties though.
  16. type Inspector struct {
  17. *client.Client
  18. }
  19. // Used for custom client initialization logic
  20. var initClient func(*client.Client)
  21. // Used for custom request initialization logic
  22. var initRequest func(*request.Request)
  23. // A ServiceName is the name of the service the client will make API calls to.
  24. const ServiceName = "inspector"
  25. // New creates a new instance of the Inspector client with a session.
  26. // If additional configuration is needed for the client instance use the optional
  27. // aws.Config parameter to add your extra config.
  28. //
  29. // Example:
  30. // // Create a Inspector client from just a session.
  31. // svc := inspector.New(mySession)
  32. //
  33. // // Create a Inspector client with additional configuration
  34. // svc := inspector.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  35. func New(p client.ConfigProvider, cfgs ...*aws.Config) *Inspector {
  36. c := p.ClientConfig(ServiceName, cfgs...)
  37. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  38. }
  39. // newClient creates, initializes and returns a new service client instance.
  40. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *Inspector {
  41. svc := &Inspector{
  42. Client: client.New(
  43. cfg,
  44. metadata.ClientInfo{
  45. ServiceName: ServiceName,
  46. SigningRegion: signingRegion,
  47. Endpoint: endpoint,
  48. APIVersion: "2016-02-16",
  49. JSONVersion: "1.1",
  50. TargetPrefix: "InspectorService",
  51. },
  52. handlers,
  53. ),
  54. }
  55. // Handlers
  56. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  57. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  58. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  59. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  60. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  61. // Run custom client initialization if present
  62. if initClient != nil {
  63. initClient(svc.Client)
  64. }
  65. return svc
  66. }
  67. // newRequest creates a new request for a Inspector operation and runs any
  68. // custom request initialization.
  69. func (c *Inspector) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  70. req := c.NewRequest(op, params, data)
  71. // Run custom request initialization if present
  72. if initRequest != nil {
  73. initRequest(req)
  74. }
  75. return req
  76. }