use of org.cloudfoundry.reactor.DefaultConnectionContext in project TOSCAna by StuPro-TOSCAna.
the class Connection method createCloudFoundryOperations.
/**
* create a Connection to a cloud foundry instance.
* A CLoudFoundryOperation could send cf commands
*/
private CloudFoundryOperations createCloudFoundryOperations() {
CloudFoundryOperations cloudFoundryOperations;
try {
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 = DefaultCloudFoundryOperations.builder().cloudFoundryClient(reactorClient).organization(organization).space(space).build();
} catch (Exception e) {
logger.error("Cant connect to Cloud Foundry instance");
throw new TransformationFailureException("Could not connect to Cloud Foundry instance, Please check your credentials", e);
}
logger.info("Connect successfully to Cloud Foundry instance");
return cloudFoundryOperations;
}
use of org.cloudfoundry.reactor.DefaultConnectionContext in project promregator by promregator.
the class ReactiveCFAccessorImpl method constructCloudFoundryClient.
@PostConstruct
private void constructCloudFoundryClient() throws ConfigurationException {
ProxyConfiguration proxyConfiguration = this.proxyConfiguration();
DefaultConnectionContext connectionContext = this.connectionContext(proxyConfiguration);
PasswordGrantTokenProvider tokenProvider = this.tokenProvider();
this.cloudFoundryClient = this.cloudFoundryClient(connectionContext, tokenProvider);
}
Aggregations