examples_test.go 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
  2. package codecommit_test
  3. import (
  4. "bytes"
  5. "fmt"
  6. "time"
  7. "github.com/aws/aws-sdk-go/aws"
  8. "github.com/aws/aws-sdk-go/service/codecommit"
  9. )
  10. var _ time.Duration
  11. var _ bytes.Buffer
  12. func ExampleCodeCommit_BatchGetRepositories() {
  13. svc := codecommit.New(nil)
  14. params := &codecommit.BatchGetRepositoriesInput{
  15. RepositoryNames: []*string{ // Required
  16. aws.String("RepositoryName"), // Required
  17. // More values...
  18. },
  19. }
  20. resp, err := svc.BatchGetRepositories(params)
  21. if err != nil {
  22. // Print the error, cast err to awserr.Error to get the Code and
  23. // Message from an error.
  24. fmt.Println(err.Error())
  25. return
  26. }
  27. // Pretty-print the response data.
  28. fmt.Println(resp)
  29. }
  30. func ExampleCodeCommit_CreateBranch() {
  31. svc := codecommit.New(nil)
  32. params := &codecommit.CreateBranchInput{
  33. BranchName: aws.String("BranchName"), // Required
  34. CommitId: aws.String("CommitId"), // Required
  35. RepositoryName: aws.String("RepositoryName"), // Required
  36. }
  37. resp, err := svc.CreateBranch(params)
  38. if err != nil {
  39. // Print the error, cast err to awserr.Error to get the Code and
  40. // Message from an error.
  41. fmt.Println(err.Error())
  42. return
  43. }
  44. // Pretty-print the response data.
  45. fmt.Println(resp)
  46. }
  47. func ExampleCodeCommit_CreateRepository() {
  48. svc := codecommit.New(nil)
  49. params := &codecommit.CreateRepositoryInput{
  50. RepositoryName: aws.String("RepositoryName"), // Required
  51. RepositoryDescription: aws.String("RepositoryDescription"),
  52. }
  53. resp, err := svc.CreateRepository(params)
  54. if err != nil {
  55. // Print the error, cast err to awserr.Error to get the Code and
  56. // Message from an error.
  57. fmt.Println(err.Error())
  58. return
  59. }
  60. // Pretty-print the response data.
  61. fmt.Println(resp)
  62. }
  63. func ExampleCodeCommit_DeleteRepository() {
  64. svc := codecommit.New(nil)
  65. params := &codecommit.DeleteRepositoryInput{
  66. RepositoryName: aws.String("RepositoryName"), // Required
  67. }
  68. resp, err := svc.DeleteRepository(params)
  69. if err != nil {
  70. // Print the error, cast err to awserr.Error to get the Code and
  71. // Message from an error.
  72. fmt.Println(err.Error())
  73. return
  74. }
  75. // Pretty-print the response data.
  76. fmt.Println(resp)
  77. }
  78. func ExampleCodeCommit_GetBranch() {
  79. svc := codecommit.New(nil)
  80. params := &codecommit.GetBranchInput{
  81. BranchName: aws.String("BranchName"),
  82. RepositoryName: aws.String("RepositoryName"),
  83. }
  84. resp, err := svc.GetBranch(params)
  85. if err != nil {
  86. // Print the error, cast err to awserr.Error to get the Code and
  87. // Message from an error.
  88. fmt.Println(err.Error())
  89. return
  90. }
  91. // Pretty-print the response data.
  92. fmt.Println(resp)
  93. }
  94. func ExampleCodeCommit_GetRepository() {
  95. svc := codecommit.New(nil)
  96. params := &codecommit.GetRepositoryInput{
  97. RepositoryName: aws.String("RepositoryName"), // Required
  98. }
  99. resp, err := svc.GetRepository(params)
  100. if err != nil {
  101. // Print the error, cast err to awserr.Error to get the Code and
  102. // Message from an error.
  103. fmt.Println(err.Error())
  104. return
  105. }
  106. // Pretty-print the response data.
  107. fmt.Println(resp)
  108. }
  109. func ExampleCodeCommit_ListBranches() {
  110. svc := codecommit.New(nil)
  111. params := &codecommit.ListBranchesInput{
  112. RepositoryName: aws.String("RepositoryName"), // Required
  113. NextToken: aws.String("NextToken"),
  114. }
  115. resp, err := svc.ListBranches(params)
  116. if err != nil {
  117. // Print the error, cast err to awserr.Error to get the Code and
  118. // Message from an error.
  119. fmt.Println(err.Error())
  120. return
  121. }
  122. // Pretty-print the response data.
  123. fmt.Println(resp)
  124. }
  125. func ExampleCodeCommit_ListRepositories() {
  126. svc := codecommit.New(nil)
  127. params := &codecommit.ListRepositoriesInput{
  128. NextToken: aws.String("NextToken"),
  129. Order: aws.String("OrderEnum"),
  130. SortBy: aws.String("SortByEnum"),
  131. }
  132. resp, err := svc.ListRepositories(params)
  133. if err != nil {
  134. // Print the error, cast err to awserr.Error to get the Code and
  135. // Message from an error.
  136. fmt.Println(err.Error())
  137. return
  138. }
  139. // Pretty-print the response data.
  140. fmt.Println(resp)
  141. }
  142. func ExampleCodeCommit_UpdateDefaultBranch() {
  143. svc := codecommit.New(nil)
  144. params := &codecommit.UpdateDefaultBranchInput{
  145. DefaultBranchName: aws.String("BranchName"), // Required
  146. RepositoryName: aws.String("RepositoryName"), // Required
  147. }
  148. resp, err := svc.UpdateDefaultBranch(params)
  149. if err != nil {
  150. // Print the error, cast err to awserr.Error to get the Code and
  151. // Message from an error.
  152. fmt.Println(err.Error())
  153. return
  154. }
  155. // Pretty-print the response data.
  156. fmt.Println(resp)
  157. }
  158. func ExampleCodeCommit_UpdateRepositoryDescription() {
  159. svc := codecommit.New(nil)
  160. params := &codecommit.UpdateRepositoryDescriptionInput{
  161. RepositoryName: aws.String("RepositoryName"), // Required
  162. RepositoryDescription: aws.String("RepositoryDescription"),
  163. }
  164. resp, err := svc.UpdateRepositoryDescription(params)
  165. if err != nil {
  166. // Print the error, cast err to awserr.Error to get the Code and
  167. // Message from an error.
  168. fmt.Println(err.Error())
  169. return
  170. }
  171. // Pretty-print the response data.
  172. fmt.Println(resp)
  173. }
  174. func ExampleCodeCommit_UpdateRepositoryName() {
  175. svc := codecommit.New(nil)
  176. params := &codecommit.UpdateRepositoryNameInput{
  177. NewName: aws.String("RepositoryName"), // Required
  178. OldName: aws.String("RepositoryName"), // Required
  179. }
  180. resp, err := svc.UpdateRepositoryName(params)
  181. if err != nil {
  182. // Print the error, cast err to awserr.Error to get the Code and
  183. // Message from an error.
  184. fmt.Println(err.Error())
  185. return
  186. }
  187. // Pretty-print the response data.
  188. fmt.Println(resp)
  189. }