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


Java AwsConfig.setIamRole方法代码示例

本文整理汇总了Java中com.hazelcast.config.AwsConfig.setIamRole方法的典型用法代码示例。如果您正苦于以下问题:Java AwsConfig.setIamRole方法的具体用法?Java AwsConfig.setIamRole怎么用?Java AwsConfig.setIamRole使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hazelcast.config.AwsConfig的用法示例。


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

示例1: testAwsClient_getEndPoint

import com.hazelcast.config.AwsConfig; //导入方法依赖的package包/类
@Test
public void testAwsClient_getEndPoint() {
    AwsConfig awsConfig = new AwsConfig();
    awsConfig.setIamRole("test");
    AWSClient awsClient = new AWSClient(awsConfig);
    assertEquals("ec2.us-east-1.amazonaws.com", awsClient.getEndpoint());
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:8,代码来源:AwsClientTest.java

示例2: testAwsClient_withDifferentHostHeader

import com.hazelcast.config.AwsConfig; //导入方法依赖的package包/类
@Test
public void testAwsClient_withDifferentHostHeader() {
    AwsConfig awsConfig = new AwsConfig();
    awsConfig.setIamRole("test");
    awsConfig.setHostHeader("ec2.amazonaws.com.cn");
    awsConfig.setRegion("cn-north-1");
    AWSClient awsClient = new AWSClient(awsConfig);
    assertEquals("ec2.cn-north-1.amazonaws.com.cn", awsClient.getEndpoint());
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:10,代码来源:AwsClientTest.java

示例3: testAwsClient_withInvalidHostHeader

import com.hazelcast.config.AwsConfig; //导入方法依赖的package包/类
@Test(expected = InvalidConfigurationException.class)
public void testAwsClient_withInvalidHostHeader() {
    AwsConfig awsConfig = new AwsConfig();
    awsConfig.setIamRole("test");
    awsConfig.setHostHeader("ec3.amazonaws.com.cn");
    new AWSClient(awsConfig);
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:8,代码来源:AwsClientTest.java

示例4: test_whenIamRoleExistsInConfig

import com.hazelcast.config.AwsConfig; //导入方法依赖的package包/类
@Test
public void test_whenIamRoleExistsInConfig() throws IOException {
    final String someRole = "someRole";
    final String uri = INSTANCE_METADATA_URI + IAM_SECURITY_CREDENTIALS_URI + someRole;

    // some dummy creds. Look real, but they aren't.
    final String accessKeyId = "ASIAJDOR231233BVE7GQ";
    final String secretAccessKey = "QU5mTd40xnAbC5Mz2T3Fy7afQVrow+/tYq5GXMf7";
    final String token = "FQoDYXdzEKX//////////wEaDN2Xh+ekVbV1KJrCqCK3A/Quuw8xCdZZbOPjzKLNc89n72z61BLt96hzlxTV6Vx1hDXLQNWRIx07hZVgmgGzzyr0DzYAcqKq7s2GUznWlaXhGHxhyo4nJUeBFbLyYPjbDAcnl84HItjy5bvtQ6fbDM7h2ZGuJrHi51KAhxWN/uEHyBKAIJd5RdXxVH4UTNxJFiqEw8GdaXDGK07186TfqSFCdlG+rhL35bN7WcJZuykIpynbeQpPeY4rJ0WJGoSJwt/RSkGwP+JRcYmv8Y7L1uSD2spJWO6etFeyyU63y0BL42MXWL38SQypxjLz+s1PozSDrV7zxsp4DQONn+adbSyAoveskD3xtDYsip1Ra0UCSYNKzmmh2XXF4fBBb6EPRixc1fnCIVDp0rfyCGO0VMuIloF5nWP9XsaRcR1mbJ7K/TuWgugduRBgyV2s1KgJuPni5cZ6ptEkPBb2b+92DjxEdQCAi6+WAdWliFiJ/P3T+qSJGLaxAeu0P0yb8E2xfCjEH6qOH3EM0KfgyJM5WJbXlYZTOZZXHaj26rlhe2k3wdL+UXf4geAzczphyOyp4QIGqaxe0xj08BKvSqngQb5X44oVR40oi7fOvwU=";

    final String someDummyIamRole =
            "        {\n" +
                    "          \"Code\" : \"Success\",\n" +
                    "          \"LastUpdated\" : \"2016-10-04T12:08:24Z\",\n" +
                    "          \"Type\" : \"AWS-HMAC\",\n" +
                    "          \"AccessKeyId\" : \"" + accessKeyId + "\",\n" +
                    "          \"SecretAccessKey\" : \"" + secretAccessKey + "\",\n" +
                    "          \"Token\" : \"" + token + "\",\n" +
                    "          \"Expiration\" : \"2016-10-04T18:19:39Z\"\n" +
                    "        }\n";


    AwsConfig awsConfig = new AwsConfig();
    awsConfig.setIamRole(someRole);

    DescribeInstances descriptor = spy(new DescribeInstances(awsConfig));
    doReturn(someDummyIamRole).when(descriptor).retrieveRoleFromURI(uri);
    descriptor.fillKeysFromIamRoles();

    Assert.assertEquals("Could not parse access key from IAM role", accessKeyId, awsConfig.getAccessKey());
    Assert.assertEquals("Could not parse secret key from IAM role", secretAccessKey, awsConfig.getSecretKey());

}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:34,代码来源:DescribeInstancesTest.java


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