本文整理汇总了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
}