本文整理汇总了Java中org.openstack4j.openstack.OSFactory.clientFromAccess方法的典型用法代码示例。如果您正苦于以下问题:Java OSFactory.clientFromAccess方法的具体用法?Java OSFactory.clientFromAccess怎么用?Java OSFactory.clientFromAccess使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openstack4j.openstack.OSFactory
的用法示例。
在下文中一共展示了OSFactory.clientFromAccess方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: teardownTest
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
@Override
public final void teardownTest(JavaSamplerContext context) {
// we only need one teardown invocation
if (teardownDone || os == null)
return;
teardownDone = true;
log.debug("cleaning resources");
try {
// this method is executed from the JMeter main thread, this means we need to re-wire a token to instantiate
// a lightweight client without re-authentication
Access access = os.getAccess();
os = OSFactory.clientFromAccess(access);
// call the actual teardown
teardown(context);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
示例2: create
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
@Override
public synchronized OSClient create() {
checkState(cloud.endpoint().isPresent(),
String.format("%s requires endpoint to be present", this));
final String[] split = cloud.credential().user().split(":");
checkState(split.length == 2, "Illegal username, expected tenant:user");
final String tenantName = split[0];
final String userName = split[1];
if (access == null) {
final OSClient.OSClientV2 authenticate =
OSFactory.builderV2().endpoint(cloud.endpoint().get())
.credentials(userName, cloud.credential().password()).tenantName(tenantName)
.authenticate();
this.access = authenticate.getAccess();
return authenticate;
}
return OSFactory.clientFromAccess(access);
}
示例3: os_client
import org.openstack4j.openstack.OSFactory; //导入方法依赖的package包/类
public static synchronized OSClient os_client(PluginSettings pluginSettings) throws Exception {
if (pluginSettings.equals(OpenStackClientFactory.pluginSettings) && OpenStackClientFactory.client != null ) {
if (OpenStackClientFactory.client.getToken().getExpires().after(new Date(System.currentTimeMillis() + 5*60*1000))){
LOG.debug("OpenStackClientFactory - token is still valid : " + OpenStackClientFactory.client.getToken().getExpires().toString());
return OSFactory.clientFromAccess(client.getAccess());
}
}
OpenStackClientFactory.pluginSettings = pluginSettings;
OpenStackClientFactory.client = createClient(pluginSettings);
return OpenStackClientFactory.client;
}
示例4: 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));
}
}