List of usage examples for com.amazonaws.services.identitymanagement.model NoSuchEntityException getMessage
@Override
public String getMessage()
From source file:com.cloudera.director.aws.ec2.EC2Provider.java
License:Apache License
/** * Configures the specified IAM client.// w ww. j a v a 2 s.c om * * @param configuration the provider configuration * @param accumulator the exception accumulator * @param identityManagementClient the IAM client * @param providerLocalizationContext the resource provider localization context * @param verify whether to verify the configuration by making an API call * @return the configured client * @throws InvalidCredentialsException if the supplied credentials are invalid * @throws TransientProviderException if a transient exception occurs communicating with the * provider * @throws UnrecoverableProviderException if an unrecoverable exception occurs communicating with * the provider */ @SuppressWarnings("PMD.EmptyCatchBlock") protected static AmazonIdentityManagementClient configureIAMClient(Configured configuration, PluginExceptionConditionAccumulator accumulator, AmazonIdentityManagementClient identityManagementClient, LocalizationContext providerLocalizationContext, boolean verify) { checkNotNull(identityManagementClient, "identityManagementClient is null"); try { String iamEndpoint = configuration.getConfigurationValue(IAM_ENDPOINT, providerLocalizationContext); if (iamEndpoint != null) { LOG.info("<< Using configured IAM endpoint: {}", iamEndpoint); identityManagementClient.setEndpoint(iamEndpoint); } // else use the single default endpoint for all of AWS (outside GovCloud) if (verify) { // Attempt to use client, to validate credentials and connectivity try { identityManagementClient .getInstanceProfile(new GetInstanceProfileRequest().withInstanceProfileName("test")); } catch (NoSuchEntityException e) { /* call succeeded */ } } } catch (AmazonClientException e) { throw AWSExceptions.propagate(e); } catch (IllegalArgumentException e) { accumulator.addError(IAM_ENDPOINT.unwrap().getConfigKey(), e.getMessage()); } return identityManagementClient; }
From source file:com.epam.dlab.auth.aws.dao.AwsUserDAOImpl.java
License:Apache License
private User fetchAwsUser(String username) { User user = null;/*from w w w . j av a 2 s. c o m*/ try { GetUserRequest r = new GetUserRequest().withUserName(username); GetUserResult ur = aim.getUser(r); user = ur.getUser(); } catch (NoSuchEntityException e) { log.error("User {} not found: {}", username, e.getMessage()); } return user; }