本文整理汇总了Java中org.cloudfoundry.operations.CloudFoundryOperations类的典型用法代码示例。如果您正苦于以下问题:Java CloudFoundryOperations类的具体用法?Java CloudFoundryOperations怎么用?Java CloudFoundryOperations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CloudFoundryOperations类属于org.cloudfoundry.operations包,在下文中一共展示了CloudFoundryOperations类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: doCreateOperations
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
private CloudFoundryOperations doCreateOperations(CloudFoundryClient cloudFoundryClient,
ConnectionContext connectionContext,
TokenProvider tokenProvider,
String org,
String space) {
ReactorDopplerClient dopplerClient = ReactorDopplerClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
ReactorUaaClient uaaClient = ReactorUaaClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
return DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(cloudFoundryClient)
.dopplerClient(dopplerClient)
.uaaClient(uaaClient)
.organization(org)
.space(space)
.build();
}
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:24,代码来源:DefaultAppDeployerFactory.java
示例2: stop
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
/**
* Start a given module on the CF
*
* @param name
*/
public void stop(String name, URL apiEndpoint, String org, String space, String email, String password, String namespace) {
CloudFoundryOperations operations = appDeployerFactory.getOperations(email, password, apiEndpoint, org, space);
CloudFoundryAppDeployer appDeployer = appDeployerFactory.getAppDeployer(apiEndpoint, org, space, email, password, namespace);
operations.applications()
.stop(StopApplicationRequest.builder()
.name(name)
.build())
.then(() -> Mono.defer(() -> Mono.just(appDeployer.status(name)))
.filter(appStatus -> appStatus.getState() == DeploymentState.unknown)
.repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), Duration.ofMinutes(15)))
.doOnSuccess(v -> log.debug(String.format("Successfully stopped %s", name)))
.doOnError(e -> log.error(String.format("Unable to stop %s", name))))
.block(Duration.ofSeconds(30));
}
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:23,代码来源:ModuleService.java
示例3: createCloudFoundryOperations
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
private CloudFoundryOperations createCloudFoundryOperations() {
DefaultConnectionContext connectionContext = DefaultConnectionContext.builder()
.apiHost(apiHost)
.build();
TokenProvider tokenProvider = PasswordGrantTokenProvider.builder()
.password(password)
.username(userName)
.build();
ReactorCloudFoundryClient reactorClient = ReactorCloudFoundryClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
CloudFoundryOperations cloudFoundryOperations = DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(reactorClient)
.organization(organization)
.space(space)
.build();
return cloudFoundryOperations;
}
开发者ID:StuPro-TOSCAna,项目名称:TOSCAna,代码行数:24,代码来源:Connection.java
示例4: undeploy
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
/**
* Undeploy a module
*
* @param name
*/
public void undeploy(String name, URL apiEndpoint, String org, String space, String email, String password, String namespace) {
CloudFoundryOperations operations = appDeployerFactory.getOperations(email, password, apiEndpoint, org, space);
// TODO: Migrate to new SPI with reactive interface.
//appDeployer.undeploy(name);
operations.applications()
.delete(DeleteApplicationRequest.builder()
.name(name)
.deleteRoutes(true)
.build())
.block(Duration.ofMinutes(5));
counterService.increment(String.format(METRICS_UNDEPLOYED, name));
}
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:22,代码来源:ModuleService.java
示例5: start
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
/**
* Start a given module on the CF
*
* @param name
*/
public void start(String name, URL apiEndpoint, String org, String space, String email, String password, String namespace) {
CloudFoundryOperations operations = appDeployerFactory.getOperations(email, password, apiEndpoint, org, space);
CloudFoundryAppDeployer appDeployer = appDeployerFactory.getAppDeployer(apiEndpoint, org, space, email, password, namespace);
operations.applications()
.start(StartApplicationRequest.builder()
.name(name)
.build())
.then(() -> Mono.defer(() -> Mono.just(appDeployer.status(name)))
.filter(appStatus ->
appStatus.getState() == DeploymentState.deployed || appStatus.getState() == DeploymentState.failed)
.repeatWhenEmpty(exponentialBackOff(Duration.ofSeconds(1), Duration.ofSeconds(15), Duration.ofMinutes(15)))
.doOnSuccess(v -> log.debug(String.format("Successfully started %s", name)))
.doOnError(e -> log.error(String.format("Unable to start %s", name))))
.block(Duration.ofMinutes(10));
}
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:24,代码来源:ModuleService.java
示例6: shouldHandleUndeployingAnApp
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void shouldHandleUndeployingAnApp() throws MalformedURLException {
// given
CloudFoundryClient client = mock(CloudFoundryClient.class);
CloudFoundryOperations operations = mock(CloudFoundryOperations.class);
CloudFoundryAppDeployer appDeployer = mock(CloudFoundryAppDeployer.class);
appDeployerFactory.setStub(appDeployer);
appDeployerFactory.setStubClient(client);
appDeployerFactory.setStubOperations(operations);
Applications applications = mock(Applications.class);
given(operations.applications()).willReturn(applications);
given(applications.delete(any())).willReturn(Mono.empty());
// when
moduleService.undeploy("clouddriver", new URL("http://example.com"), "org", "space", "user", "password", "");
// then
then(applications).should().delete(any());
verifyNoMoreInteractions(appDeployer);
}
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:24,代码来源:ModuleServiceTests.java
示例7: main
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
ConfigurableApplicationContext applicationContext = SpringApplication.run(ListApplicationsApplication.class, args);
CloudFoundryClient cloudFoundryClient = applicationContext.getBean(CloudFoundryClient.class);
CloudFoundryOperations cloudFoundryOperations = applicationContext.getBean(CloudFoundryOperations.class);
CountDownLatch latch = new CountDownLatch(1);
cloudFoundryOperations.applications()
.list()
.flatMap(application -> Mono.just(application)
.and(getServiceInstances(cloudFoundryClient, application)))
.map(function(FormattingUtils::formatApplication))
.subscribe(System.out::println, t -> {
t.printStackTrace();
latch.countDown();
}, latch::countDown);
latch.await();
}
开发者ID:nebhale,项目名称:cf-java-client-webinar-2016,代码行数:20,代码来源:ListApplicationsApplication.java
示例8: mapRoute
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
public Mono<Void> mapRoute(CloudFoundryOperations cfOperations,
CfProperties cfProperties) {
Mono<Void> resp = cfOperations.routes()
.map(MapRouteRequest
.builder()
.applicationName(cfProperties.name())
.domain(cfProperties.domain())
.host(cfProperties.host())
.path(cfProperties.path()).build()).then().doOnSubscribe((s) -> {
LOGGER.lifecycle("Mapping hostname '{}' in domain '{}' with path '{}' of app '{}'", cfProperties.host(),
cfProperties.domain(), cfProperties.path(), cfProperties.name());
});
return resp;
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:18,代码来源:CfMapRouteDelegate.java
示例9: stopApp
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
public Mono<Void> stopApp(CloudFoundryOperations cfOperations,
CfProperties cfProperties) {
return cfOperations.applications()
.stop(StopApplicationRequest.builder().name(cfProperties.name()).build())
.doOnSubscribe((s) -> {
LOGGER.lifecycle("Stopping app '{}'", cfProperties.name());
});
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:11,代码来源:CfAppStopDelegate.java
示例10: unmapRoute
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
public Mono<Void> unmapRoute(CloudFoundryOperations cfOperations, CfProperties cfProperties) {
return cfOperations.routes()
.unmap(UnmapRouteRequest
.builder()
.applicationName(cfProperties.name())
.domain(cfProperties.domain())
.host(cfProperties.host())
.path(cfProperties.path())
.build()).doOnSubscribe((s) -> {
LOGGER.lifecycle("Unmapping hostname '{}' in domain '{}' with path '{}' of app '{}'", cfProperties.host(),
cfProperties.domain(), cfProperties.path(), cfProperties.name());
});
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:17,代码来源:CfUnMapRouteDelegate.java
示例11: createUserProvidedService
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
public Mono<Void> createUserProvidedService(CloudFoundryOperations cfOperations,
CfUserProvidedServiceDetail cfUserProvidedServiceDetail) {
Mono<Optional<ServiceInstance>> serviceInstanceMono = servicesDetailHelper
.getServiceInstanceDetail(cfOperations,
cfUserProvidedServiceDetail.instanceName());
return serviceInstanceMono
.then(serviceInstanceOpt -> serviceInstanceOpt.map(serviceInstance -> {
LOGGER.lifecycle(
"Existing service with name {} found. This service will not be re-created",
cfUserProvidedServiceDetail.instanceName());
return Mono.empty().then();
}).orElseGet(() -> {
LOGGER.lifecycle("Creating user provided service - instance: {}",
cfUserProvidedServiceDetail.instanceName());
return cfOperations.services().createUserProvidedInstance(
CreateUserProvidedServiceInstanceRequest.builder()
.name(cfUserProvidedServiceDetail.instanceName())
.credentials(cfUserProvidedServiceDetail.credentials()).build());
}));
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:23,代码来源:CfCreateUserProvidedServiceHelper.java
示例12: renameApp
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@TaskAction
public void renameApp() {
CloudFoundryOperations cfOperations = getCfOperations();
CfProperties cfAppProperties = getCfProperties();
if (getNewName() == null) {
throw new RuntimeException("New name not provided");
}
CfProperties oldCfProperties = cfAppProperties;
CfProperties newCfProperties = ImmutableCfProperties.copyOf(oldCfProperties).withName(getNewName());
Mono<Void> resp = renameDelegate.renameApp(cfOperations, oldCfProperties, newCfProperties);
resp.block(Duration.ofMillis(defaultWaitTimeout));
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:18,代码来源:CfRenameAppTask.java
示例13: cfCreateServiceTask
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@TaskAction
public void cfCreateServiceTask() {
CloudFoundryOperations cfOperations = getCfOperations();
CfProperties cfProperties = getCfProperties();
List<Mono<Void>> createServicesResult = cfProperties.cfServices()
.stream()
.map(service -> createServiceHelper.createService(cfOperations, service).then())
.collect(Collectors.toList());
List<Mono<Void>> createUserProvidedServicesResult = cfProperties.cfUserProvidedServices()
.stream()
.map(service -> userProvidedServiceHelper.createUserProvidedService(cfOperations, service))
.collect(Collectors.toList());
Flux.merge(createServicesResult).toIterable().forEach(r -> {
});
Flux.merge(createUserProvidedServicesResult).toIterable().forEach(r -> {
});
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:22,代码来源:CfCreateServicesTask.java
示例14: getCfOperations
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
protected CloudFoundryOperations getCfOperations() {
CfProperties cfAppProperties = this.cfPropertiesMapper.getProperties();
ConnectionContext connectionContext = DefaultConnectionContext.builder()
.apiHost(cfAppProperties.ccHost())
.skipSslValidation(true)
.proxyConfiguration(tryGetProxyConfiguration(cfAppProperties))
.build();
TokenProvider tokenProvider = getTokenProvider(cfAppProperties);
CloudFoundryClient cfClient = ReactorCloudFoundryClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
CloudFoundryOperations cfOperations = DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(cfClient)
.organization(cfAppProperties.org())
.space(cfAppProperties.space())
.build();
return cfOperations;
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:25,代码来源:AbstractCfTask.java
示例15: testCreateServiceWithNoExistingService
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void testCreateServiceWithNoExistingService() {
CloudFoundryOperations cfOps = mock(CloudFoundryOperations.class);
Services mockServices = mock(Services.class);
when(mockServices
.getInstance(any(GetServiceInstanceRequest.class)))
.thenReturn(Mono.empty());
when(cfOps.services()).thenReturn(mockServices);
CfServiceDetail cfServiceDetail = ImmutableCfServiceDetail
.builder().name("testName")
.plan("testPlan")
.instanceName("inst")
.build();
Mono<ServiceInstance> createServiceResult = this.cfCreateServiceHelper.createService(cfOps, cfServiceDetail);
StepVerifier.create(createServiceResult)
.verifyComplete();
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:24,代码来源:CfCreateServiceHelperTest.java
示例16: testCfPushWithoutEnvOrServices
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void testCfPushWithoutEnvOrServices() throws Exception {
CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class);
Applications mockApplications = mock(Applications.class);
when(cfOperations.applications()).thenReturn(mockApplications);
when(mockApplications.push(any(PushApplicationRequest.class))).thenReturn(Mono.empty());
when(mockApplications.restart(any(RestartApplicationRequest.class))).thenReturn(Mono.empty());
Services mockServices = mock(Services.class);
when(cfOperations.services()).thenReturn(mockServices);
ServiceInstance mockInstance = ServiceInstance.builder().name("testservice").id("id").type(ServiceInstanceType.MANAGED).build();
when(mockServices.getInstance(any(GetServiceInstanceRequest.class))).thenReturn(Mono.just(mockInstance));
CfProperties cfAppProperties = sampleApp();
cfPushDelegate.push(cfOperations, cfAppProperties);
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:17,代码来源:CfPushDelegateTest.java
示例17: testGetServiceDetails
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void testGetServiceDetails() {
CloudFoundryOperations cfOps = mock(CloudFoundryOperations.class);
Services mockServices = mock(Services.class);
when(mockServices
.getInstance(any(GetServiceInstanceRequest.class)))
.thenReturn(Mono.just(ServiceInstance.builder()
.id("id")
.type(ServiceInstanceType.MANAGED)
.name("test")
.build()));
when(cfOps.services()).thenReturn(mockServices);
Mono<Optional<ServiceInstance>> serviceDetailMono =
this.cfServicesDetailHelper.getServiceInstanceDetail(cfOps, "srvc");
StepVerifier.create(serviceDetailMono).expectNextMatches(serviceInstance ->
serviceInstance.isPresent());
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:22,代码来源:CfServicesDetailHelperTest.java
示例18: testAutopilotNewAppShouldCallPushAlone
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void testAutopilotNewAppShouldCallPushAlone() {
Project project = mock(Project.class);
CloudFoundryOperations cfOperations = mock(CloudFoundryOperations.class);
CfProperties cfAppProperties = sampleApp();
when(detailsTaskDelegate.getAppDetails(cfOperations, cfAppProperties)).thenReturn(Mono.just(Optional.empty()));
when(cfPushDelegate.push(cfOperations, cfAppProperties)).thenReturn(Mono.empty());
Mono<Void> resp = this.cfAutoPilotTask.runAutopilot(project, cfOperations, cfAppProperties);
StepVerifier.create(resp)
.expectComplete()
.verify();
verify(cfRenameAppDelegate, times(0)).renameApp(any(CloudFoundryOperations.class),
any(CfProperties.class), any(CfProperties.class));
verify(cfPushDelegate, times(1)).push(any(CloudFoundryOperations.class), any(CfProperties.class));
verify(deleteDelegate, times(0)).deleteApp(any(CloudFoundryOperations.class), any(CfProperties.class));
}
开发者ID:pivotalservices,项目名称:ya-cf-app-gradle-plugin,代码行数:24,代码来源:CfAutoPilotDelegateTest.java
示例19: cloudFoundryOperations
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Bean
public CloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient,
ConnectionContext connectionContext,
TokenProvider tokenProvider,
CloudFoundryConnectionProperties properties) {
ReactorDopplerClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
ReactorUaaClient.builder()
.connectionContext(connectionContext)
.tokenProvider(tokenProvider)
.build();
return DefaultCloudFoundryOperations.builder()
.cloudFoundryClient(cloudFoundryClient)
.organization(properties.getOrg())
.space(properties.getSpace())
.build();
}
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-cloudfoundry,代码行数:22,代码来源:CloudFoundryTestSupport.java
示例20: testConnectivity
import org.cloudfoundry.operations.CloudFoundryOperations; //导入依赖的package包/类
@Test
public void testConnectivity() throws Exception {
Assume.assumeTrue(configExists());
ApplicationContext ctx = new SpringApplicationBuilder()
.sources(MyConfig.class)
.properties(defaultConfig())
.run();
CloudFoundryOperations operations = ctx.getBean(CloudFoundryOperations.class);
Assert.assertNotNull(operations);
OrganizationSummary summary = operations
.organizations()
.list()
.blockFirst();
Assertions.assertThat(summary).isNotNull();
Assertions.assertThat(summary.getId()).isNotEmpty();
Assertions.assertThat(summary.getName()).isNotEmpty();
}
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry,代码行数:20,代码来源:CloudFoundryClientAutoConfigurationTest.java
注:本文中的org.cloudfoundry.operations.CloudFoundryOperations类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论