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


Java CreateServiceInstanceRequest类代码示例

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


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

示例1: createService

import org.cloudfoundry.operations.services.CreateServiceInstanceRequest; //导入依赖的package包/类
private void createService(String serviceInstanceName, String serviceName, String plan)
    throws InterruptedException {

    CountDownLatch latchService = new CountDownLatch(1);

    cloudFoundryOperations.services()
        .createInstance(CreateServiceInstanceRequest.builder()
            .serviceInstanceName(serviceInstanceName)
            .serviceName(serviceName)
            .planName(plan)
            .build())
        .doOnSubscribe(s -> logger.info("Create Service Started"))
        .doOnError(t -> this.logger.error("Service creation Failed", t))
        .doOnSuccess(v -> this.logger.info("Service creation Successful"))
        .subscribe(System.out::println, t -> latchService.countDown(), latchService::countDown);

    latchService.await();
}
 
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:19,代码来源:Connection.java

示例2: create

import org.cloudfoundry.operations.services.CreateServiceInstanceRequest; //导入依赖的package包/类
@Override
public Mono<Void> create() {
    return this.cloudFoundryOperations.services()
        .listInstances()
        .filter(serviceInstance -> this.name.equals(serviceInstance.getName()))
        .singleOrEmpty()
        .switchIfEmpty(this.cloudFoundryOperations.services()
            .createInstance(CreateServiceInstanceRequest.builder()
                .planName(this.plan)
                .serviceName(this.service)
                .serviceInstanceName(this.name)
                .build())
            .cast(org.cloudfoundry.operations.services.ServiceInstanceSummary.class)
            .doOnSubscribe(s -> this.logger.info("Creating {} ({}/{})", this.name, this.service, this.plan)))
        .then();
}
 
开发者ID:cloudfoundry,项目名称:java-buildpack-system-test,代码行数:17,代码来源:AbstractServiceInstance.java

示例3: createService

import org.cloudfoundry.operations.services.CreateServiceInstanceRequest; //导入依赖的package包/类
public Mono<ServiceInstance> createService(CloudFoundryOperations cfOperations,
                                           CfServiceDetail cfServiceDetail) {

    Mono<Optional<ServiceInstance>> serviceInstanceMono = servicesDetailHelper
        .getServiceInstanceDetail(cfOperations, cfServiceDetail.instanceName());

    return serviceInstanceMono
        .then(serviceInstanceOpt -> serviceInstanceOpt.map(serviceInstance -> {
            LOGGER.lifecycle(
                "Existing service with name {} found. This service will not be re-created",
                cfServiceDetail.instanceName());
            return Mono.just(serviceInstance);
        }).orElseGet(() -> {
            LOGGER
                .lifecycle("Creating service -  instance: {}, service: {}, plan: {}",
                    cfServiceDetail.instanceName(), cfServiceDetail.name(),
                    cfServiceDetail.plan());

            return cfOperations.services().createInstance(
                CreateServiceInstanceRequest.builder()
                    .serviceInstanceName(cfServiceDetail.instanceName())
                    .serviceName(cfServiceDetail.name())
                    .planName(cfServiceDetail.plan())
                    .tags(cfServiceDetail.tags())
                    .build())
                .then(servicesDetailHelper.getServiceInstanceDetail(cfOperations, cfServiceDetail.instanceName()))
                .map(instanceOpt -> instanceOpt.get());
        }));

}
 
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:31,代码来源:CfCreateServiceHelper.java


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