本文整理汇总了Java中org.cloudfoundry.client.lib.domain.CloudServicePlan类的典型用法代码示例。如果您正苦于以下问题:Java CloudServicePlan类的具体用法?Java CloudServicePlan怎么用?Java CloudServicePlan使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudServicePlan类属于org.cloudfoundry.client.lib.domain包,在下文中一共展示了CloudServicePlan类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
@Override
public void createService(CloudService service) {
assertSpaceProvided("create service");
Assert.notNull(service, "Service must not be null");
Assert.notNull(service.getName(), "Service name must not be null");
Assert.notNull(service.getLabel(), "Service label must not be null");
Assert.notNull(service.getPlan(), "Service plan must not be null");
CloudServicePlan cloudServicePlan = findPlanForService(service);
HashMap<String, Object> serviceRequest = new HashMap<String, Object>();
serviceRequest.put("space_guid", sessionSpace.getMeta().getGuid());
serviceRequest.put("name", service.getName());
serviceRequest.put("service_plan_guid", cloudServicePlan.getMeta().getGuid());
getRestTemplate().postForObject(getUrl("/v2/service_instances"), serviceRequest, String.class);
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:17,代码来源:CloudControllerClientImpl.java
示例2: mapServiceOfferingResource
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private CloudServiceOffering mapServiceOfferingResource(Map<String, Object> resource) {
CloudServiceOffering cloudServiceOffering = new CloudServiceOffering(getMeta(resource),
getEntityAttribute(resource, "label", String.class), getEntityAttribute(resource, "provider", String.class),
getEntityAttribute(resource, "version", String.class), getEntityAttribute(resource, "description", String.class),
getEntityAttribute(resource, "active", Boolean.class), getEntityAttribute(resource, "bindable", Boolean.class),
getEntityAttribute(resource, "url", String.class), getEntityAttribute(resource, "info_url", String.class),
getEntityAttribute(resource, "unique_id", String.class), getEntityAttribute(resource, "extra", String.class),
getEntityAttribute(resource, "documentation_url", String.class));
List<Map<String, Object>> servicePlanList = getEmbeddedResourceList(getEntity(resource), "service_plans");
if (servicePlanList != null) {
for (Map<String, Object> servicePlanResource : servicePlanList) {
CloudServicePlan servicePlan = mapServicePlanResource(servicePlanResource);
servicePlan.setServiceOffering(cloudServiceOffering);
cloudServiceOffering.addCloudServicePlan(servicePlan);
}
}
return cloudServiceOffering;
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:19,代码来源:CloudEntityResourceMapper.java
示例3: createService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
public void createService(CloudFoundryOperations client, CloudServiceExtended service, String spaceId) {
if (CollectionUtils.isEmpty(service.getServiceAlternatives())) {
createServiceInternal(client, service, spaceId);
return;
}
LOGGER.debug(format("Service \"{0}\" has defined service offering alternatives \"{1}\" for default service offering \"{2}\"",
service.getName(), service.getServiceAlternatives(), service.getLabel()));
List<String> possibleServiceOfferings = computePossibleServiceOfferings(service);
Map<String, List<CloudServicePlan>> existingServiceOfferings = client.getServiceOfferings().stream().collect(
Collectors.toMap(CloudServiceOffering::getName, CloudServiceOffering::getCloudServicePlans));
List<String> validServiceOfferings = computeValidServiceOfferings(client, possibleServiceOfferings, service.getPlan(),
existingServiceOfferings);
if (CollectionUtils.isEmpty(validServiceOfferings)) {
LOGGER.error(format(
"Service \"{0}\" could not be created because none of the service offering(s) \"{1}\" match with existing service offerings \"{2}\" or provide service plan \"{3}\"",
service.getName(), possibleServiceOfferings, existingServiceOfferings.keySet(), service.getPlan()));
throw new CloudFoundryException(HttpStatus.BAD_REQUEST, format(Messages.CANT_CREATE_SERVICE_NOT_MATCHING_OFFERINGS_OR_PLAN,
service.getName(), possibleServiceOfferings, service.getPlan()));
}
attemptToFindServiceOfferingAndCreateService(client, service, spaceId, validServiceOfferings);
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:24,代码来源:ServiceCreator.java
示例4: computeValidServiceOfferings
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private List<String> computeValidServiceOfferings(CloudFoundryOperations client, List<String> possibleServiceOfferings,
String desiredServicePlan, Map<String, List<CloudServicePlan>> existingServiceOfferings) {
List<String> validServiceOfferings = new ArrayList<String>();
for (String possibleServiceOffering : possibleServiceOfferings) {
if (!existingServiceOfferings.containsKey(possibleServiceOffering)) {
LOGGER.warn(format("Service offering \"{0}\" does not exist", possibleServiceOffering));
continue;
}
Optional<CloudServicePlan> existingCloudServicePlan = existingServiceOfferings.get(possibleServiceOffering)
.stream()
.filter(servicePlan -> desiredServicePlan.equals(servicePlan.getName()))
.findFirst();
if (!existingCloudServicePlan.isPresent()) {
LOGGER.warn(
format("Service offering \"{0}\" does not provide service plan \"{1}\"", possibleServiceOffering, desiredServicePlan));
continue;
}
validServiceOfferings.add(possibleServiceOffering);
}
return validServiceOfferings;
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:22,代码来源:ServiceCreator.java
示例5: setUpExistingOfferings
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
@Override
protected void setUpExistingOfferings() throws MalformedURLException {
List<Map<String, Object>> resourcesList = new ArrayList<>();
Map<String, Object> resourceMap = new HashMap<>();
CloudServiceOffering offering = new CloudServiceOffering(null, getServiceLabel());
offering.addCloudServicePlan(new CloudServicePlan(new Meta(SERVICE_PLAN_GUID, null, null), getCloudServicePlan()));
resourcesList.add(new HashMap<>());
Mockito.when(resourceMapper.mapResource(new HashMap<String, Object>(), CloudServiceOffering.class)).thenReturn(offering);
resourceMap.put("resources", resourcesList);
Mockito.when(client.getCloudControllerUrl()).thenReturn(new URL(CONTROLLER_ENDPOINT));
Mockito.when(restTemplate.getForObject(getUrl("/v2/services?inline-relations-depth=1", new URL(CONTROLLER_ENDPOINT)),
String.class)).thenReturn(org.cloudfoundry.client.lib.util.JsonUtil.convertToJson(resourceMap));
Mockito.when(restTemplateFactory.getRestTemplate(client)).thenReturn(restTemplate);
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:17,代码来源:ServiceUpdaterTest.java
示例6: findPlanForService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private CloudServicePlan findPlanForService(CloudService service) {
List<CloudServiceOffering> offerings = getServiceOfferings(service.getLabel());
for (CloudServiceOffering offering : offerings) {
if (service.getVersion() == null || service.getVersion().equals(offering.getVersion())) {
for (CloudServicePlan plan : offering.getCloudServicePlans()) {
if (service.getPlan() != null && service.getPlan().equals(plan.getName())) {
return plan;
}
}
}
}
throw new CloudFoundryException(HttpStatus.NOT_FOUND, "Not Found", "Service plan " + service.getPlan() + " not found.");
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:14,代码来源:CloudControllerClientImpl.java
示例7: mapServicePlanResource
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private CloudServicePlan mapServicePlanResource(Map<String, Object> servicePlanResource) {
Boolean publicPlan = getEntityAttribute(servicePlanResource, "public", Boolean.class);
return new CloudServicePlan(getMeta(servicePlanResource), getEntityAttribute(servicePlanResource, "name", String.class),
getEntityAttribute(servicePlanResource, "description", String.class),
getEntityAttribute(servicePlanResource, "free", Boolean.class), publicPlan == null ? true : publicPlan,
getEntityAttribute(servicePlanResource, "extra", String.class),
getEntityAttribute(servicePlanResource, "unique_id", String.class));
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:10,代码来源:CloudEntityResourceMapper.java
示例8: getServiceInstance
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
@Test
public void getServiceInstance() {
String serviceName = "mysql-instance-test";
String appName = createSpringTravelApp("service-instance-app", Collections.singletonList(serviceName));
CloudApplication application = connectedClient.getApplication(appName);
CloudServiceInstance serviceInstance = connectedClient.getServiceInstance(serviceName);
assertNotNull(serviceInstance);
assertEquals(serviceName, serviceInstance.getName());
assertNotNull(serviceInstance.getDashboardUrl());
assertNotNull(serviceInstance.getType());
assertNotNull(serviceInstance.getCredentials());
CloudService service = serviceInstance.getService();
assertNotNull(service);
assertEquals(MYSQL_SERVICE_LABEL, service.getLabel());
assertEquals(MYSQL_SERVICE_PLAN, service.getPlan());
CloudServicePlan servicePlan = serviceInstance.getServicePlan();
assertNotNull(servicePlan);
assertEquals(MYSQL_SERVICE_PLAN, servicePlan.getName());
List<CloudServiceBinding> bindings = serviceInstance.getBindings();
assertNotNull(bindings);
assertEquals(1, bindings.size());
CloudServiceBinding binding = bindings.get(0);
assertEquals(application.getMeta().getGuid(), binding.getAppGuid());
assertNotNull(binding.getCredentials());
assertTrue(binding.getCredentials().size() > 0);
assertNotNull(binding.getBindingOptions());
assertEquals(0, binding.getBindingOptions().size());
assertNull(binding.getSyslogDrainUrl());
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:35,代码来源:CloudFoundryClientTest.java
示例9: getServiceOfferings
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
@Test
public void getServiceOfferings() {
List<CloudServiceOffering> offerings = connectedClient.getServiceOfferings();
assertNotNull(offerings);
assertTrue(offerings.size() >= 2);
CloudServiceOffering offering = null;
for (CloudServiceOffering so : offerings) {
if (so.getLabel().equals(MYSQL_SERVICE_LABEL)) {
offering = so;
break;
}
}
assertNotNull(offering);
assertEquals(MYSQL_SERVICE_LABEL, offering.getLabel());
assertNotNull(offering.getCloudServicePlans());
assertTrue(offering.getCloudServicePlans().size() > 0);
assertNotNull(offering.getName());
assertNotNull(offering.getDescription());
assertNotNull(offering.getLabel());
assertNotNull(offering.getUniqueId());
assertNotNull(offering.getExtra());
CloudServicePlan plan = offering.getCloudServicePlans().get(0);
assertNotNull(plan.getName());
assertNotNull(plan.getUniqueId());
assertNotNull(plan.getDescription());
assertSame(offering, plan.getServiceOffering());
}
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:31,代码来源:CloudFoundryClientTest.java
示例10: findPlanForService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
protected CloudServicePlan findPlanForService(CloudService service, String newServicePlan, RestTemplate restTemplate,
String cloudControllerUrl) {
List<CloudServiceOffering> offerings = getServiceOfferings(service.getLabel(), restTemplate, cloudControllerUrl);
offerings = filterByVersion(offerings, service);
for (CloudServiceOffering offering : offerings) {
for (CloudServicePlan plan : offering.getCloudServicePlans()) {
if (plan.getName().equals(newServicePlan)) {
return plan;
}
}
}
throw new SLException(MessageFormat.format(Messages.NO_SERVICE_PLAN_FOUND, service.getName(), newServicePlan, service.getLabel()));
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:14,代码来源:CloudServiceOperator.java
示例11: attemptToCreateService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private void attemptToCreateService(CloudFoundryOperations client, CloudServiceExtended service, String spaceId) {
assertServiceAttributes(service);
RestTemplate restTemplate = getRestTemplate(client);
String cloudControllerUrl = client.getCloudControllerUrl().toString();
CloudServicePlan cloudServicePlan = findPlanForService(service, restTemplate, cloudControllerUrl);
Map<String, Object> serviceRequest = createServiceRequest(service, spaceId, cloudServicePlan);
restTemplate.postForObject(getUrl(cloudControllerUrl, CREATE_SERVICE_URL_ACCEPTS_INCOMPLETE_FALSE), serviceRequest, String.class);
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:11,代码来源:ServiceCreator.java
示例12: createServiceRequest
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private Map<String, Object> createServiceRequest(CloudServiceExtended service, String spaceId, CloudServicePlan cloudServicePlan) {
Map<String, Object> serviceRequest = new HashMap<String, Object>();
serviceRequest.put(SPACE_GUID, spaceId);
serviceRequest.put(SERVICE_NAME, service.getName());
serviceRequest.put(SERVICE_PLAN_GUID, cloudServicePlan.getMeta().getGuid());
serviceRequest.put(SERVICE_PARAMETERS, service.getCredentials());
return serviceRequest;
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:9,代码来源:ServiceCreator.java
示例13: isServiceExist
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
public boolean isServiceExist(String serviceName, String plan) {
List<CloudServiceOffering> offeringList = cfClientToPopulate.getServiceOfferings();
for (CloudServiceOffering offering : offeringList) {
if (!offering.getName().equals(serviceName)) {
continue;
}
for (CloudServicePlan servicePlan : offering.getCloudServicePlans()) {
if (servicePlan.getName().equals(plan)) {
return true;
}
}
}
return false;
}
开发者ID:orange-cloudfoundry,项目名称:db-dumper-service,代码行数:16,代码来源:AbstractIntegrationWithRealCfClientTest.java
示例14: addServiceOfferingPlans
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private static void addServiceOfferingPlans(CloudServiceOffering offering, CFServiceOffering cfOffering) {
List<CloudServicePlan> offeringPlans = offering.getCloudServicePlans();
List<CFServicePlan> cfOfferingPlans = new ArrayList<CFServicePlan>();
if (offeringPlans != null) {
for (CloudServicePlan plan : offeringPlans) {
CFServicePlan cfPlan = new CFServicePlan(plan.getName(), plan.getDescription(), plan.isFree(),
plan.isPublic(), plan.getExtra(), plan.getUniqueId());
cfPlan.setServiceOffering(cfOffering);
cfOfferingPlans.add(cfPlan);
}
}
cfOffering.setServicePlans(cfOfferingPlans);
}
开发者ID:eclipse,项目名称:cft,代码行数:14,代码来源:CloudServicesUtil.java
示例15: ServiceInstance
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
public ServiceInstance(String name, List<CloudServicePlan> plans, DockerContainerElement offering) {
this.name = name;
// this.sortedPlans = new ArrayList<CloudServicePlan>(plans);
// Collections.sort(this.sortedPlans, new Comparator<CloudServicePlan>() {
//
// @Override
// public int compare(CloudServicePlan p1, CloudServicePlan p2) {
// if (p1.isFree()) {
// return -1;
// }
// else if (p2.isFree()) {
// return 1;
// }
// else {
// return 0;
// }
// }
// });
this.offering = offering;
// planNames = new String[this.sortedPlans.size()];
// planDisplayNames = new String[this.sortedPlans.size()];
//
// for (int x = 0; x < this.sortedPlans.size(); x++) {
// CloudServicePlan plan = this.sortedPlans.get(x);
// planNames[x] = plan.getName();
// planDisplayNames[x] = plan.isFree() ? NLS.bind(Messages.DockerFoundryServiceWizardPageRightPanel_FREE_PLAN,
// plan.getName()) : plan.getName();
// }
}
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:32,代码来源:DockerFoundryServiceWizardPageRightPanel.java
示例16: createService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
public void createService(CloudService service) throws CloudFoundryException {
assertSpaceProvided("create service");
Assert.notNull(service, "Service must not be null");
Assert.notNull(service.getName(), "Service name must not be null");
Assert.notNull(service.getLabel(), "Service label must not be null");
Assert.notNull(service.getPlan(), "Service plan must not be null");
CloudServicePlan cloudServicePlan = findPlanForService(service);
HashMap<String, Object> serviceRequest = new HashMap<String, Object>();
serviceRequest.put("space_guid", sessionSpace.getMeta().getGuid());
serviceRequest.put("name", service.getName());
serviceRequest.put("service_plan_guid", cloudServicePlan.getMeta().getGuid());
postForObject(API_BASE+"/service_instances", serviceRequest);
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:16,代码来源:CloudFoundryClient.java
示例17: findPlanForService
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private CloudServicePlan findPlanForService(CloudService service) throws CloudFoundryException {
List<CloudServiceOffering> offerings = getServiceOfferings(service.getLabel());
for (CloudServiceOffering offering : offerings) {
if (service.getVersion() == null || service.getVersion().equals(offering.getVersion())) {
for (CloudServicePlan plan : offering.getCloudServicePlans()) {
if (service.getPlan() != null && service.getPlan().equals(plan.getName())) {
return plan;
}
}
}
}
throw new IllegalArgumentException("Service plan " + service.getPlan() + " not found");
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:14,代码来源:CloudFoundryClient.java
示例18: mapServiceResource
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private CloudServiceOffering mapServiceResource(Map<String, Object> resource) {
CloudServiceOffering cloudServiceOffering = new CloudServiceOffering(
getMeta(resource),
getEntityAttribute(resource, "label", String.class),
getEntityAttribute(resource, "provider", String.class),
getEntityAttribute(resource, "version", String.class),
getEntityAttribute(resource, "description", String.class),
getEntityAttribute(resource, "active", Boolean.class),
getEntityAttribute(resource, "bindable", Boolean.class),
getEntityAttribute(resource, "url", String.class),
getEntityAttribute(resource, "info_url", String.class),
getEntityAttribute(resource, "unique_id", String.class),
getEntityAttribute(resource, "extra", String.class),
getEntityAttribute(resource, "documentation_url", String.class));
List<Map<String, Object>> servicePlanList = getEmbeddedResourceList(getEntity(resource), "service_plans");
if (servicePlanList != null) {
for (Map<String, Object> servicePlanResource : servicePlanList) {
CloudServicePlan servicePlan =
new CloudServicePlan(
getMeta(servicePlanResource),
getEntityAttribute(servicePlanResource, "name", String.class),
getEntityAttribute(servicePlanResource, "description", String.class),
getEntityAttribute(servicePlanResource, "free", Boolean.class),
getEntityAttribute(servicePlanResource, "public", Boolean.class),
getEntityAttribute(servicePlanResource, "extra", String.class),
getEntityAttribute(servicePlanResource, "unique_id", String.class),
cloudServiceOffering);
cloudServiceOffering.addCloudServicePlan(servicePlan);
}
}
return cloudServiceOffering;
}
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:33,代码来源:CloudEntityResourceMapper.java
示例19: findFreePlan
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
private String findFreePlan(CloudServiceOffering serviceOffering){
String freePlan=null;
for(CloudServicePlan plan: serviceOffering.getCloudServicePlans()) {
if(plan.isFree()){
return plan.getName();
}
}
return freePlan;
}
开发者ID:SeaCloudsEU,项目名称:SeaCloudsPlatform,代码行数:11,代码来源:ServiceCredentialLiveTest.java
示例20: setUpExistingOfferings
import org.cloudfoundry.client.lib.domain.CloudServicePlan; //导入依赖的package包/类
protected void setUpExistingOfferings() throws MalformedURLException {
List<String> existingServiceOfferingNames = Collections.emptyList();
boolean definedExistingServiceOfferings = false;
if (input.getExistingServiceOfferings() == null) {
existingServiceOfferingNames = Arrays.asList(getServiceLabel());
} else {
existingServiceOfferingNames = new ArrayList<String>(input.getExistingServiceOfferings().keySet());
definedExistingServiceOfferings = true;
}
List<CloudServiceOffering> existingServiceOfferings = new ArrayList<CloudServiceOffering>();
List<Map<String, Object>> resourcesList = new ArrayList<>();
Map<String, Object> resourceMap = new HashMap<>();
for (String existingServiceOfferingName : existingServiceOfferingNames) {
CloudServiceOffering offering = new CloudServiceOffering(null, existingServiceOfferingName);
if (definedExistingServiceOfferings) {
List<String> existingPlans = input.getExistingServiceOfferings().get(existingServiceOfferingName);
for (String existingPlan : existingPlans) {
offering.addCloudServicePlan(
new CloudServicePlan(new Meta(getUUID(existingServiceOfferingName), null, null), existingPlan));
}
} else {
offering.addCloudServicePlan(
new CloudServicePlan(new Meta(getUUID(existingServiceOfferingName), null, null), getCloudServicePlan()));
}
existingServiceOfferings.add(offering);
Map<String, Object> nextResourceMap = new HashMap<String, Object>();
nextResourceMap.put(existingServiceOfferingName, null);
resourcesList.add(nextResourceMap);
Mockito.when(resourceMapper.mapResource(nextResourceMap, CloudServiceOffering.class)).thenReturn(offering);
}
resourceMap.put("resources", resourcesList);
Mockito.when(client.getCloudControllerUrl()).thenReturn(new URL(CONTROLLER_ENDPOINT));
Mockito.when(restTemplate.getForObject(getUrl("/v2/services?inline-relations-depth=1", new URL(CONTROLLER_ENDPOINT)), String.class))
.thenReturn(org.cloudfoundry.client.lib.util.JsonUtil.convertToJson(resourceMap));
Mockito.when(restTemplateFactory.getRestTemplate(client)).thenReturn(restTemplate);
Mockito.when(client.getServiceOfferings()).thenReturn(existingServiceOfferings);
}
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:43,代码来源:ServiceCreatorTest.java
注:本文中的org.cloudfoundry.client.lib.domain.CloudServicePlan类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论