123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package codecommit_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/aws/session"
- "github.com/aws/aws-sdk-go/service/codecommit"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleCodeCommit_BatchGetRepositories() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.BatchGetRepositoriesInput{
- RepositoryNames: []*string{ // Required
- aws.String("RepositoryName"), // Required
- // More values...
- },
- }
- resp, err := svc.BatchGetRepositories(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_CreateBranch() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.CreateBranchInput{
- BranchName: aws.String("BranchName"), // Required
- CommitId: aws.String("CommitId"), // Required
- RepositoryName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.CreateBranch(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_CreateRepository() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.CreateRepositoryInput{
- RepositoryName: aws.String("RepositoryName"), // Required
- RepositoryDescription: aws.String("RepositoryDescription"),
- }
- resp, err := svc.CreateRepository(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_DeleteRepository() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.DeleteRepositoryInput{
- RepositoryName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.DeleteRepository(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_GetBranch() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.GetBranchInput{
- BranchName: aws.String("BranchName"),
- RepositoryName: aws.String("RepositoryName"),
- }
- resp, err := svc.GetBranch(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_GetCommit() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.GetCommitInput{
- CommitId: aws.String("ObjectId"), // Required
- RepositoryName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.GetCommit(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_GetRepository() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.GetRepositoryInput{
- RepositoryName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.GetRepository(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_GetRepositoryTriggers() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.GetRepositoryTriggersInput{
- RepositoryName: aws.String("RepositoryName"),
- }
- resp, err := svc.GetRepositoryTriggers(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_ListBranches() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.ListBranchesInput{
- RepositoryName: aws.String("RepositoryName"), // Required
- NextToken: aws.String("NextToken"),
- }
- resp, err := svc.ListBranches(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_ListRepositories() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.ListRepositoriesInput{
- NextToken: aws.String("NextToken"),
- Order: aws.String("OrderEnum"),
- SortBy: aws.String("SortByEnum"),
- }
- resp, err := svc.ListRepositories(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_PutRepositoryTriggers() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.PutRepositoryTriggersInput{
- RepositoryName: aws.String("RepositoryName"),
- Triggers: []*codecommit.RepositoryTrigger{
- { // Required
- Branches: []*string{
- aws.String("BranchName"), // Required
- // More values...
- },
- CustomData: aws.String("RepositoryTriggerCustomData"),
- DestinationArn: aws.String("Arn"),
- Events: []*string{
- aws.String("RepositoryTriggerEventEnum"), // Required
- // More values...
- },
- Name: aws.String("RepositoryTriggerName"),
- },
- // More values...
- },
- }
- resp, err := svc.PutRepositoryTriggers(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_TestRepositoryTriggers() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.TestRepositoryTriggersInput{
- RepositoryName: aws.String("RepositoryName"),
- Triggers: []*codecommit.RepositoryTrigger{
- { // Required
- Branches: []*string{
- aws.String("BranchName"), // Required
- // More values...
- },
- CustomData: aws.String("RepositoryTriggerCustomData"),
- DestinationArn: aws.String("Arn"),
- Events: []*string{
- aws.String("RepositoryTriggerEventEnum"), // Required
- // More values...
- },
- Name: aws.String("RepositoryTriggerName"),
- },
- // More values...
- },
- }
- resp, err := svc.TestRepositoryTriggers(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_UpdateDefaultBranch() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.UpdateDefaultBranchInput{
- DefaultBranchName: aws.String("BranchName"), // Required
- RepositoryName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.UpdateDefaultBranch(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_UpdateRepositoryDescription() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.UpdateRepositoryDescriptionInput{
- RepositoryName: aws.String("RepositoryName"), // Required
- RepositoryDescription: aws.String("RepositoryDescription"),
- }
- resp, err := svc.UpdateRepositoryDescription(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
- func ExampleCodeCommit_UpdateRepositoryName() {
- sess, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- svc := codecommit.New(sess)
- params := &codecommit.UpdateRepositoryNameInput{
- NewName: aws.String("RepositoryName"), // Required
- OldName: aws.String("RepositoryName"), // Required
- }
- resp, err := svc.UpdateRepositoryName(params)
- if err != nil {
- // Print the error, cast err to awserr.Error to get the Code and
- // Message from an error.
- fmt.Println(err.Error())
- return
- }
- // Pretty-print the response data.
- fmt.Println(resp)
- }
|