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

Java DescribeKeyResult类代码示例

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

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



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

示例1: test_getKmsKeyState_happy

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_getKmsKeyState_happy() {
    String awsRegion = "aws region";

    String kmsKeyId = "kms key id";
    String state = "state";
    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(state)));

    String result = kmsService.getKmsKeyState(kmsKeyId, awsRegion);

    assertEquals(state, result);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:19,代码来源:KmsServiceTest.java


示例2: test_validateKmsKeyIsUsable_returns_true_when_state_is_pending_deletion

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_validateKmsKeyIsUsable_returns_true_when_state_is_pending_deletion() {
    String keyId = "key id";
    String awsRegion = "aws region";

    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.PendingDeletion)));

    boolean result = kmsService.kmsKeyIsDisabledOrScheduledForDeletion(keyId, awsRegion);

    assertTrue(result);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:18,代码来源:KmsServiceTest.java


示例3: test_validateKmsKeyIsUsable_return_true_when_state_is_disabled

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_validateKmsKeyIsUsable_return_true_when_state_is_disabled() {
    String keyId = "key id";
    String awsRegion = "aws region";

    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.Disabled)));

    boolean result = kmsService.kmsKeyIsDisabledOrScheduledForDeletion(keyId, awsRegion);

    assertTrue(result);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:18,代码来源:KmsServiceTest.java


示例4: test_validateKmsKeyIsUsable_returns_false_when_state_is_not_deletion_or_disabled

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_validateKmsKeyIsUsable_returns_false_when_state_is_not_deletion_or_disabled() {
    String keyId = "key id";
    String awsRegion = "aws region";

    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.Enabled)));

    boolean result = kmsService.kmsKeyIsDisabledOrScheduledForDeletion(keyId, awsRegion);

    assertFalse(result);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:18,代码来源:KmsServiceTest.java


示例5: test_validateKmsKeyIsUsable_deletes_kms_key_when_not_usable

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test(expected = ApiException.class)
public void test_validateKmsKeyIsUsable_deletes_kms_key_when_not_usable() {

    String id = "id";
    String awsKmsKeyArn = "aws kms key arn";
    String iamPrincipalArn = "arn";
    String awsRegion = "aws region";

    AwsIamRoleKmsKeyRecord kmsKey = mock(AwsIamRoleKmsKeyRecord.class);
    when(kmsKey.getId()).thenReturn(id);
    when(kmsKey.getAwsKmsKeyId()).thenReturn(awsKmsKeyArn);
    when(kmsKey.getAwsRegion()).thenReturn(awsRegion);

    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.PendingDeletion)));

    kmsService.validateKmsKeyIsUsable(kmsKey, iamPrincipalArn);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:24,代码来源:KmsServiceTest.java


示例6: test_validateKmsKeyIsUsable_does_not_delete_kms_key_when_usable

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_validateKmsKeyIsUsable_does_not_delete_kms_key_when_usable() {

    String id = "id";
    String awsKmsKeyArn = "aws kms key arn";
    String iamPrincipalArn = "arn";
    String awsRegion = "aws region";

    AwsIamRoleKmsKeyRecord kmsKey = mock(AwsIamRoleKmsKeyRecord.class);
    when(kmsKey.getId()).thenReturn(id);
    when(kmsKey.getAwsKmsKeyId()).thenReturn(awsKmsKeyArn);
    when(kmsKey.getAwsRegion()).thenReturn(awsRegion);

    AWSKMSClient kmsClient = mock(AWSKMSClient.class);
    when(kmsClientFactory.getClient(awsRegion)).thenReturn(kmsClient);
    when(kmsClient.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.Enabled)));

    kmsService.validateKmsKeyIsUsable(kmsKey, iamPrincipalArn);

    verify(awsIamRoleDao, never()).deleteKmsKeyById(id);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:26,代码来源:KmsServiceTest.java


示例7: test_validatePolicy_validates_policy_when_validate_interval_has_passed

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Test
public void test_validatePolicy_validates_policy_when_validate_interval_has_passed() {
    String kmsKeyArn = "kms key arn";
    String awsIamRoleRecordId = "aws iam role record id";
    String kmsCMKRegion = "kmsCMKRegion";
    String policy = "policy";
    OffsetDateTime lastValidated = OffsetDateTime.of(2016, 1, 1, 1, 1,
            1, 1, ZoneOffset.UTC);
    OffsetDateTime now = OffsetDateTime.now();

    AWSKMSClient client = mock(AWSKMSClient.class);
    when(client.describeKey(anyObject())).thenReturn(
            new DescribeKeyResult()
                    .withKeyMetadata(
                            new KeyMetadata()
                                    .withKeyState(KeyState.Enabled)));

    when(kmsClientFactory.getClient(kmsCMKRegion)).thenReturn(client);

    GetKeyPolicyResult result = mock(GetKeyPolicyResult.class);
    when(result.getPolicy()).thenReturn(policy);
    when(client.getKeyPolicy(new GetKeyPolicyRequest().withKeyId(kmsKeyArn)
            .withPolicyName("default"))).thenReturn(result);
    when(kmsPolicyService.isPolicyValid(policy)).thenReturn(true);

    AwsIamRoleKmsKeyRecord kmsKey = mock(AwsIamRoleKmsKeyRecord.class);
    when(kmsKey.getAwsIamRoleId()).thenReturn(awsIamRoleRecordId);
    when(kmsKey.getAwsKmsKeyId()).thenReturn(kmsKeyArn);
    when(kmsKey.getAwsRegion()).thenReturn(kmsCMKRegion);
    when(kmsKey.getLastValidatedTs()).thenReturn(lastValidated);
    when(awsIamRoleDao.getKmsKey(awsIamRoleRecordId, kmsCMKRegion)).thenReturn(Optional.of(kmsKey));

    when(dateTimeSupplier.get()).thenReturn(now);
    kmsService.validateKeyAndPolicy(kmsKey, kmsKeyArn);

    verify(client, times(1)).getKeyPolicy(new GetKeyPolicyRequest().withKeyId(kmsKeyArn)
            .withPolicyName("default"));
    verify(kmsPolicyService, times(1)).isPolicyValid(policy);
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:40,代码来源:KmsServiceTest.java


示例8: describeKey

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
@Override
public DescribeKeyResult describeKey(DescribeKeyRequest arg0) throws AmazonServiceException, AmazonClientException {
    final String arn = retrieveArn(arg0.getKeyId());

    final KeyMetadata keyMetadata = new KeyMetadata().withArn(arn).withKeyId(arn);
    final DescribeKeyResult describeKeyResult = new DescribeKeyResult().withKeyMetadata(keyMetadata);

    return describeKeyResult;
}
 
开发者ID:awslabs,项目名称:aws-encryption-sdk-java,代码行数:10,代码来源:MockKMSClient.java


示例9: constructDescribeKeyResult

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
private DescribeKeyResult constructDescribeKeyResult() {
    KeyMetadata keyMetadata = new KeyMetadata().withArn(KMS_ARN);
    return new DescribeKeyResult().withKeyMetadata(keyMetadata);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:5,代码来源:IAMPolicyManagerTest.java


示例10: constructDescribeKeyResult

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
private static DescribeKeyResult constructDescribeKeyResult(KeyState state) {
    return new DescribeKeyResult().withKeyMetadata(
            new KeyMetadata().withKeyState(state).withArn(KMS_ARN));
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:5,代码来源:KMSManagerTest.java


示例11: enabledKeyResult

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
private static DescribeKeyResult enabledKeyResult() {
    return constructDescribeKeyResult(KeyState.Enabled);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:4,代码来源:KMSManagerTest.java


示例12: disabledKeyResult

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
private static DescribeKeyResult disabledKeyResult() {
    return constructDescribeKeyResult(KeyState.Disabled);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:4,代码来源:KMSManagerTest.java


示例13: pendingDeletionKeyResult

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
private static DescribeKeyResult pendingDeletionKeyResult() {
    return constructDescribeKeyResult(KeyState.PendingDeletion);
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:4,代码来源:KMSManagerTest.java


示例14: describeKey

import com.amazonaws.services.kms.model.DescribeKeyResult; //导入依赖的package包/类
public DescribeKeyResult describeKey(DescribeKeyRequest request) {
    // Default AWS limit was 30 as of Aug 2017
    return execute("KmsDescribeKey", () -> client.describeKey(request));
}
 
开发者ID:Nike-Inc,项目名称:cerberus-management-service,代码行数:5,代码来源:HystrixKmsClient.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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