本文整理匯總了Golang中github.com/pivotal-cf-experimental/bosh-test/bosh.Client.Deployments方法的典型用法代碼示例。如果您正苦於以下問題:Golang Client.Deployments方法的具體用法?Golang Client.Deployments怎麽用?Golang Client.Deployments使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/pivotal-cf-experimental/bosh-test/bosh.Client
的用法示例。
在下文中一共展示了Client.Deployments方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: VerifyDeploymentRelease
func VerifyDeploymentRelease(client bosh.Client, deploymentName string, releaseVersion string) (err error) {
deployments, err := client.Deployments()
if err != nil {
return
}
for _, deployment := range deployments {
if deployment.Name == deploymentName {
for _, release := range deployment.Releases {
if release.Name == "consul" {
switch {
case len(release.Versions) > 1:
err = errors.New("too many releases")
case len(release.Versions) == 1 && release.Versions[0] != releaseVersion:
err = fmt.Errorf("expected consul-release version %q but got %q", releaseVersion, release.Versions[0])
}
}
}
}
}
return
}
示例2:
Expect(err).NotTo(HaveOccurred())
config, err = helpers.LoadConfig(configPath)
Expect(err).NotTo(HaveOccurred())
client = bosh.NewClient(bosh.Config{
URL: fmt.Sprintf("https://%s:25555", config.BOSH.Target),
Username: config.BOSH.Username,
Password: config.BOSH.Password,
AllowInsecureSSL: true,
})
})
var _ = Describe("precheck", func() {
It("confirms that there are no conflicting deployments", func() {
deployments, err := client.Deployments()
Expect(err).NotTo(HaveOccurred())
for _, deployment := range deployments {
for _, name := range []string{"consul", "turbulence-consul"} {
ok, err := MatchRegexp(fmt.Sprintf("%s-\\w{8}-\\w{4}-\\w{4}-\\w{4}-\\w{12}", name)).Match(deployment.Name)
if err != nil {
Fail(err.Error())
}
if ok {
Fail(fmt.Sprintf("existing deployment %s", deployment.Name))
}
}
}
})