當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Client.Deployments方法代碼示例

本文整理匯總了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
}
開發者ID:cloudfoundry-incubator,項目名稱:consul-release,代碼行數:23,代碼來源:deploy_consul.go

示例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))
				}
			}
		}
	})
開發者ID:tkysk,項目名稱:consul-release,代碼行數:31,代碼來源:precheck_test.go


注:本文中的github.com/pivotal-cf-experimental/bosh-test/bosh.Client.Deployments方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。