• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CreateKeyPairResult类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
public static void main(String[] args)
{
    final String USAGE =
        "To run this example, supply a key pair name\n" +
        "Ex: CreateKeyPair <key-pair-name>\n";

    if (args.length != 1) {
        System.out.println(USAGE);
        System.exit(1);
    }

    String key_name = args[0];

    final AmazonEC2 ec2 = AmazonEC2ClientBuilder.defaultClient();

    CreateKeyPairRequest request = new CreateKeyPairRequest()
        .withKeyName(key_name);

    CreateKeyPairResult response = ec2.createKeyPair(request);

    System.out.printf(
        "Successfulyl created key pair named %s",
        key_name);
}
 
开发者ID:awsdocs,项目名称:aws-doc-sdk-examples,代码行数:25,代码来源:CreateKeyPair.java


示例2: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
private void createKeyPair() throws IOException, FileNotFoundException {
	DescribeKeyPairsResult response = ec2.describeKeyPairs();
	boolean check_key=false;
	for(KeyPairInfo key_pair : response.getKeyPairs()) {
		if(key_pair.getKeyName().equalsIgnoreCase(MY_KEY))
		{
			check_key=true;
			break;
		}
	}
	if(!check_key)
	{
		File file=new File(System.getProperty("user.home")+"/.aws/"+MY_KEY+".pem");
		if(!file.exists()) file.createNewFile();
		else{
			System.err.println("Connot create the key pair to access to the cluster!");
			System.exit(1);
		}
		System.out.println("Create new key pair ~/.aws/"+MY_KEY+".pem");
		CreateKeyPairRequest request = new CreateKeyPairRequest()
		.withKeyName(MY_KEY);

		CreateKeyPairResult responsetocreate = ec2.createKeyPair(request);


		PrintWriter print = new PrintWriter(file);
		print.print(responsetocreate.getKeyPair().getKeyMaterial());
		print.close();
		Runtime.getRuntime().exec("chmod 0400 "+System.getProperty("user.home")+"/.aws/"+MY_KEY+".pem");
	}
}
 
开发者ID:spagnuolocarmine,项目名称:aws-cluster-toolkit,代码行数:32,代码来源:AwsClusterManager.java


示例3: create

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
@Override
public String create(Instance instance) {
    CreateKeyPairRequest createKeyPairRequest = new CreateKeyPairRequest();
    createKeyPairRequest.withKeyName(instance.getKeyName());
    CreateKeyPairResult createKeyPairResult = ec2UserClient.amazonEC2Async().createKeyPair(createKeyPairRequest);

    KeyPair keyPair = createKeyPairResult.getKeyPair();

    return keyPair.getKeyMaterial();
}
 
开发者ID:peavers,项目名称:swordfish-service,代码行数:11,代码来源:EC2KeyPairImpl.java


示例4: createKeyValuePair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
/***
 * Creates a 2048-bit RSA key pair with the specified name
 *
 * @param keyName Key name to use
 * @return Unencrypted PEM encoded PKCS#8 private key
 */
public String createKeyValuePair(String keyName) {

  final AmazonEC2 amazonEC2 = getEc2Client();

  final CreateKeyPairRequest createKeyPairRequest = new CreateKeyPairRequest().withKeyName(keyName);
  final CreateKeyPairResult createKeyPairResult = amazonEC2.createKeyPair(createKeyPairRequest);
  final KeyPair keyPair = createKeyPairResult.getKeyPair();
  final String material = keyPair.getKeyMaterial();
  LOGGER.info("Created key: " + keyName);
  LOGGER.debug("Created material: " + material);

  return material;
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:20,代码来源:AWSSdkClient.java


示例5: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
@Override
public KeyPair createKeyPair(CreateKeyPairRequest request,
        ResultCapture<CreateKeyPairResult> extractor) {

    ActionResult result = service.performAction("CreateKeyPair", request,
            extractor);

    if (result == null) return null;
    return new KeyPairImpl(result.getResource());
}
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:11,代码来源:EC2Impl.java


示例6: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
@Override
public CreateKeyPairResult createKeyPair(CreateKeyPairRequest createKeyPairRequest) throws AmazonServiceException, AmazonClientException {
    throw new UnsupportedOperationException("Not supported in mock");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AmazonEC2Mock.java


示例7: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
public KeyPair createKeyPair(String keyName) {
    logger.info("create key pair, keyName={}", keyName);
    CreateKeyPairResult result = ec2.createKeyPair(new CreateKeyPairRequest().withKeyName(keyName));
    return result.getKeyPair();
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:6,代码来源:EC2.java


示例8: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
public CreateKeyPairResult createKeyPair(AmazonEC2Client client, String keyName) {
	CreateKeyPairRequest createKeyPairRequest = new CreateKeyPairRequest().withKeyName(keyName);
	CreateKeyPairResult createKeyPairResult = client.createKeyPair(createKeyPairRequest);
	return createKeyPairResult;
}
 
开发者ID:sequenceiq,项目名称:sequenceiq-samples,代码行数:6,代码来源:SimpleKeyPairService.java


示例9: createKeyPairs

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
@RequestMapping(method = RequestMethod.GET, value = {"/keypairs/create"})
@ResponseBody
public CreateKeyPairResult createKeyPairs(@RequestParam("name") String name, @RequestParam("accessKey") String accessKey,
        @RequestParam("secretKey") String secretKey) {
	return awsec2Service.createKeyPair(awsCredentialsFactory.createSimpleAWSCredentials(accessKey, secretKey), name);
}
 
开发者ID:sequenceiq,项目名称:sequenceiq-samples,代码行数:7,代码来源:KeyPairsConroller.java


示例10: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
/**
 * Performs the <code>CreateKeyPair</code> action and use a ResultCapture to
 * retrieve the low-level client response.
 *
 * <p>
 *
 * @return The <code>KeyPair</code> resource object associated with the
 *         result of this action.
 * @see CreateKeyPairRequest
 */
com.amazonaws.resources.ec2.KeyPair createKeyPair(CreateKeyPairRequest
        request, ResultCapture<CreateKeyPairResult> extractor);
 
开发者ID:awslabs,项目名称:aws-sdk-java-resources,代码行数:13,代码来源:EC2.java


示例11: createKeyPair

import com.amazonaws.services.ec2.model.CreateKeyPairResult; //导入依赖的package包/类
CreateKeyPairResult createKeyPair(AWSCredentials credentials, String keyName); 
开发者ID:sequenceiq,项目名称:sequenceiq-samples,代码行数:2,代码来源:KeyPairService.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ThemeSource类代码示例发布时间:2022-05-22
下一篇:
Java UpdateByExampleWithBLOBsMethodGenerator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap