当前位置: 首页>>代码示例>>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;未经允许,请勿转载。