本文整理汇总了Java中org.cloudfoundry.client.lib.CloudFoundryClient类的典型用法代码示例。如果您正苦于以下问题:Java CloudFoundryClient类的具体用法?Java CloudFoundryClient怎么用?Java CloudFoundryClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CloudFoundryClient类属于org.cloudfoundry.client.lib包,在下文中一共展示了CloudFoundryClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCloudFoundryClientAsAdmin
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
if (this.cfAdminUser == null
|| this.cfAdminUser.isEmpty()
|| this.cfAdminPassword == null
|| this.cfAdminPassword.isEmpty()
|| this.cloudControllerUrl == null
|| this.cloudControllerUrl.isEmpty()
|| this.noCloudFoundryAccess) {
return null;
}
CloudOrganization cloudOrganization = this.getOrg();
CloudSpace cloudSpace = this.getSpace();
if (cloudOrganization == null || cloudSpace == null) {
return null;
}
logger.info(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
示例2: cloudFoundryClient
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean
public CloudFoundryClient cloudFoundryClient() {
CloudFoundryClient mockClient = mock(CloudFoundryClient.class);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
ApplicationLogListener listener = invocation.getArgumentAt(1, ApplicationLogListener.class);
listener.onMessage(new ApplicationLog("foo", "hello", new Date(1),
ApplicationLog.MessageType.STDOUT, "srcN", "srcID"));
listener.onComplete();
return null;
}
}).when(mockClient).streamLogs(eq("foo"), any(ApplicationLogListener.class));
return mockClient;
}
示例3: getCloudFoundryClientAsAdmin
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsAdmin")
public CloudFoundryClient getCloudFoundryClientAsAdmin() throws MalformedURLException {
if (this.cfAdminUser == null
|| this.cfAdminUser.isEmpty()
|| this.cfAdminPassword == null
|| this.cfAdminPassword.isEmpty()
|| this.cloudControllerUrl == null
|| this.cloudControllerUrl.isEmpty()
|| this.noCloudFoundryAccess) {
return null;
}
CloudOrganization cloudOrganization = this.getOrg();
CloudSpace cloudSpace = this.getSpace();
if (cloudOrganization == null || cloudSpace == null) {
return null;
}
logger.debug(String.format("Creating new CloudFoundry client using admin access with org '%s' and space '%s'", cloudOrganization.getName(), cloudSpace.getName()));
return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl, cloudOrganization.getName(), cloudSpace.getName());
}
示例4: getCloudFoundryOperations
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
public CloudFoundryOperations getCloudFoundryOperations(CloudCredentials credentials, URL url, CloudSpace session,
boolean selfSigned) {
// Proxies are always updated on each client call by the
// CloudFoundryServerBehaviour Request as well as the client login
// handler
// therefore it is not critical to set the proxy in the client on
// client
// creation
HttpProxyConfiguration proxyConfiguration = getProxy(url);
//@ TODO tentatively set selfSigned = true
selfSigned = true;
return session != null ? new CloudFoundryClient(credentials, url, session, selfSigned)
: new CloudFoundryClient(credentials, url, proxyConfiguration, selfSigned);
}
示例5: login
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
public static CloudFoundryOperations login(CloudCredentials credentials, URL apiUrl, String space, String org, String domain, boolean trustSelfSignedCerts, HttpProxyConfiguration httpProxyConfiguration) {
logger.info("Running on " + apiUrl + " on behalf of " + credentials.getEmail());
logger.info("Using space " + space + " of organization " + org + " with domain " + domain);
if (httpProxyConfiguration != null) {
logger.info("Using proxy to connnect to clound foundry: httpProxyHost=" + httpProxyConfiguration.getProxyHost() + " httpProxyPort=" + httpProxyConfiguration.getProxyPort() );
}
else {
logger.info("Connection to clound foundry will not use proxy. no proxy is set. ");
}
CloudFoundryClient clientWithinTargetSpace = new CloudFoundryClient(credentials, apiUrl, org, space, httpProxyConfiguration,
trustSelfSignedCerts);
clientWithinTargetSpace.login();
// getOrCreateDomain(domain);
return clientWithinTargetSpace;
}
示例6: run
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
String msg = StringUtil.format("Testing connection to \"{0}\"...", _server); // $NLX-PreferencePage.Testingconnectionto0-1$
monitor.beginTask(msg, IProgressMonitor.UNKNOWN);
try {
CloudCredentials credentials = new CloudCredentials(_userName, _password);
CloudFoundryClient client = new CloudFoundryClient(credentials, URI.create(_server).toURL());
client.login();
} catch (Throwable e) {
throw new InvocationTargetException(e);
}
if (monitor.isCanceled()) {
throw new InterruptedException();
}
}
示例7: initialiseClient
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@BeforeClass
public static void initialiseClient() throws IOException {
// Skip all tests of this class if no test CF platform is specified
assumeNotNull(TEST_TARGET);
String fullTarget = TEST_TARGET;
if (!fullTarget.startsWith("https://")) {
if (!fullTarget.startsWith("api.")) {
fullTarget = "https://api." + fullTarget;
} else {
fullTarget = "https://" + fullTarget;
}
}
URL targetUrl = new URL(fullTarget);
CloudCredentials credentials = new CloudCredentials(TEST_USERNAME, TEST_PASSWORD);
client = new CloudFoundryClient(credentials, targetUrl, TEST_ORG, TEST_SPACE);
client.login();
}
示例8: createCloudFoundryClient
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
public CloudFoundryClient createCloudFoundryClient(OAuth2AccessToken token, URL cloudControllerUrl, String org, String space) {
CloudCredentials credentials = new CloudCredentials(token, false);
if (httpProxyConfiguration == null) {
return new CloudFoundryClient(credentials, cloudControllerUrl, org, space);
}
return new CloudFoundryClient(credentials, cloudControllerUrl, org, space, httpProxyConfiguration);
}
示例9: getCloudFoundryClientTemp
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean
public CloudFoundryClient getCloudFoundryClientTemp() throws MalformedURLException {
if (this.cfAdminUser == null
|| this.cfAdminUser.isEmpty()
|| this.cfAdminPassword == null
|| this.cfAdminPassword.isEmpty()
|| this.cloudControllerUrl == null
|| this.cloudControllerUrl.isEmpty()
|| this.noCloudFoundryAccess) {
return null;
}
logger.info("Creating new CloudFoundry client using admin access");
return cloudFoundryClientFactory.createCloudFoundryClient(this.cfAdminUser, this.cfAdminPassword, this.cloudControllerUrl);
}
示例10: getOrg
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean
public CloudOrganization getOrg() throws MalformedURLException {
CloudFoundryClient cloudFoundryClient = this.getCloudFoundryClientTemp();
if (cloudFoundryClient == null) {
return null;
}
return cloudFoundryClient.getOrganizations().get(0);
}
示例11: getSpace
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean
public CloudSpace getSpace() throws MalformedURLException {
CloudFoundryClient cloudFoundryClient = this.getCloudFoundryClientTemp();
if (cloudFoundryClient == null) {
return null;
}
for (CloudSpace cloudSpace : getCloudFoundryClientTemp().getSpaces()) {
if (cloudSpace.getOrganization().getMeta().getGuid().equals(this.getOrg().getMeta().getGuid())) {
return cloudSpace;
}
}
return null;
}
示例12: loggregatorMessageSource
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean
public LoggregatorMessageSource loggregatorMessageSource(
@Qualifier(Source.OUTPUT) MessageChannel source,
CloudFoundryClient cloudFoundryClient) {
return new LoggregatorMessageSource(
this.loggregatorSourceProperties.getApplicationName(),
cloudFoundryClient, source);
}
开发者ID:spring-cloud,项目名称:spring-cloud-stream-app-starters,代码行数:9,代码来源:LoggregatorSourceConfiguration.java
示例13: LoggregatorMessageSource
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
protected LoggregatorMessageSource(
String applicationName,
CloudFoundryClient cloudFoundryClient,
MessageChannel out) {
super();
this.applicationName = applicationName;
this.cloudFoundryClient = cloudFoundryClient;
setOutputChannel(out);
}
示例14: getUserService
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
public CloudService getUserService(String serviceName, String token, String org, String space) {
CloudFoundryClient cloudFoundryClientUser;
if (org != null && space != null) {
cloudFoundryClientUser = cloudFoundryClientFactory.createCloudFoundryClient(token, this.cloudFoundryClient.getCloudControllerUrl(), org, space);
} else {
cloudFoundryClientUser = cloudFoundryClientFactory.createCloudFoundryClient(token, this.cloudFoundryClient.getCloudControllerUrl());
}
return cloudFoundryClientUser.getService(serviceName);
}
示例15: getCloudFoundryClientAsUser
import org.cloudfoundry.client.lib.CloudFoundryClient; //导入依赖的package包/类
@Bean(name = "cloudFoundryClientAsUser")
@Scope(value = "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
public CloudFoundryClient getCloudFoundryClientAsUser() throws MalformedURLException {
LOGGER.debug("Creating new CloudFoundry client using access token");
OAuth2AccessToken oAuth2AccessToken = getOAuth2AccessToken();
if (oAuth2AccessToken == null) {
return null;
}
return cloudFoundryClientFactory.createCloudFoundryClient(oAuth2AccessToken, this.cloudControllerUrl);
}