org.jclouds.aws.AWSResponseException Java Examples
The following examples show how to use
org.jclouds.aws.AWSResponseException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreatePlacementGroupIfNeeded.java From attic-stratos with Apache License 2.0 | 6 votes |
private void createPlacementGroupInRegion(String region, String name) { checkNotNull(region, "region"); checkNotNull(name, "name"); logger.debug(">> creating placementGroup region(%s) name(%s)", region, name); try { ec2Api.getPlacementGroupApi().get().createPlacementGroupInRegion(region, name); logger.debug("<< created placementGroup(%s)", name); checkState(placementGroupAvailable.apply(new PlacementGroup(region, name, "cluster", State.PENDING)), String .format("placementGroup region(%s) name(%s) failed to become available", region, name)); } catch (AWSResponseException e) { if (e.getError().getCode().equals("InvalidPlacementGroup.Duplicate")) { logger.debug("<< reused placementGroup(%s)", name); } else { throw e; } } }
Example #2
Source File: SpotInstanceApiLiveTest.java From attic-stratos with Apache License 2.0 | 6 votes |
@Test(expectedExceptions = AWSResponseException.class) public void testDescribeSpotRequestsInRegionFilterInvalid() { for (String region : Region.DEFAULT_REGIONS) { SortedSet<SpotInstanceRequest> allResults = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { SpotInstanceRequest request = allResults.last(); SortedSet<SpotInstanceRequest> result = ImmutableSortedSet.copyOf(client.getSpotInstanceApi().get() .describeSpotInstanceRequestsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("invalid-filter", request.getId()).build())); } } }
Example #3
Source File: JcloudsLocationSecurityGroupCustomizer.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Override public boolean apply(Exception input) { @SuppressWarnings("ThrowableResultOfMethodCallIgnored") AWSResponseException exception = Exceptions.getFirstThrowableOfType(input, AWSResponseException.class); if (exception != null) { String code = exception.getError().getCode(); return AWS_ERRORS_TO_RETRY.contains(code); } return false; }
Example #4
Source File: SecurityGroupEditor.java From brooklyn-server with Apache License 2.0 | 5 votes |
@Deprecated // TODO improve this - shouldn't have AWS specifics in here private boolean isDuplicate(Exception e) { // Sometimes AWSResponseException is wrapped in an IllegalStateException AWSResponseException cause = Exceptions.getFirstThrowableOfType(e, AWSResponseException.class); if (cause != null) { if ("InvalidPermission.Duplicate".equals(cause.getError().getCode())) { return true; } } return e.toString().contains("already exists"); }
Example #5
Source File: JcloudsS3ClientLiveTest.java From s3proxy with Apache License 2.0 | 5 votes |
@Override @Test public void testPublicWriteOnObject() throws InterruptedException, ExecutionException, TimeoutException, IOException { try { super.testPublicWriteOnObject(); Fail.failBecauseExceptionWasNotThrown(AWSResponseException.class); } catch (AWSResponseException are) { assertThat(are.getError().getCode()).isEqualTo("NotImplemented"); throw new SkipException("public-read-write-acl not supported", are); } }
Example #6
Source File: JcloudsS3ClientLiveTest.java From s3proxy with Apache License 2.0 | 5 votes |
@Override @Test public void testUpdateObjectACL() throws InterruptedException, ExecutionException, TimeoutException, IOException { try { super.testUpdateObjectACL(); Fail.failBecauseExceptionWasNotThrown(AWSResponseException.class); } catch (AWSResponseException are) { assertThat(are.getError().getCode()).isEqualTo("NotImplemented"); throw new SkipException("XML ACLs not supported", are); } }
Example #7
Source File: JcloudsBucketsLiveTest.java From s3proxy with Apache License 2.0 | 5 votes |
@Override @Test public void testUpdateBucketACL() throws Exception { try { super.testUpdateBucketACL(); Fail.failBecauseExceptionWasNotThrown(AWSResponseException.class); } catch (AWSResponseException are) { assertThat(are.getError().getCode()).isEqualTo("NotImplemented"); throw new SkipException("XML ACLs not supported", are); } }
Example #8
Source File: JcloudsBucketsLiveTest.java From s3proxy with Apache License 2.0 | 5 votes |
@Override @Test public void testBucketPayer() throws Exception { try { super.testBucketPayer(); Fail.failBecauseExceptionWasNotThrown(AWSResponseException.class); } catch (AWSResponseException are) { assertThat(are.getError().getCode()).isEqualTo("NotImplemented"); throw new SkipException("bucket payer not supported", are); } }
Example #9
Source File: JcloudsBucketsLiveTest.java From s3proxy with Apache License 2.0 | 5 votes |
@Override @Test public void testBucketLogging() throws Exception { try { super.testBucketLogging(); Fail.failBecauseExceptionWasNotThrown(AWSResponseException.class); } catch (AWSResponseException are) { assertThat(are.getError().getCode()).isEqualTo("NotImplemented"); throw new SkipException("bucket logging not supported", are); } }
Example #10
Source File: PlacementGroupApiLiveTest.java From attic-stratos with Apache License 2.0 | 5 votes |
@Test(expectedExceptions = AWSResponseException.class) public void testFilterInvalid() { for (String region : supportedRegions) { SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupApi().get() .describePlacementGroupsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { PlacementGroup group = allResults.last(); client.getPlacementGroupApi().get() .describePlacementGroupsInRegionWithFilter(region, ImmutableMultimap.<String, String>builder() .put("invalid-filter", group.getName()).build()); } } }
Example #11
Source File: JcloudsLocationSecurityGroupCustomizerTest.java From brooklyn-server with Apache License 2.0 | 4 votes |
private Exception newAwsResponseExceptionWithCode(String code) { AWSResponseException e = new AWSResponseException("irrelevant message", null, null, newAwsErrorWithCode(code)); return new RuntimeException(e); }