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


Java NoSuchEntityException类代码示例

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


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

示例1: checkIamProfileName

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
/**
 * Validates the configured IAM profile.
 *
 * @param configuration       the configuration to be validated
 * @param accumulator         the exception condition accumulator
 * @param localizationContext the localization context
 */
@VisibleForTesting
void checkIamProfileName(Configured configuration,
    PluginExceptionConditionAccumulator accumulator,
    LocalizationContext localizationContext) {

  String iamProfileName =
      configuration.getConfigurationValue(IAM_PROFILE_NAME, localizationContext);

  if (iamProfileName != null) {
    AmazonIdentityManagementClient iamClient = provider.getIdentityManagementClient();

    try {
      iamClient.getInstanceProfile(new GetInstanceProfileRequest()
          .withInstanceProfileName(iamProfileName));

    } catch (NoSuchEntityException e) {
      addError(accumulator, IAM_PROFILE_NAME, localizationContext,
          null, INVALID_IAM_PROFILE_NAME_MSG, iamProfileName);
    }
  }
}
 
开发者ID:cloudera,项目名称:director-aws-plugin,代码行数:29,代码来源:EC2InstanceTemplateConfigurationValidator.java

示例2: groupExists

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
public static boolean groupExists(SecretsGroupManager secretsGroupManager, SecretsGroupIdentifier identifier) {
    try {
        secretsGroupManager.info(identifier);
        return true;
    } catch (NoSuchElementException | ResourceNotFoundException | NoSuchEntityException e) {
        return false;
    }
}
 
开发者ID:schibsted,项目名称:strongbox,代码行数:9,代码来源:IntegrationTestHelper.java

示例3: isServerCertificatePresent

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
/**
 * Checks if the server certificate is present.
 *
 * @param name The server certificate name
 * @return If present
 */
public boolean isServerCertificatePresent(final String name) {
    try {
        client.getServerCertificate(new GetServerCertificateRequest().withServerCertificateName(name));
        return true;
    } catch (final NoSuchEntityException nsee) {
        return false;
    }
}
 
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:15,代码来源:IdentityManagementService.java

示例4: getServerCertificateArn

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
/**
 * Gets the ARN for the specified server certificate name.
 *
 * @param name The server certificate name
 * @return ARN
 */
public Optional<String> getServerCertificateArn(final String name) {
    try {
        final GetServerCertificateResult serverCertificateResult =
                client.getServerCertificate(new GetServerCertificateRequest().withServerCertificateName(name));
        return Optional.of(serverCertificateResult.getServerCertificate().getServerCertificateMetadata().getArn());
    } catch (final NoSuchEntityException nsee) {
        return Optional.empty();
    }
}
 
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:16,代码来源:IdentityManagementService.java

示例5: getServerCertificateId

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
/**
 * Gets the ID for the specified server certificate name.
 *
 * @param name The server certificate name
 * @return ID
 */
public Optional<String> getServerCertificateId(final String name) {
    try {
        final GetServerCertificateResult serverCertificateResult =
                client.getServerCertificate(new GetServerCertificateRequest().withServerCertificateName(name));
        return Optional.of(serverCertificateResult.getServerCertificate()
                .getServerCertificateMetadata().getServerCertificateId());
    } catch (final NoSuchEntityException nsee) {
        return Optional.empty();
    }
}
 
开发者ID:Nike-Inc,项目名称:cerberus-lifecycle-cli,代码行数:17,代码来源:IdentityManagementService.java

示例6: createIAMRoleIfNotExist

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
public String createIAMRoleIfNotExist(String roleName) {
	GetRoleRequest getRoleRequest = new GetRoleRequest()
		.withRoleName(roleName);
	try {
		GetRoleResult getRoleResult = identityManagement.getRole(getRoleRequest);
		return getRoleResult.getRole().getArn();
	} catch (NoSuchEntityException e) {
		CreateRoleRequest request = new CreateRoleRequest().withRoleName(roleName)
				.withAssumeRolePolicyDocument("{\"Version\": \"2008-10-17\","
						+ "\"Statement\": ["
						+ "{"
						+ "\"Sid\": \"1\","
						+ "\"Effect\": \"Allow\","
						+ "\"Principal\": {"
						+ "\"Service\": \"elastictranscoder.amazonaws.com\""
						+ "},"
						+ "\"Action\": \"sts:AssumeRole\""
						+ "}"
						+ "]"
						+ "}");
		CreateRoleResult roleResult = identityManagement.createRole(request);

		PutRolePolicyRequest putRolePolicyRequest = new PutRolePolicyRequest()
			.withPolicyName("s3video_generated_policy")
			.withPolicyDocument("{\"Version\":\"2008-10-17\",\"Statement\":[{\"Sid\":\"1\",\"Effect\":\"Allow\",\"Action\":[\"s3:ListBucket\",\"s3:Put*\",\"s3:Get*\",\"s3:*MultipartUpload*\"],\"Resource\":\"*\"},{\"Sid\":\"2\",\"Effect\":\"Allow\",\"Action\":\"sns:Publish\",\"Resource\":\"*\"},{\"Sid\":\"3\",\"Effect\":\"Deny\",\"Action\":[\"s3:*Policy*\",\"sns:*Permission*\",\"sns:*Delete*\",\"s3:*Delete*\",\"sns:*Remove*\"],\"Resource\":\"*\"}]}")
			.withRoleName(roleName);
		identityManagement.putRolePolicy(putRolePolicyRequest);
		
		return roleResult.getRole().getArn();
	}
}
 
开发者ID:TimShi,项目名称:s3_video,代码行数:32,代码来源:AWSAdapter.java

示例7: findRolePolicy

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
public Optional<Policy> findRolePolicy(String roleName, String policyName) {
    logger.info("find role policy, roleName={}, policyName={}", roleName, policyName);
    try {
        GetRolePolicyResult result = iam.getRolePolicy(new GetRolePolicyRequest()
            .withRoleName(roleName)
            .withPolicyName(policyName));
        String policyJSON = Encodings.decodeURL(result.getPolicyDocument());
        return Optional.of(Policy.fromJson(policyJSON));
    } catch (NoSuchEntityException e) {
        return Optional.empty();
    }
}
 
开发者ID:neowu,项目名称:cmn-project,代码行数:13,代码来源:IAM.java

示例8: deleteInstanceProfile

import com.amazonaws.services.identitymanagement.model.NoSuchEntityException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
@Override
public void deleteInstanceProfile( String profileName, Identity identity )
{
    AmazonIdentityManagement iam =
        ActivityUtils.createClient( AmazonIdentityManagementClient.class,
                                    identity );

    String roleName = profileName + "-role";
    try
    {
        GetInstanceProfileResult profileResult =
            iam.getInstanceProfile( new GetInstanceProfileRequest().withInstanceProfileName( profileName ) );

        if ( !profileResult.getInstanceProfile().getRoles().isEmpty() )
        {
            iam.removeRoleFromInstanceProfile( new RemoveRoleFromInstanceProfileRequest().withInstanceProfileName( profileName ).withRoleName( roleName ) );
        }

        iam.deleteInstanceProfile( new DeleteInstanceProfileRequest().withInstanceProfileName( profileName ) );
    }
    catch ( NoSuchEntityException e )
    {
        LOG.info( "Instance profile is already gone: " + profileName );
    }
    ActivityUtils.deleteRole( roleName, iam );
}
 
开发者ID:jiaqi,项目名称:datamung,代码行数:30,代码来源:Ec2ActivitiesImpl.java


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