service.go 4.7 KB

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