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


Java CloudFoundryClient类代码示例

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


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

示例1: doCreateOperations

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的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: link

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
public String link(String module, URL api, String email, String password) {

		CloudFoundryClient client = appDeployerFactory.getCloudFoundryClient(email, password, api);

		return PaginationUtils.requestClientV2Resources(page -> client.applicationsV2()
				.list(ListApplicationsRequest.builder()
					.name(module)
					.build()))
				.flatMap(applicationResource -> client.spaces()
					.get(GetSpaceRequest.builder()
						.spaceId(applicationResource.getEntity().getSpaceId())
						.build())
					.map(spaceResponse -> Tuples.of(spaceResponse, applicationResource)))
				.map(function((spaceResponse, applicationResource) ->
					"/organizations/" + spaceResponse.getEntity().getOrganizationId() +
					"/spaces/" + spaceResponse.getMetadata().getId() +
					"/applications/" + applicationResource.getMetadata().getId()))
				.blockFirst();
	}
 
开发者ID:spring-cloud,项目名称:spring-cloud-spinnaker,代码行数:20,代码来源:ModuleService.java

示例3: shouldHandleUndeployingAnApp

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

示例4: main

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

示例5: organizationId

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
Mono<String> organizationId(CloudFoundryClient cloudFoundryClient, String organizationName) throws InterruptedException {
    return PaginationUtils
            .requestClientV2Resources(page -> cloudFoundryClient.organizations()
                    .list(ListOrganizationsRequest.builder()
                            .name(organizationName)
                            .page(page)
                            .build()))
            .map(ResourceUtils::getId)
            .single()
            .doOnSubscribe(s -> this.logger.debug(">> ORGANIZATION name({}) <<", organizationName))
            .doOnError(Throwable::printStackTrace)
            .doOnSuccess(id -> this.logger.debug("<< ORGANIZATION id({}) >>", id))
            .cache();
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:17,代码来源:IntegrationTestConfiguration.java

示例6: spaceId

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
@Bean(initMethod = "block")
@DependsOn("cloudFoundryCleaner")
Mono<String> spaceId(CloudFoundryClient cloudFoundryClient, Mono<String> organizationId, String spaceName, String userName) throws InterruptedException {
    return organizationId
            .then(orgId -> cloudFoundryClient.spaces()
                    .create(CreateSpaceRequest.builder()
                            .name(spaceName)
                            .organizationId(orgId)
                            .build()))
            .map(ResourceUtils::getId)
            .as(thenKeep(spaceId1 -> cloudFoundryClient.spaces()
                    .associateDeveloperByUsername(AssociateSpaceDeveloperByUsernameRequest.builder()
                            .username(userName)
                            .spaceId(spaceId1)
                            .build())))
            .doOnSubscribe(s -> this.logger.debug(">> SPACE name({}) <<", spaceName))
            .doOnError(Throwable::printStackTrace)
            .doOnSuccess(id -> this.logger.debug("<< SPACE id({}) >>", id))
            .cache();
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:21,代码来源:IntegrationTestConfiguration.java

示例7: cleanApplicationsV2

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private static Flux<Void> cleanApplicationsV2(CloudFoundryClient cloudFoundryClient) {
    return PaginationUtils.
            requestClientV2Resources(page -> cloudFoundryClient.applicationsV2()
                    .list(ListApplicationsRequest.builder()
                            .page(page)
                            .build()))
            .filter(application -> ResourceUtils.getEntity(application).getName().startsWith("test-application-"))
            .map(ResourceUtils::getId)
            .flatMap(applicationId -> removeServiceBindings(cloudFoundryClient, applicationId)
                    .thenMany(Flux.just(applicationId)))
            .flatMap(applicationId -> cloudFoundryClient.applicationsV2()
                    .delete(DeleteApplicationRequest.builder()
                            .applicationId(applicationId)
                            .build()));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:16,代码来源:CloudFoundryCleaner.java

示例8: cleanRoutes

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private static Flux<Void> cleanRoutes(CloudFoundryClient cloudFoundryClient) {
    return PaginationUtils.
            requestClientV2Resources(page -> cloudFoundryClient.routes()
                    .list(ListRoutesRequest.builder()
                            .page(page)
                            .build()))
            .flatMap(route -> Mono.when(
                    Mono.just(route),
                    cloudFoundryClient.domains()
                            .get(GetDomainRequest.builder()
                                    .domainId(ResourceUtils.getEntity(route).getDomainId())
                                    .build())
            ))
            .filter(predicate((route, domain) -> ResourceUtils.getEntity(domain).getName().startsWith("test.domain.") ||
                    ResourceUtils.getEntity(route).getHost().startsWith("test-application-") ||
                    ResourceUtils.getEntity(route).getHost().startsWith("test-host-")))
            .map(function((route, domain) -> ResourceUtils.getId(route)))
            .flatMap(routeId -> cloudFoundryClient.routes()
                    .delete(DeleteRouteRequest.builder()
                            .async(true)
                            .routeId(routeId)
                            .build()))
            .flatMap(job -> JobUtils.waitForCompletion(cloudFoundryClient, job));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:25,代码来源:CloudFoundryCleaner.java

示例9: cleanServiceInstances

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private static Flux<Void> cleanServiceInstances(CloudFoundryClient cloudFoundryClient) {
    return PaginationUtils.
            requestClientV2Resources(page -> cloudFoundryClient.serviceInstances()
                    .list(ListServiceInstancesRequest.builder()
                            .page(page)
                            .build()))
            .filter(serviceInstance -> ResourceUtils.getEntity(serviceInstance).getName().startsWith("test-service-instance-"))
            .map(ResourceUtils::getId)
            .flatMap(serviceInstanceId -> cloudFoundryClient.serviceInstances()
                    .delete(DeleteServiceInstanceRequest.builder()
                            .async(true)
                            .serviceInstanceId(serviceInstanceId)
                            .build()))
            .flatMap(job -> JobUtils.waitForCompletion(cloudFoundryClient, job));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:16,代码来源:CloudFoundryCleaner.java

示例10: getRuleDescription

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private static Mono<String> getRuleDescription(CloudFoundryClient cloudFoundryClient, String bindingId, String serviceInstanceId) {
    return getServiceInstance(cloudFoundryClient, serviceInstanceId)
            .then(serviceInstance -> Mono.when(
                    Mono.just(bindingId),
                    Mono.just(serviceInstance),
                    getPlan(cloudFoundryClient, serviceInstance.getServicePlanId()).map(ServicePlanEntity::getServiceId)
            ))
            .then(function((serviceBindingId, serviceInstance, serviceId) -> getService(cloudFoundryClient, serviceId)
                    .map(ServiceEntity::getServiceBrokerId)
                    .map(serviceBrokerId -> Tuples.of(serviceBindingId, serviceInstance, serviceBrokerId))))
            .then(function((serviceBindingId, serviceInstance, serviceBrokerId) -> getServiceBrokerName(cloudFoundryClient, serviceBrokerId)
                    .map(serviceBrokerName -> Tuples.of(serviceBindingId, serviceInstance, serviceBrokerName))))
            .map(function((servicebindingId, serviceInstance, serviceBrokerName) -> ImmutableRuleDescription.builder()
                    .servicebindingId(servicebindingId)
                    .serviceInstanceName(serviceInstance.getName())
                    .serviceBrokerName(serviceBrokerName).build()
                    .value()));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:19,代码来源:CreateSecurityGroup.java

示例11: givenSecurityGroupExists

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private void givenSecurityGroupExists(CloudFoundryClient cloudFoundryClient, String securityGroupName) {
    given(cloudFoundryClient.securityGroups()
            .list(ListSecurityGroupsRequest.builder()
                    .name(securityGroupName)
                    .page(1)
                    .build()))
            .willReturn(Mono
                    .just(ListSecurityGroupsResponse.builder()
                            .resource(SecurityGroupResource.builder()
                                    .metadata(Metadata.builder()
                                            .id("test-securitygroup-id")
                                            .build())
                                    .build())
                            .totalPages(1)
                            .build()));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:17,代码来源:DeleteSecurityGroupTest.java

示例12: givenCreateSecurityGroupsFailsWithDelay

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private void givenCreateSecurityGroupsFailsWithDelay(CloudFoundryClient cloudFoundryClient, String securityGroupName) {
    given(cloudFoundryClient.securityGroups()
            .create(CreateSecurityGroupRequest.builder()
                    .name(securityGroupName)
                    .spaceId("space_id")
                    .rule(RuleEntity.builder()
                            .description(RULE_DESCRIPTION)
                            .protocol(Protocol.TCP)
                            .ports("3306")
                            .destination("127.0.0.1")
                            .build())
                    .build()))
            .willReturn(Mono
                    .delay(Duration.ofSeconds(2))
                    .then(Mono.error(new ClientV2Exception(null, 999, "test-exception-description", "test-exception-errorCode"))));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:17,代码来源:CreateSecurityGroupTest.java

示例13: givenCreateSecurityGroupsSucceeds

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private void givenCreateSecurityGroupsSucceeds(CloudFoundryClient cloudFoundryClient, String securityGroupName) {
    given(cloudFoundryClient.securityGroups()
            .create(CreateSecurityGroupRequest.builder()
                    .name(securityGroupName)
                    .spaceId("space_id")
                    .rule(RuleEntity.builder()
                            .description(RULE_DESCRIPTION)
                            .protocol(Protocol.TCP)
                            .ports("3306")
                            .destination("127.0.0.1")
                            .build())
                    .build()))
            .willReturn(Mono.just(CreateSecurityGroupResponse.builder()
                    .entity(SecurityGroupEntity.builder()
                            .name(securityGroupName)
                            .rule(RuleEntity.builder()
                                    .protocol(Protocol.TCP)
                                    .ports("3306")
                                    .destination("127.0.0.1")
                                    .build())
                            .build())
                    .build()));
}
 
开发者ID:orange-cloudfoundry,项目名称:sec-group-broker-filter,代码行数:24,代码来源:CreateSecurityGroupTest.java

示例14: getCfOperations

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的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: runtimeEnvironmentInfo

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private RuntimeEnvironmentInfo runtimeEnvironmentInfo(Class spiClass, Class implementationClass) {
	CloudFoundryClient client = connectionConfiguration.cloudFoundryClient(
		connectionConfiguration.connectionContext(connectionConfiguration.cloudFoundryConnectionProperties()),
		connectionConfiguration.tokenProvider(connectionConfiguration.cloudFoundryConnectionProperties()));
	Version version = connectionConfiguration.version(client);
	return new RuntimeEnvironmentInfo.Builder()
		.implementationName(implementationClass.getSimpleName())
		.spiClass(spiClass)
		.implementationVersion(RuntimeVersionUtils.getVersion(CloudFoundryAppDeployer.class))
		.platformType("Cloud Foundry")
		.platformClientVersion(RuntimeVersionUtils.getVersion(client.getClass()))
		.platformApiVersion(version.toString())
		.platformHostVersion("unknown")
		.addPlatformSpecificInfo("API Endpoint", connectionConfiguration.cloudFoundryConnectionProperties().getUrl().toString())
		.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-deployer-cloudfoundry,代码行数:17,代码来源:CloudFoundryDeployerAutoConfiguration.java


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