本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/api/resources.SpaceResource类的典型用法代码示例。如果您正苦于以下问题:Golang SpaceResource类的具体用法?Golang SpaceResource怎么用?Golang SpaceResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SpaceResource类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: Create
func (repo CloudControllerSpaceRepository) Create(name string, orgGuid string) (space models.Space, apiErr error) {
path := fmt.Sprintf("%s/v2/spaces?inline-relations-depth=1", repo.config.ApiEndpoint())
body := fmt.Sprintf(`{"name":"%s","organization_guid":"%s"}`, name, orgGuid)
resource := new(resources.SpaceResource)
apiErr = repo.gateway.CreateResource(path, strings.NewReader(body), resource)
if apiErr != nil {
return
}
space = resource.ToModel()
return
}
开发者ID:Jack1996,项目名称:cli,代码行数:11,代码来源:spaces.go
示例2: Create
func (repo CloudControllerSpaceRepository) Create(name, orgGuid, spaceQuotaGuid string) (space models.Space, apiErr error) {
path := "/v2/spaces?inline-relations-depth=1"
bodyMap := map[string]string{"name": name, "organization_guid": orgGuid}
if spaceQuotaGuid != "" {
bodyMap["space_quota_definition_guid"] = spaceQuotaGuid
}
body, apiErr := json.Marshal(bodyMap)
if apiErr != nil {
return
}
resource := new(resources.SpaceResource)
apiErr = repo.gateway.CreateResource(repo.config.ApiEndpoint(), path, strings.NewReader(string(body)), resource)
if apiErr != nil {
return
}
space = resource.ToModel()
return
}
开发者ID:tools-alexuser01,项目名称:cli,代码行数:21,代码来源:spaces.go
示例3: Create
func (repo CloudControllerSpaceRepository) Create(name, orgGUID, spaceQuotaGUID string) (models.Space, error) {
var space models.Space
path := "/v2/spaces?inline-relations-depth=1"
bodyMap := map[string]string{"name": name, "organization_guid": orgGUID}
if spaceQuotaGUID != "" {
bodyMap["space_quota_definition_guid"] = spaceQuotaGUID
}
body, err := json.Marshal(bodyMap)
if err != nil {
return models.Space{}, err
}
resource := new(resources.SpaceResource)
err = repo.gateway.CreateResource(repo.config.APIEndpoint(), path, strings.NewReader(string(body)), resource)
if err != nil {
return models.Space{}, err
}
space = resource.ToModel()
return space, nil
}
开发者ID:jsloyer,项目名称:cli,代码行数:22,代码来源:spaces.go
注:本文中的github.com/cloudfoundry/cli/cf/api/resources.SpaceResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论