本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/codecommit.CodeCommit類的典型用法代碼示例。如果您正苦於以下問題:Golang CodeCommit類的具體用法?Golang CodeCommit怎麽用?Golang CodeCommit使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了CodeCommit類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: resourceAwsCodeCommitUpdateDefaultBranch
func resourceAwsCodeCommitUpdateDefaultBranch(conn *codecommit.CodeCommit, d *schema.ResourceData) error {
input := &codecommit.ListBranchesInput{
RepositoryName: aws.String(d.Id()),
}
out, err := conn.ListBranches(input)
if err != nil {
return fmt.Errorf("Error reading CodeCommit Repository branches: %s", err.Error())
}
if len(out.Branches) == 0 {
log.Printf("[WARN] Not setting Default Branch CodeCommit Repository that has no branches: %s", d.Id())
return nil
}
branchInput := &codecommit.UpdateDefaultBranchInput{
RepositoryName: aws.String(d.Id()),
DefaultBranchName: aws.String(d.Get("default_branch").(string)),
}
_, err = conn.UpdateDefaultBranch(branchInput)
if err != nil {
return fmt.Errorf("Error Updating Default Branch for CodeCommit Repository: %s", err.Error())
}
return nil
}
示例2: resourceAwsCodeCommitUpdateDescription
func resourceAwsCodeCommitUpdateDescription(conn *codecommit.CodeCommit, d *schema.ResourceData) error {
branchInput := &codecommit.UpdateRepositoryDescriptionInput{
RepositoryName: aws.String(d.Id()),
RepositoryDescription: aws.String(d.Get("description").(string)),
}
_, err := conn.UpdateRepositoryDescription(branchInput)
if err != nil {
return fmt.Errorf("Error Updating Repository Description for CodeCommit Repository: %s", err.Error())
}
return nil
}
示例3: resourceAwsCodeCommitUpdateDefaultBranch
func resourceAwsCodeCommitUpdateDefaultBranch(conn *codecommit.CodeCommit, d *schema.ResourceData) error {
branchInput := &codecommit.UpdateDefaultBranchInput{
RepositoryName: aws.String(d.Id()),
DefaultBranchName: aws.String(d.Get("default_branch").(string)),
}
_, err := conn.UpdateDefaultBranch(branchInput)
if err != nil {
return fmt.Errorf("Error Updating Default Branch for CodeCommit Repository: %s", err.Error())
}
return nil
}