service.go 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package cloudtrail
  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. // This is the CloudTrail API Reference. It provides descriptions of actions,
  13. // data types, common parameters, and common errors for CloudTrail.
  14. //
  15. // CloudTrail is a web service that records AWS API calls for your AWS account
  16. // and delivers log files to an Amazon S3 bucket. The recorded information includes
  17. // the identity of the user, the start time of the AWS API call, the source
  18. // IP address, the request parameters, and the response elements returned by
  19. // the service.
  20. //
  21. // As an alternative to using the API, you can use one of the AWS SDKs, which
  22. // consist of libraries and sample code for various programming languages and
  23. // platforms (Java, Ruby, .NET, iOS, Android, etc.). The SDKs provide a convenient
  24. // way to create programmatic access to AWSCloudTrail. For example, the SDKs
  25. // take care of cryptographically signing requests, managing errors, and retrying
  26. // requests automatically. For information about the AWS SDKs, including how
  27. // to download and install them, see the Tools for Amazon Web Services page
  28. // (http://aws.amazon.com/tools/). See the CloudTrail User Guide for information
  29. // about the data that is included with each AWS API call listed in the log
  30. // files.
  31. type CloudTrail struct {
  32. *service.Service
  33. }
  34. // Used for custom service initialization logic
  35. var initService func(*service.Service)
  36. // Used for custom request initialization logic
  37. var initRequest func(*request.Request)
  38. // New returns a new CloudTrail client.
  39. func New(config *aws.Config) *CloudTrail {
  40. service := &service.Service{
  41. ServiceInfo: serviceinfo.ServiceInfo{
  42. Config: defaults.DefaultConfig.Merge(config),
  43. ServiceName: "cloudtrail",
  44. APIVersion: "2013-11-01",
  45. JSONVersion: "1.1",
  46. TargetPrefix: "com.amazonaws.cloudtrail.v20131101.CloudTrail_20131101",
  47. },
  48. }
  49. service.Initialize()
  50. // Handlers
  51. service.Handlers.Sign.PushBack(v4.Sign)
  52. service.Handlers.Build.PushBack(jsonrpc.Build)
  53. service.Handlers.Unmarshal.PushBack(jsonrpc.Unmarshal)
  54. service.Handlers.UnmarshalMeta.PushBack(jsonrpc.UnmarshalMeta)
  55. service.Handlers.UnmarshalError.PushBack(jsonrpc.UnmarshalError)
  56. // Run custom service initialization if present
  57. if initService != nil {
  58. initService(service)
  59. }
  60. return &CloudTrail{service}
  61. }
  62. // newRequest creates a new request for a CloudTrail operation and runs any
  63. // custom request initialization.
  64. func (c *CloudTrail) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  65. req := c.NewRequest(op, params, data)
  66. // Run custom request initialization if present
  67. if initRequest != nil {
  68. initRequest(req)
  69. }
  70. return req
  71. }