本文整理汇总了Java中org.openstack4j.openstack.OSFactory.clientFromToken方法的典型用法代码示例。如果您正苦于以下问题:Java OSFactory.clientFromToken方法的具体用法?Java OSFactory.clientFromToken怎么用?Java OSFactory.clientFromToken使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openstack4j.openstack.OSFactory
的用法示例。
在下文中一共展示了OSFactory.clientFromToken方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAvailableSession
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
OSClient.OSClientV3 getAvailableSession(Endpoint endpoint) {
OSClient.OSClientV3 localOs;
Config config = Config.newConfig().withSSLContext(endpoint.getSslContext()).withHostnameVerifier((hostname, session) -> true);
if (connectionsMap.containsKey(endpoint)) {
localOs = OSFactory.clientFromToken(connectionsMap.get(endpoint), Facing.PUBLIC, config);
} else {
String endpointURL;
try {
endpointURL = prepareEndpointURL(endpoint);
} catch (URISyntaxException | MalformedURLException e) {
throw new RuntimeException(e.getMessage(), e);
}
// LOGGER
OSFactory.enableHttpLoggingFilter(log.isDebugEnabled() || log.isInfoEnabled());
Identifier domainIdentifier = Identifier.byId(endpoint.getDomainId());
IOSClientBuilder.V3 keystoneV3Builder = OSFactory.builderV3().perspective(Facing.PUBLIC)
.endpoint(endpointURL)
.credentials(endpoint.getUser(), endpoint.getPassword(), domainIdentifier)
.scopeToProject(Identifier.byName(endpoint.getProject()), domainIdentifier)
.withConfig(config);
localOs = keystoneV3Builder.authenticate();
connectionsMap.put(endpoint, localOs.getToken());
}
return localOs;
}
示例2: reauth
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
public void reauth()
throws AuthenticationException {
// Re auth if token expired
if (this.token.getExpires().getTime() > new Date().getTime()) {
this.authenticate();
}
this.os = OSFactory.clientFromToken(this.token);
}
示例3: createOSClient
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
public OSClient createOSClient(AuthenticatedContext authenticatedContext) {
String facing = authenticatedContext.getCloudCredential().getStringParameter(FACING);
if (isV2Keystone(authenticatedContext)) {
Access access = authenticatedContext.getParameter(Access.class);
return OSFactory.clientFromAccess(access, Facing.value(facing));
} else {
Token token = authenticatedContext.getParameter(Token.class);
return OSFactory.clientFromToken(token, Facing.value(facing));
}
}
示例4: authFromToken
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
private OSClient authFromToken() {
return OSFactory.clientFromToken(token);
}