本文整理汇总了Golang中github.com/cloudfoundry/cli/cf/models.ServicePlanFields类的典型用法代码示例。如果您正苦于以下问题:Golang ServicePlanFields类的具体用法?Golang ServicePlanFields怎么用?Golang ServicePlanFields使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServicePlanFields类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: ToModels
func (resource ServiceInstancesSummaries) ToModels() (instances []models.ServiceInstance) {
for _, instanceSummary := range resource.ServiceInstances {
applicationNames := resource.findApplicationNamesForInstance(instanceSummary.Name)
planSummary := instanceSummary.ServicePlan
servicePlan := models.ServicePlanFields{}
servicePlan.Name = planSummary.Name
servicePlan.GUID = planSummary.GUID
offeringSummary := planSummary.ServiceOffering
serviceOffering := models.ServiceOfferingFields{}
serviceOffering.Label = offeringSummary.Label
serviceOffering.Provider = offeringSummary.Provider
serviceOffering.Version = offeringSummary.Version
instance := models.ServiceInstance{}
instance.Name = instanceSummary.Name
instance.LastOperation.Type = instanceSummary.LastOperation.Type
instance.LastOperation.State = instanceSummary.LastOperation.State
instance.LastOperation.Description = instanceSummary.LastOperation.Description
instance.ApplicationNames = applicationNames
instance.ServicePlan = servicePlan
instance.ServiceOffering = serviceOffering
instances = append(instances, instance)
}
return
}
开发者ID:yingkitw,项目名称:cli,代码行数:29,代码来源:service_summary.go
示例2: ToModel
func (resource ServiceOfferingResource) ToModel() (offering models.ServiceOffering) {
offering.ServiceOfferingFields = resource.ToFields()
for _, p := range resource.Entity.ServicePlans {
servicePlan := models.ServicePlanFields{}
servicePlan.Name = p.Entity.Name
servicePlan.Guid = p.Metadata.Guid
offering.Plans = append(offering.Plans, servicePlan)
}
return offering
}
开发者ID:GABONIA,项目名称:cli,代码行数:10,代码来源:service_offerings.go
示例3: UpdatePlanAndOrgForService
func (actor ServicePlanHandler) UpdatePlanAndOrgForService(serviceName, planName, orgName string, setPlanVisibility bool) (PlanAccess, error) {
service, err := actor.serviceBuilder.GetServiceByName(serviceName)
if err != nil {
return PlanAccessError, err
}
org, err := actor.orgRepo.FindByName(orgName)
if err != nil {
return PlanAccessError, err
}
found := false
var servicePlan models.ServicePlanFields
for i, val := range service.Plans {
if val.Name == planName {
found = true
servicePlan = service.Plans[i]
}
}
if !found {
return PlanAccessError, errors.New(fmt.Sprintf("Service plan %s not found", planName))
}
if !servicePlan.Public && setPlanVisibility {
if servicePlan.OrgHasVisibility(orgName) {
return Limited, nil
}
// Enable service access
err = actor.servicePlanVisibilityRepo.Create(servicePlan.Guid, org.Guid)
if err != nil {
return PlanAccessError, err
}
} else if !servicePlan.Public && !setPlanVisibility {
// Disable service access
if servicePlan.OrgHasVisibility(org.Name) {
err = actor.deleteServicePlanVisibilities(map[string]string{"organization_guid": org.Guid, "service_plan_guid": servicePlan.Guid})
if err != nil {
return PlanAccessError, err
}
}
}
access := actor.findPlanAccess(servicePlan)
return access, nil
}
开发者ID:matanzit,项目名称:cli,代码行数:46,代码来源:services_plans.go
示例4:
userProvidedServiceInstanceRepo := &testapi.FakeUserProvidedServiceInstanceRepo{}
ui := callUpdateUserProvidedService(args, requirementsFactory, userProvidedServiceInstanceRepo)
Expect(userProvidedServiceInstanceRepo.UpdateServiceInstance).NotTo(Equal(serviceInstance))
Expect(ui.Outputs).To(ContainSubstrings(
[]string{"FAILED"},
[]string{"JSON is invalid"},
))
})
It("TestUpdateUserProvidedServiceWithAServiceInstanceThatIsNotUserProvided", func() {
args := []string{"-p", `{"foo":"bar"}`, "service-name"}
plan := models.ServicePlanFields{}
plan.Guid = "my-plan-guid"
serviceInstance := models.ServiceInstance{}
serviceInstance.Name = "found-service-name"
serviceInstance.ServicePlan = plan
requirementsFactory := &testreq.FakeReqFactory{
LoginSuccess: true,
ServiceInstance: serviceInstance,
}
userProvidedServiceInstanceRepo := &testapi.FakeUserProvidedServiceInstanceRepo{}
ui := callUpdateUserProvidedService(args, requirementsFactory, userProvidedServiceInstanceRepo)
Expect(userProvidedServiceInstanceRepo.UpdateServiceInstance).NotTo(Equal(serviceInstance))
开发者ID:palakmathur,项目名称:cli,代码行数:30,代码来源:update_user_provided_service_test.go
示例5:
requirementsFactory := &testreq.FakeReqFactory{LoginSuccess: true, TargetedSpaceSuccess: true}
ui := callShowService([]string{}, requirementsFactory)
Expect(ui.FailedWithUsage).To(BeTrue())
ui = callShowService([]string{"my-service"}, requirementsFactory)
Expect(ui.FailedWithUsage).To(BeFalse())
})
It("TestShowServiceOutput", func() {
offering := models.ServiceOfferingFields{}
offering.Label = "mysql"
offering.DocumentationUrl = "http://documentation.url"
offering.Description = "the-description"
plan := models.ServicePlanFields{}
plan.Guid = "plan-guid"
plan.Name = "plan-name"
serviceInstance := models.ServiceInstance{}
serviceInstance.Name = "service1"
serviceInstance.Guid = "service1-guid"
serviceInstance.ServicePlan = plan
serviceInstance.ServiceOffering = offering
requirementsFactory := &testreq.FakeReqFactory{
LoginSuccess: true,
TargetedSpaceSuccess: true,
ServiceInstance: serviceInstance,
}
ui := callShowService([]string{"service1"}, requirementsFactory)
开发者ID:palakmathur,项目名称:cli,代码行数:30,代码来源:service_test.go
注:本文中的github.com/cloudfoundry/cli/cf/models.ServicePlanFields类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论