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

Java CloudFoundryClient类代码示例

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

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



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


示例16: cloudFoundryOperations

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


示例17: getClient

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private CloudFoundryClient getClient(RepositoryConfiguration repositoryConfiguration) {
    String api = repositoryConfiguration.get("REPO_URL").getValue();
    String username = repositoryConfiguration.get("USERNAME").getValue();
    String password = repositoryConfiguration.get("PASSWORD").getValue();

    LOGGER.debug("Cloud Foundry connection details: api: " + api + ", username " + username);

    ConnectionContext connectionContext = DefaultConnectionContext.builder()
            .apiHost(api)
            .skipSslValidation(true)
            .build();

    ReactorCloudFoundryClient client = ReactorCloudFoundryClient.builder()
            .connectionContext(connectionContext)
            .tokenProvider(PasswordGrantTokenProvider.builder()
                    .username(username)
                    .password(password)
                    .build())
            .build();

    return client;
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:23,代码来源:CloudFoundryPoller.java


示例18: accumulateV2Apps

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
private void accumulateV2Apps(CloudFoundryClient client, List<String> matchingApps) {
    ApplicationsV2 applicationsV2 = client.applicationsV2();

    ListApplicationsRequest listApplicationsRequest = ListApplicationsRequest.builder()
            .build();

    Mono<ListApplicationsResponse> responseMono = applicationsV2.list(listApplicationsRequest);

    try {
        ListApplicationsResponse response = responseMono.block();

        if (response.getTotalResults() > 0) {
            System.out.println(response.getTotalResults());
            response.getResources().forEach(app ->
                    matchingApps.add(app.getEntity().getName()));
        }
    } catch (Exception e) {
        LOGGER.warn("Failed to lookup V2 apps.");
    }
}
 
开发者ID:Sounie,项目名称:springer-gocd-cloudfoundry-plugin,代码行数:21,代码来源:CloudFoundryPoller.java


示例19: cloudFoundryOperations

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
@Bean
@Lazy
@ConditionalOnMissingBean
public DefaultCloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient,
															DopplerClient dopplerClient,
															RoutingClient routingClient,
															UaaClient uaaClient) {
	String organization = this.cloudFoundryProperties.getOrg();
	String space = this.cloudFoundryProperties.getSpace();
	return DefaultCloudFoundryOperations
			.builder()
			.cloudFoundryClient(cloudFoundryClient)
			.dopplerClient(dopplerClient)
			.routingClient(routingClient)
			.uaaClient(uaaClient)
			.organization(organization)
			.space(space)
			.build();
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-cloudfoundry,代码行数:20,代码来源:CloudFoundryClientAutoConfiguration.java


示例20: cloudFoundryOperations

import org.cloudfoundry.client.CloudFoundryClient; //导入依赖的package包/类
@Bean
public DefaultCloudFoundryOperations cloudFoundryOperations(
        CloudFoundryClient cfc,
        ReactorDopplerClient dopplerClient,
        ReactorUaaClient uaaClient,
        @Value("${cf.org}") String organization,
        @Value("${cf.space}") String space) {
    return DefaultCloudFoundryOperations.builder()
            .cloudFoundryClient(cfc)
            .dopplerClient(dopplerClient)
            .uaaClient(uaaClient)
            .organization(organization)
            .space(space)
            .build();
}
 
开发者ID:applied-continuous-delivery-livelessons,项目名称:testing-101,代码行数:16,代码来源:CloudFoundryClientConfiguration.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java LuaClosure类代码示例发布时间:2022-05-22
下一篇:
Java PermissionAttachment类代码示例发布时间: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