org.cloudfoundry.client.CloudFoundryClient Java Examples
The following examples show how to use
org.cloudfoundry.client.CloudFoundryClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractCfTask.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 6 votes |
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(); DefaultCloudFoundryOperations cfOperations = DefaultCloudFoundryOperations.builder() .cloudFoundryClient(cfClient) .organization(cfAppProperties.org()) .space(cfAppProperties.space()) .build(); return cfOperations; }
Example #2
Source File: CloudFoundryTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
private RuntimeEnvironmentInfo runtimeEnvironmentInfo(CloudFoundryClient cloudFoundryClient, String account) { return new CloudFoundryPlatformSpecificInfo(new RuntimeEnvironmentInfo.Builder()) .apiEndpoint(connectionProperties(account).getUrl().toString()) .org(connectionProperties(account).getOrg()) .space(connectionProperties(account).getSpace()) .builder() .implementationName(CloudFoundryAppDeployer.class.getSimpleName()) .spiClass(AppDeployer.class) .implementationVersion( RuntimeVersionUtils.getVersion(CloudFoundryAppDeployer.class)) .platformType("Cloud Foundry") .platformClientVersion( RuntimeVersionUtils.getVersion(cloudFoundryClient.getClass())) .platformApiVersion(version(cloudFoundryClient, account).toString()).platformHostVersion("unknown") .build(); }
Example #3
Source File: CloudFoundryTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 6 votes |
@Override public Launcher createLauncher(String account) { ConnectionContext connectionContext = connectionContext(account); TokenProvider tokenProvider = tokenProvider(account); CloudFoundryClient cloudFoundryClient = cloudFoundryClient(account); CloudFoundryOperations cloudFoundryOperations = cloudFoundryOperations(cloudFoundryClient, account); CloudFoundryTaskLauncher taskLauncher = new CloudFoundryTaskLauncher( cloudFoundryClient, deploymentProperties(account), cloudFoundryOperations, runtimeEnvironmentInfo(cloudFoundryClient, account)); Launcher launcher = new Launcher(account, CLOUDFOUNDRY_PLATFORM_TYPE, taskLauncher, scheduler(account, taskLauncher, cloudFoundryOperations)); CloudFoundryConnectionProperties connectionProperties = connectionProperties(account); launcher.setDescription(String.format("org = [%s], space = [%s], url = [%s]", connectionProperties.getOrg(), connectionProperties.getSpace(), connectionProperties.getUrl())); return launcher; }
Example #4
Source File: CloudControllerRestClientImpl.java From cf-java-client-sap with Apache License 2.0 | 6 votes |
public CloudControllerRestClientImpl(URL controllerUrl, CloudCredentials credentials, RestTemplate restTemplate, OAuthClient oAuthClient, CloudFoundryClient delegate, DopplerClient dopplerClient, CloudSpace target) { Assert.notNull(controllerUrl, "CloudControllerUrl cannot be null"); Assert.notNull(restTemplate, "RestTemplate cannot be null"); Assert.notNull(oAuthClient, "OAuthClient cannot be null"); this.controllerUrl = controllerUrl; this.credentials = credentials; this.restTemplate = restTemplate; this.oAuthClient = oAuthClient; this.target = target; this.delegate = delegate; this.dopplerClient = dopplerClient; }
Example #5
Source File: CloudFoundryTestSupport.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 6 votes |
@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(); }
Example #6
Source File: CloudFoundryDeployerAutoConfiguration.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 6 votes |
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 CloudFoundryPlatformSpecificInfo(new RuntimeEnvironmentInfo.Builder()) .apiEndpoint(connectionConfiguration.cloudFoundryConnectionProperties().getUrl().toString()) .org(connectionConfiguration.cloudFoundryConnectionProperties().getOrg()) .space(connectionConfiguration.cloudFoundryConnectionProperties().getSpace()) .builder() .implementationName(implementationClass.getSimpleName()) .spiClass(spiClass) .implementationVersion(RuntimeVersionUtils.getVersion(CloudFoundryAppDeployer.class)) .platformType("Cloud Foundry") .platformClientVersion(RuntimeVersionUtils.getVersion(client.getClass())) .platformApiVersion(version.toString()) .platformHostVersion("unknown") .build(); }
Example #7
Source File: AbstractCloudFoundryTaskLauncher.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
AbstractCloudFoundryTaskLauncher(CloudFoundryClient client, CloudFoundryDeploymentProperties deploymentProperties, RuntimeEnvironmentInfo runtimeEnvironmentInfo) { super(deploymentProperties, runtimeEnvironmentInfo); this.client = client; organizationId = organizationId(); spaceId = spaceId(); }
Example #8
Source File: CloudFoundryClientConfiguration.java From bootiful-testing-online-training with Apache License 2.0 | 5 votes |
@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(); }
Example #9
Source File: CloudFoundryTaskLauncher.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
public CloudFoundryTaskLauncher(CloudFoundryClient client, CloudFoundryDeploymentProperties deploymentProperties, CloudFoundryOperations operations, RuntimeEnvironmentInfo runtimeEnvironmentInfo) { super(client, deploymentProperties, runtimeEnvironmentInfo); this.client = client; this.deploymentProperties = deploymentProperties; this.operations = operations; }
Example #10
Source File: CloudFoundryDeployerAutoConfiguration.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public CloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient, CloudFoundryConnectionProperties properties) { return DefaultCloudFoundryOperations.builder() .cloudFoundryClient(cloudFoundryClient) .organization(properties.getOrg()) .space(properties.getSpace()) .build(); }
Example #11
Source File: CloudFoundryDeployerAutoConfiguration.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public Version version(CloudFoundryClient client) { return client.info() .get(GetInfoRequest.builder() .build()) .map(response -> Version.valueOf(response.getApiVersion())) .doOnError(e -> { throw new RuntimeException("Bad credentials connecting to Cloud Foundry.", e); }) .doOnNext(version -> logger.info("Connecting to Cloud Foundry with API Version {}", version)) .block(Duration.ofSeconds(appDeploymentProperties().getApiTimeout())); }
Example #12
Source File: CloudFoundryDeployerAutoConfiguration.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@Bean @ConditionalOnMissingBean public CloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }
Example #13
Source File: PcfDevIntegrationTests.java From ya-cf-app-gradle-plugin with Apache License 2.0 | 5 votes |
@Test public void getAppDetailTests() { ConnectionContext connectionContext = DefaultConnectionContext.builder() .apiHost("api.local.pcfdev.io") .skipSslValidation(true) .build(); TokenProvider tokenProvider = PasswordGrantTokenProvider.builder() .password("admin") .username("admin") .build(); CloudFoundryClient cfClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); CloudFoundryOperations cfOperations = DefaultCloudFoundryOperations.builder() .cloudFoundryClient(cfClient) .organization("pcfdev-org") .space("pcfdev-space") .build(); CfAppDetailsDelegate appDetailsTaskDelegate = new CfAppDetailsDelegate(); CfProperties cfAppProps = envDetails(); Mono<Optional<ApplicationDetail>> applicationDetailMono = appDetailsTaskDelegate .getAppDetails(cfOperations, cfAppProps); // Mono<Void> resp = applicationDetailMono.then(applicationDetail -> Mono.fromSupplier(() -> { // return 1; // })).then(); // // resp.block(); // ApplicationDetail applicationDetail = applicationDetailMono.block(Duration.ofMillis(5000)); // System.out.println("applicationDetail = " + applicationDetail); }
Example #14
Source File: CloudFoundryTestSupport.java From spring-cloud-deployer-cloudfoundry with Apache License 2.0 | 5 votes |
@Bean public CloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }
Example #15
Source File: CloudFoundryPlatformClientProvider.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
public CloudFoundryClient cloudFoundryClient(String account){ cloudFoundryClients.putIfAbsent(account, ReactorCloudFoundryClient.builder() .connectionContext(connectionContextProvider.connectionContext(account)) .tokenProvider(platformTokenProvider.tokenProvider(account)) .build()); return cloudFoundryClients.get(account); }
Example #16
Source File: CloudFoundryTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private CloudFoundryOperations cloudFoundryOperations(CloudFoundryClient cloudFoundryClient, String account) { return DefaultCloudFoundryOperations .builder().cloudFoundryClient(cloudFoundryClient) .organization(connectionProperties(account).getOrg()) .dopplerClient(ReactorDopplerClient.builder() .connectionContext(connectionContext(account)) .tokenProvider(tokenProvider(account)).build()) .space(connectionProperties(account).getSpace()).build(); }
Example #17
Source File: CloudFoundryTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
private Version version(CloudFoundryClient cloudFoundryClient, String account) { return cloudFoundryClient.info() .get(GetInfoRequest.builder().build()) .map(response -> Version.valueOf(response.getApiVersion())) .doOnNext(versionInfo -> logger.info( "Connecting to Cloud Foundry with API Version {}", versionInfo)) .timeout(Duration.ofSeconds(deploymentProperties(account).getApiTimeout())) .block(); }
Example #18
Source File: CloudFoundryClientAutoConfiguration.java From spring-cloud-cloudfoundry with Apache License 2.0 | 5 votes |
@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(); }
Example #19
Source File: CloudControllerRestClientFactory.java From cf-java-client-sap with Apache License 2.0 | 5 votes |
public CloudControllerRestClient createClient(URL controllerUrl, CloudCredentials credentials, CloudSpace target, OAuthClient oAuthClient) { RestTemplate restTemplate = createAuthorizationSettingRestTemplate(credentials, oAuthClient); CloudFoundryClient delegate = getCloudFoundryClientFactory().createClient(controllerUrl, oAuthClient); DopplerClient dopplerClient = getCloudFoundryClientFactory().createDopplerClient(controllerUrl, oAuthClient); return new CloudControllerRestClientImpl(controllerUrl, credentials, restTemplate, oAuthClient, delegate, dopplerClient, target); }
Example #20
Source File: CfConfiguration.java From spring-cloud-release-tools with Apache License 2.0 | 5 votes |
@Bean DefaultCloudFoundryOperations defaultCloudFoundryOperations( CloudFoundryClient cloudFoundryClient, DopplerClient dopplerClient, UaaClient uaaClient, @Value("${cf.organization}") String organizationId, @Value("${cf.space}") String spaceId) { return DefaultCloudFoundryOperations.builder() .cloudFoundryClient(cloudFoundryClient).dopplerClient(dopplerClient) .uaaClient(uaaClient).organization(organizationId).space(spaceId).build(); }
Example #21
Source File: CloudFoundryAppDeployerAutoConfiguration.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
/** * Provide a {@link CloudFoundryOperations} bean * * @param properties the CloudFoundryTargetProperties bean * @param client the CloudFoundryClient bean * @param dopplerClient the DopplerClient bean * @param uaaClient the UaaClient bean * @return the bean */ @Bean public CloudFoundryOperations cloudFoundryOperations(CloudFoundryTargetProperties properties, CloudFoundryClient client, DopplerClient dopplerClient, @UaaClientQualifier UaaClient uaaClient) { return DefaultCloudFoundryOperations.builder() .cloudFoundryClient(client) .dopplerClient(dopplerClient) .uaaClient(uaaClient) .organization(properties.getDefaultOrg()) .space(properties.getDefaultSpace()) .build(); }
Example #22
Source File: PlatformCloudFoundryOperations.java From spring-cloud-skipper with Apache License 2.0 | 5 votes |
private CloudFoundryOperations buildCloudFoundryOperations(String platformName) { CloudFoundryPlatformProperties.CloudFoundryProperties cloudFoundryProperties = this.cloudFoundryPlatformProperties .getAccounts() .get(platformName); CloudFoundryConnectionProperties connectionProperties = cloudFoundryProperties.getConnection(); ConnectionContext connectionContext = DefaultConnectionContext.builder() .apiHost(connectionProperties.getUrl().getHost()) .skipSslValidation(connectionProperties.isSkipSslValidation()) .build(); Builder tokenProviderBuilder = PasswordGrantTokenProvider.builder() .username(connectionProperties.getUsername()) .password(connectionProperties.getPassword()) .loginHint(connectionProperties.getLoginHint()); if (StringUtils.hasText(connectionProperties.getClientId())) { tokenProviderBuilder.clientId(connectionProperties.getClientId()); } if (StringUtils.hasText(connectionProperties.getClientSecret())) { tokenProviderBuilder.clientSecret(connectionProperties.getClientSecret()); } TokenProvider tokenProvider = tokenProviderBuilder.build(); CloudFoundryClient cloudFoundryClient = ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); return DefaultCloudFoundryOperations .builder().cloudFoundryClient(cloudFoundryClient) .organization(connectionProperties.getOrg()) .space(connectionProperties.getSpace()).build(); }
Example #23
Source File: CloudFoundryClientConfiguration.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Bean protected CloudFoundryClient cloudFoundryClient(ConnectionContext connectionContext, @Qualifier("userCredentials") TokenProvider tokenProvider) { return ReactorCloudFoundryClient.builder() .connectionContext(connectionContext) .tokenProvider(tokenProvider) .build(); }
Example #24
Source File: CloudFoundryClientConfiguration.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Bean protected CloudFoundryOperations cloudFoundryOperations(CloudFoundryProperties properties, CloudFoundryClient client, DopplerClient dopplerClient, UaaClient uaaClient) { return DefaultCloudFoundryOperations.builder() .cloudFoundryClient(client) .dopplerClient(dopplerClient) .uaaClient(uaaClient) .organization(properties.getDefaultOrg()) .space(properties.getDefaultSpace()) .build(); }
Example #25
Source File: CloudFoundryAppDeployer.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
public CloudFoundryAppDeployer(CloudFoundryDeploymentProperties deploymentProperties, CloudFoundryOperations operations, CloudFoundryClient client, CloudFoundryOperationsUtils operationsUtils, CloudFoundryTargetProperties targetProperties, ResourceLoader resourceLoader) { this.defaultDeploymentProperties = deploymentProperties; this.operations = operations; this.client = client; this.operationsUtils = operationsUtils; this.targetProperties = targetProperties; this.resourceLoader = resourceLoader; }
Example #26
Source File: DopplerLogStreamPublisher.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
public DopplerLogStreamPublisher( CloudFoundryClient client, DopplerClient dopplerClient, ApplicationIdsProvider applicationIdsProvider ) { this.client = client; this.dopplerClient = dopplerClient; this.applicationIdsProvider = applicationIdsProvider; }
Example #27
Source File: ServiceInstanceLogStreamAutoConfiguration.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean public LogStreamPublisher<Envelope> streamLogsPublisher(CloudFoundryClient cloudFoundryClient, DopplerClient dopplerClient, ApplicationIdsProvider applicationIdsProvider) { return new DopplerLogStreamPublisher(cloudFoundryClient, dopplerClient, applicationIdsProvider); }
Example #28
Source File: ServiceInstanceRecentLogsAutoConfiguration.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
@Bean public RecentLogsProvider recentLogsProvider(CloudFoundryClient cloudFoundryClient, DopplerClient dopplerClient, ApplicationIdsProvider applicationIdsProvider) { return new ApplicationRecentLogsProvider(cloudFoundryClient, dopplerClient, applicationIdsProvider); }
Example #29
Source File: CloudFoundryTaskPlatformFactory.java From spring-cloud-dataflow with Apache License 2.0 | 4 votes |
private CloudFoundryClient cloudFoundryClient(String account) { return cloudFoundryClientProvider.cloudFoundryClient(account); }
Example #30
Source File: ApplicationRecentLogsProvider.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
public ApplicationRecentLogsProvider(CloudFoundryClient client, DopplerClient dopplerClient, ApplicationIdsProvider applicationIdsProvider) { this.client = client; this.dopplerClient = dopplerClient; this.applicationIdsProvider = applicationIdsProvider; }