本文整理汇总了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();
}
示例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();
}
示例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());
}));
}