当前位置: 首页>>代码示例>>Java>>正文


Java OSFactory.clientFromAccess方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:savoirfairelinux,项目名称:jmeter-openstack,代码行数:22,代码来源:AbstractOpenstackSampler.java

示例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);
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:22,代码来源:OsClientV2Factory.java

示例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;
}
 
开发者ID:gocd-contrib,项目名称:openstack-elastic-agent,代码行数:12,代码来源:OpenStackClientFactory.java

示例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));
    }
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:12,代码来源:OpenStackClient.java


注:本文中的org.openstack4j.openstack.OSFactory.clientFromAccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。