service.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package codecommit
  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. // This is the AWS CodeCommit API Reference. This reference provides descriptions
  12. // of the operations and data types for AWS CodeCommit API.
  13. //
  14. // You can use the AWS CodeCommit API to work with the following objects:
  15. //
  16. // * Repositories, by calling the following: BatchGetRepositories, which
  17. // returns information about one or more repositories associated with your
  18. // AWS account
  19. // CreateRepository, which creates an AWS CodeCommit repository
  20. // DeleteRepository, which deletes an AWS CodeCommit repository
  21. // GetRepository, which returns information about a specified repository
  22. // ListRepositories, which lists all AWS CodeCommit repositories associated
  23. // with your AWS account
  24. // UpdateRepositoryDescription, which sets or updates the description of the
  25. // repository
  26. // UpdateRepositoryName, which changes the name of the repository. If you change
  27. // the name of a repository, no other users of that repository will be able
  28. // to access it until you send them the new HTTPS or SSH URL to use.
  29. //
  30. // * Branches, by calling the following: CreateBranch, which creates a new
  31. // branch in a specified repository
  32. // GetBranch, which returns information about a specified branch
  33. // ListBranches, which lists all branches for a specified repository
  34. // UpdateDefaultBranch, which changes the default branch for a repository
  35. //
  36. // * Information about committed code in a repository, by calling the following:
  37. // GetCommit, which returns information about a commit, including commit
  38. // messages and committer information.
  39. //
  40. // * Triggers, by calling the following: GetRepositoryTriggers, which returns
  41. // information about triggers configured for a repository
  42. // PutRepositoryTriggers, which replaces all triggers for a repository and can
  43. // be used to create or delete triggers
  44. // TestRepositoryTriggers, which tests the functionality of a repository trigger
  45. // by sending data to the trigger target
  46. //
  47. // For information about how to use AWS CodeCommit, see the AWS CodeCommit User
  48. // Guide (http://docs.aws.amazon.com/codecommit/latest/userguide/welcome.html).
  49. //The service client's operations are safe to be used concurrently.
  50. // It is not safe to mutate any of the client's properties though.
  51. type CodeCommit struct {
  52. *client.Client
  53. }
  54. // Used for custom client initialization logic
  55. var initClient func(*client.Client)
  56. // Used for custom request initialization logic
  57. var initRequest func(*request.Request)
  58. // A ServiceName is the name of the service the client will make API calls to.
  59. const ServiceName = "codecommit"
  60. // New creates a new instance of the CodeCommit client with a session.
  61. // If additional configuration is needed for the client instance use the optional
  62. // aws.Config parameter to add your extra config.
  63. //
  64. // Example:
  65. // // Create a CodeCommit client from just a session.
  66. // svc := codecommit.New(mySession)
  67. //
  68. // // Create a CodeCommit client with additional configuration
  69. // svc := codecommit.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
  70. func New(p client.ConfigProvider, cfgs ...*aws.Config) *CodeCommit {
  71. c := p.ClientConfig(ServiceName, cfgs...)
  72. return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion)
  73. }
  74. // newClient creates, initializes and returns a new service client instance.
  75. func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion string) *CodeCommit {
  76. svc := &CodeCommit{
  77. Client: client.New(
  78. cfg,
  79. metadata.ClientInfo{
  80. ServiceName: ServiceName,
  81. SigningRegion: signingRegion,
  82. Endpoint: endpoint,
  83. APIVersion: "2015-04-13",
  84. JSONVersion: "1.1",
  85. TargetPrefix: "CodeCommit_20150413",
  86. },
  87. handlers,
  88. ),
  89. }
  90. // Handlers
  91. svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
  92. svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
  93. svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
  94. svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
  95. svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
  96. // Run custom client initialization if present
  97. if initClient != nil {
  98. initClient(svc.Client)
  99. }
  100. return svc
  101. }
  102. // newRequest creates a new request for a CodeCommit operation and runs any
  103. // custom request initialization.
  104. func (c *CodeCommit) newRequest(op *request.Operation, params, data interface{}) *request.Request {
  105. req := c.NewRequest(op, params, data)
  106. // Run custom request initialization if present
  107. if initRequest != nil {
  108. initRequest(req)
  109. }
  110. return req
  111. }