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


Java GoogleComputeEngineApi类代码示例

本文整理汇总了Java中org.jclouds.googlecomputeengine.GoogleComputeEngineApi的典型用法代码示例。如果您正苦于以下问题:Java GoogleComputeEngineApi类的具体用法?Java GoogleComputeEngineApi怎么用?Java GoogleComputeEngineApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GoogleComputeEngineApi类属于org.jclouds.googlecomputeengine包,在下文中一共展示了GoogleComputeEngineApi类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GceContext

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
public GceContext(Credentials credentials) {
  ComputeServiceContext context = ContextBuilder.newBuilder("google-compute-engine")
      .modules(Arrays.asList(
              new SshjSshClientModule(),
              new EnterpriseConfigurationModule(),
              new SLF4JLoggingModule()))
      .credentials(credentials.identity, credentials.credential)
      .buildView(ComputeServiceContext.class);
  computeService = context.getComputeService();
  gceApi = context.unwrapApi(GoogleComputeEngineApi.class);
  fireWallApi = gceApi.firewalls();
  networkApi = gceApi.networks();
  routeApi = gceApi.routes();
  this.credentials = credentials;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:16,代码来源:GceContext.java

示例2: validateCredentials

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
/**
 *
 * @param credentials
 * @return
 * @throws InvalidCredentialsException
 */
public static GceContext validateCredentials(Credentials credentials) throws InvalidCredentialsException {
  try {
    GceContext context = new GceContext(credentials);
    GoogleComputeEngineApi gceApi = context.getGceApi();
    String projectName = gceApi.project().get().name();
    context.setProjectName(projectName);
    logger.info(String.format("Sucessfully Authenticated to project %s", projectName));
    return context;
  } catch (AuthorizationException e) {
    throw new InvalidCredentialsException("accountid:" + credentials.identity, e);
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:19,代码来源:GceLauncher.java

示例3: getGCEApi

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
private GoogleComputeEngineApi getGCEApi() {
    IaasProvider iaasInfo = getIaasProvider();
    ComputeServiceContext context = iaasInfo.getComputeService().getContext();
    GoogleComputeEngineApi api = context.unwrapApi(GoogleComputeEngineApi.class);

    return api;
}
 
开发者ID:apache,项目名称:stratos,代码行数:8,代码来源:GCEIaas.java

示例4: getGceApi

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
public GoogleComputeEngineApi getGceApi() {
  return gceApi;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:4,代码来源:GceContext.java

示例5: DeleteStartupScript

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
public static void DeleteStartupScript(GoogleComputeEngineApi googleApi){
   Metadata metadata = googleApi.project().get().commonInstanceMetadata();
   metadata.remove("startup-script");
   googleApi.project().setCommonInstanceMetadata(metadata);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:6,代码来源:MainApp.java

示例6: createGoogleComputeEngineApi

import org.jclouds.googlecomputeengine.GoogleComputeEngineApi; //导入依赖的package包/类
private static GoogleComputeEngineApi createGoogleComputeEngineApi(String identity, String credential){
   ContextBuilder contextBuilder = ContextBuilder.newBuilder(GoogleComputeEngineProviderMetadata.builder().build())
         .credentials(identity, credential);
   Injector injector = contextBuilder.buildInjector();
   return injector.getInstance(GoogleComputeEngineApi.class);
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:7,代码来源:MainApp.java


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