• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CloudServiceOffering类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: mapResource

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
@SuppressWarnings("unchecked")
	public <T> T mapResource(Map<String, Object> resource, Class<T> targetClass) {
		if (targetClass == CloudSpace.class) {
			return (T) mapSpaceResource(resource);
		}
		if (targetClass == CloudOrganization.class) {
			return (T) mapOrganizationResource(resource);
		}
		if (targetClass == CloudDomain.class) {
			return (T) mapDomainResource(resource);
		}
		if (targetClass == CloudRoute.class) {
			return (T) mapRouteResource(resource);
		}
//		if (targetClass == CloudApplication.class) {
//			return (T) mapApplicationResource(resource);
//		}
		if (targetClass == CloudService.class) {
			return (T) mapServiceInstanceResource(resource);
		}
		if (targetClass == CloudServiceOffering.class) {
			return (T) mapServiceResource(resource);
		}
		if (targetClass == CloudStack.class) {
			return (T) mapStackResource(resource);
		}
		throw new IllegalArgumentException(
				"Error during mapping - unsupported class for entity mapping " + targetClass.getName());
	}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:30,代码来源:CloudEntityResourceMapper.java


示例17: mapServiceResource

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


示例18: getServiceOfferings

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
@Test
public void getServiceOfferings() throws CloudFoundryException {
	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.getProvider());
	assertNotNull(offering.getUrl());
	assertNotNull(offering.getDocumentationUrl());
	assertNotNull(offering.getUniqueId());
	assertNotNull(offering.getExtra());
}
 
开发者ID:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:28,代码来源:CloudFoundryClientTest.java


示例19: createMySqlServiceWithVersionAndProvider

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
private CloudService createMySqlServiceWithVersionAndProvider(String serviceName) throws CloudFoundryException {
	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:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:14,代码来源:CloudFoundryClientTest.java


示例20: getCloudServiceOffering

import org.cloudfoundry.client.lib.domain.CloudServiceOffering; //导入依赖的package包/类
private CloudServiceOffering getCloudServiceOffering(String label) throws CloudFoundryException {
	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:stephen-kruger,项目名称:cloudfoundry-liteclient-lib,代码行数:10,代码来源:CloudFoundryClientTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CannedTokenStream类代码示例发布时间:2022-05-22
下一篇:
Java DCTERMS类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap