当前位置: 首页>>代码示例>>Java>>正文


Java CloudServiceOffering类代码示例

本文整理汇总了Java中org.cloudfoundry.client.lib.domain.CloudServiceOffering的典型用法代码示例。如果您正苦于以下问题:Java CloudServiceOffering类的具体用法?Java CloudServiceOffering怎么用?Java CloudServiceOffering使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CloudServiceOffering类属于org.cloudfoundry.client.lib.domain包,在下文中一共展示了CloudServiceOffering类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: mapServiceOfferingResource

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例2: createService

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例3: setUpExistingOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例4: getServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
@Override
public List<CloudServiceOffering> getServiceOfferings() {
    String urlPath = "/v2/services?inline-relations-depth=1";
    List<Map<String, Object>> resourceList = getAllResources(urlPath);
    List<CloudServiceOffering> serviceOfferings = new ArrayList<CloudServiceOffering>();
    for (Map<String, Object> resource : resourceList) {
        CloudServiceOffering serviceOffering = resourceMapper.mapResource(resource, CloudServiceOffering.class);
        serviceOfferings.add(serviceOffering);
    }
    return serviceOfferings;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:12,代码来源:CloudControllerClientImpl.java

示例5: findPlanForService

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例6: getServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例7: createMySqlServiceWithVersionAndProvider

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
private CloudService createMySqlServiceWithVersionAndProvider(String serviceName) {
    CloudServiceOffering databaseServiceOffering = getCloudServiceOffering(MYSQL_SERVICE_LABEL);

    CloudService service = new CloudService(CloudEntity.Meta.defaultMeta(), serviceName);
    service.setProvider(databaseServiceOffering.getProvider());
    service.setLabel(databaseServiceOffering.getLabel());
    service.setVersion(databaseServiceOffering.getVersion());
    service.setPlan(MYSQL_SERVICE_PLAN);

    connectedClient.createService(service);

    return service;
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:14,代码来源:CloudFoundryClientTest.java

示例8: getCloudServiceOffering

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
private CloudServiceOffering getCloudServiceOffering(String label) {
    List<CloudServiceOffering> serviceOfferings = connectedClient.getServiceOfferings();
    for (CloudServiceOffering so : serviceOfferings) {
        if (so.getLabel().equals(label)) {
            return so;
        }
    }
    throw new IllegalStateException("No CloudServiceOffering found with label " + label + ".");
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:10,代码来源:CloudFoundryClientTest.java

示例9: findPlanForService

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例10: getServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
protected List<CloudServiceOffering> getServiceOfferings(String label, RestTemplate restTemplate, String cloudControllerUrl) {
    List<Map<String, Object>> resourceList = getAllResources(restTemplate, cloudControllerUrl, SERVICES_URL);
    List<CloudServiceOffering> results = new ArrayList<CloudServiceOffering>();
    for (Map<String, Object> resource : resourceList) {
        CloudServiceOffering cloudServiceOffering = getResourceMapper().mapResource(resource, CloudServiceOffering.class);
        if (cloudServiceOffering.getLabel().equals(label)) {
            results.add(cloudServiceOffering);
        }
    }
    return results;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:12,代码来源:CloudServiceOperator.java

示例11: isServiceExist

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例12: asServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
public static List<CFServiceOffering> asServiceOfferings(List<CloudServiceOffering> offerings) {
	List<CFServiceOffering> cfOfferings = new ArrayList<CFServiceOffering>();
	if (offerings != null) {
		for (CloudServiceOffering offering : offerings) {
			CFServiceOffering cfOffering = new CFServiceOffering(offering.getLabel(), offering.getVersion(),
					offering.getDescription(), offering.isActive(), offering.isBindable(), offering.getUrl(),
					offering.getInfoUrl(), offering.getUniqueId(), offering.getExtra(),
					offering.getDocumentationUrl(), offering.getProvider());
			addServiceOfferingPlans(offering, cfOffering);
			cfOfferings.add(cfOffering);
		}
	}

	return cfOfferings;
}
 
开发者ID:eclipse,项目名称:cft,代码行数:16,代码来源:CloudServicesUtil.java

示例13: addServiceOfferingPlans

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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

示例14: getServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
private List<CloudServiceOffering> getServiceOfferings(String label) throws CloudFoundryException {
	Assert.notNull(label, "Service label must not be null");
	List<JSONObject> resourceList = ResponseObject.getResources(API_BASE+"/services?inline-relations-depth=1", token);
	List<CloudServiceOffering> results = new ArrayList<CloudServiceOffering>();
	for (JSONObject resource : resourceList) {
		CloudServiceOffering cloudServiceOffering = new CloudServiceOffering(resource.getJSONObject(METADATA),resource.getJSONObject(ENTITY));
		if (cloudServiceOffering.getLabel() != null && label.equals(cloudServiceOffering.getLabel())) {
			results.add(cloudServiceOffering);
		}
	}
	return results;
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:13,代码来源:CloudFoundryClient.java

示例15: findPlanForService

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的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


注:本文中的org.cloudfoundry.client.lib.domain.CloudServiceOffering类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。