You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/04/02 11:14:36 UTC
[24/25] git commit: forking jclouds ec2 api
forking jclouds ec2 api
Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/58fe66df
Tree: http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/58fe66df
Diff: http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/58fe66df
Branch: refs/heads/master
Commit: 58fe66df2497be70cf1587dfdfe7942338f424e7
Parents: ecf0e7e
Author: Nirmal Fernando <ni...@apache.org>
Authored: Wed Apr 2 14:42:57 2014 +0530
Committer: Nirmal Fernando <ni...@apache.org>
Committed: Wed Apr 2 14:42:57 2014 +0530
----------------------------------------------------------------------
.../jclouds/apis/ec2/1.7.1-stratos/README.txt | 15 +
.../jclouds/apis/ec2/1.7.1-stratos/pom.xml | 141 ++++
.../src/main/clojure/org/jclouds/ec2/ami2.clj | 84 ++
.../src/main/clojure/org/jclouds/ec2/ebs2.clj | 286 +++++++
.../clojure/org/jclouds/ec2/elastic_ip2.clj | 80 ++
.../clojure/org/jclouds/ec2/security_group2.clj | 99 +++
.../src/main/java/org/jclouds/ec2/EC2Api.java | 167 ++++
.../java/org/jclouds/ec2/EC2ApiMetadata.java | 91 +++
.../main/java/org/jclouds/ec2/EC2Fallbacks.java | 50 ++
...ndBlockDeviceMappingToIndexedFormParams.java | 67 ++
.../BindBundleIdsToIndexedFormParams.java | 37 +
.../binders/BindFiltersToIndexedFormParams.java | 57 ++
.../BindGroupIdsToIndexedFormParams.java | 37 +
.../BindGroupNamesToIndexedFormParams.java | 37 +
.../BindInstanceIdsToIndexedFormParams.java | 37 +
.../BindIpPermissionToIndexedFormParams.java | 40 +
.../BindIpPermissionsToIndexedFormParams.java | 48 ++
.../BindKeyNamesToIndexedFormParams.java | 37 +
.../BindProductCodesToIndexedFormParams.java | 37 +
.../BindPublicIpsToIndexedFormParams.java | 42 +
.../BindResourceIdsToIndexedFormParams.java | 40 +
.../binders/BindS3UploadPolicyAndSignature.java | 57 ++
.../binders/BindTagKeysToIndexedFormParams.java | 46 ++
.../binders/BindTagsToIndexedFormParams.java | 54 ++
.../BindUserGroupsToIndexedFormParams.java | 52 ++
...roupPairToSourceSecurityGroupFormParams.java | 49 ++
.../binders/BindUserIdsToIndexedFormParams.java | 37 +
.../BindVolumeIdsToIndexedFormParams.java | 37 +
...fNotNullBindAvailabilityZoneToFormParam.java | 55 ++
.../jclouds/ec2/compute/EC2ComputeService.java | 331 ++++++++
.../ec2/compute/EC2ComputeServiceContext.java | 32 +
.../config/EC2BindComputeStrategiesByClass.java | 97 +++
.../config/EC2BindComputeSuppliersByClass.java | 41 +
.../config/EC2ComputeServiceContextModule.java | 144 ++++
.../EC2ComputeServiceDependenciesModule.java | 197 +++++
.../compute/config/EC2ResolveImagesModule.java | 36 +
.../ec2/compute/domain/EC2HardwareBuilder.java | 599 ++++++++++++++
.../domain/PasswordDataAndPrivateKey.java | 76 ++
.../ec2/compute/domain/RegionAndName.java | 111 +++
.../domain/RegionNameAndIngressRules.java | 44 +
.../compute/extensions/EC2ImageExtension.java | 143 ++++
.../extensions/EC2SecurityGroupExtension.java | 380 +++++++++
.../functions/AddElasticIpsToNodemetadata.java | 77 ++
.../compute/functions/CreateUniqueKeyPair.java | 79 ++
.../functions/CredentialsForInstance.java | 79 ++
.../ec2/compute/functions/EC2ImageParser.java | 148 ++++
.../functions/EC2SecurityGroupIdFromName.java | 51 ++
.../EC2SecurityGroupToSecurityGroup.java | 98 +++
.../functions/ImagesToRegionAndIdMap.java | 55 ++
.../PasswordCredentialsFromWindowsInstance.java | 122 +++
.../ec2/compute/functions/PresentInstances.java | 84 ++
.../RunningInstanceToNodeMetadata.java | 257 ++++++
...indowsLoginCredentialsFromEncryptedData.java | 79 ++
.../internal/EC2ComputeServiceContextImpl.java | 47 ++
.../internal/EC2TemplateBuilderImpl.java | 117 +++
.../loaders/CreateSecurityGroupIfNeeded.java | 106 +++
.../loaders/LoadPublicIpForInstanceOrNull.java | 60 ++
.../ec2/compute/loaders/RegionAndIdToImage.java | 68 ++
.../ec2/compute/options/EC2TemplateOptions.java | 624 ++++++++++++++
.../compute/predicates/EC2ImagePredicates.java | 50 ++
.../predicates/SecurityGroupPresent.java | 68 ++
...curityGroupsAsNeededAndReturnRunOptions.java | 199 +++++
.../strategy/DescribeImagesParallel.java | 86 ++
.../EC2CreateNodesInGroupThenAddToSet.java | 244 ++++++
.../strategy/EC2DestroyNodeStrategy.java | 105 +++
.../compute/strategy/EC2GetImageStrategy.java | 70 ++
.../strategy/EC2GetNodeMetadataStrategy.java | 71 ++
.../compute/strategy/EC2ListNodesStrategy.java | 164 ++++
...DefaultLoginCredentialsForImageStrategy.java | 75 ++
.../compute/strategy/EC2RebootNodeStrategy.java | 53 ++
.../compute/strategy/EC2ResumeNodeStrategy.java | 53 ++
.../strategy/EC2SuspendNodeStrategy.java | 53 ++
.../ec2/compute/strategy/ReviseParsedImage.java | 44 +
.../compute/suppliers/EC2HardwareSupplier.java | 46 ++
.../ec2/compute/suppliers/EC2ImageSupplier.java | 120 +++
.../suppliers/RegionAndNameToImageSupplier.java | 53 ++
.../ec2/compute/util/EC2ComputeUtils.java | 35 +
.../ec2/config/BaseEC2HttpApiModule.java | 61 ++
.../jclouds/ec2/config/EC2HttpApiModule.java | 37 +
.../java/org/jclouds/ec2/domain/Attachment.java | 226 ++++++
.../ec2/domain/AvailabilityZoneInfo.java | 129 +++
.../org/jclouds/ec2/domain/BlockDevice.java | 109 +++
.../jclouds/ec2/domain/BlockDeviceMapping.java | 234 ++++++
.../ec2/domain/BundleInstanceS3Storage.java | 150 ++++
.../java/org/jclouds/ec2/domain/BundleTask.java | 295 +++++++
.../java/org/jclouds/ec2/domain/Hypervisor.java | 49 ++
.../main/java/org/jclouds/ec2/domain/Image.java | 496 ++++++++++++
.../org/jclouds/ec2/domain/ImageAttribute.java | 98 +++
.../org/jclouds/ec2/domain/InstanceState.java | 97 +++
.../jclouds/ec2/domain/InstanceStateChange.java | 119 +++
.../org/jclouds/ec2/domain/InstanceType.java | 388 +++++++++
.../java/org/jclouds/ec2/domain/KeyPair.java | 206 +++++
.../org/jclouds/ec2/domain/PasswordData.java | 153 ++++
.../java/org/jclouds/ec2/domain/Permission.java | 93 +++
.../ec2/domain/PublicIpInstanceIdPair.java | 111 +++
.../org/jclouds/ec2/domain/Reservation.java | 228 ++++++
.../ec2/domain/ReservedInstancesOffering.java | 182 +++++
.../org/jclouds/ec2/domain/RootDeviceType.java | 48 ++
.../org/jclouds/ec2/domain/RunningInstance.java | 525 ++++++++++++
.../org/jclouds/ec2/domain/SecurityGroup.java | 229 ++++++
.../java/org/jclouds/ec2/domain/Snapshot.java | 235 ++++++
.../java/org/jclouds/ec2/domain/Subnet.java | 253 ++++++
.../main/java/org/jclouds/ec2/domain/Tag.java | 196 +++++
.../org/jclouds/ec2/domain/UserIdGroupPair.java | 100 +++
.../jclouds/ec2/domain/VirtualizationType.java | 47 ++
.../java/org/jclouds/ec2/domain/Volume.java | 296 +++++++
.../java/org/jclouds/ec2/features/AMIApi.java | 366 +++++++++
.../features/AvailabilityZoneAndRegionApi.java | 90 +++
.../ec2/features/ElasticBlockStoreApi.java | 602 ++++++++++++++
.../ec2/features/ElasticIPAddressApi.java | 200 +++++
.../org/jclouds/ec2/features/InstanceApi.java | 803 +++++++++++++++++++
.../org/jclouds/ec2/features/KeyPairApi.java | 159 ++++
.../jclouds/ec2/features/SecurityGroupApi.java | 324 ++++++++
.../org/jclouds/ec2/features/SubnetApi.java | 94 +++
.../java/org/jclouds/ec2/features/TagApi.java | 201 +++++
.../org/jclouds/ec2/features/WindowsApi.java | 229 ++++++
...vertUnencodedBytesToBase64EncodedString.java | 43 +
.../functions/EncodedRSAPublicKeyToBase64.java | 51 ++
.../options/BundleInstanceS3StorageOptions.java | 95 +++
.../jclouds/ec2/options/CreateImageOptions.java | 94 +++
.../ec2/options/CreateSnapshotOptions.java | 70 ++
.../DescribeAvailabilityZonesOptions.java | 68 ++
.../ec2/options/DescribeImagesOptions.java | 115 +++
.../ec2/options/DescribeRegionsOptions.java | 68 ++
.../ec2/options/DescribeSnapshotsOptions.java | 109 +++
.../ec2/options/DetachVolumeOptions.java | 86 ++
.../RegisterImageBackedByEbsOptions.java | 235 ++++++
.../ec2/options/RegisterImageOptions.java | 128 +++
.../ec2/options/RunInstancesOptions.java | 206 +++++
.../options/internal/BaseEC2RequestOptions.java | 59 ++
.../ec2/predicates/InstanceHasIpAddress.java | 66 ++
.../ec2/predicates/InstanceStateRunning.java | 69 ++
.../ec2/predicates/InstanceStateStopped.java | 62 ++
.../ec2/predicates/InstanceStateTerminated.java | 68 ++
.../ec2/predicates/SnapshotCompleted.java | 60 ++
.../jclouds/ec2/predicates/VolumeAttached.java | 63 ++
.../jclouds/ec2/predicates/VolumeAvailable.java | 57 ++
.../jclouds/ec2/predicates/VolumeDetached.java | 69 ++
.../org/jclouds/ec2/reference/EC2Constants.java | 49 ++
.../DescribeAvailabilityZonesInRegion.java | 92 +++
.../suppliers/DescribeRegionsForRegionURIs.java | 50 ++
.../org/jclouds/ec2/util/IpPermissions.java | 197 +++++
.../jclouds/ec2/util/SubnetFilterBuilder.java | 251 ++++++
.../org/jclouds/ec2/util/TagFilterBuilder.java | 223 +++++
.../main/java/org/jclouds/ec2/util/Tags.java | 101 +++
.../ec2/xml/AllocateAddressResponseHandler.java | 56 ++
.../org/jclouds/ec2/xml/AttachmentHandler.java | 86 ++
.../jclouds/ec2/xml/BaseReservationHandler.java | 217 +++++
.../ec2/xml/BlockDeviceMappingHandler.java | 82 ++
.../jclouds/ec2/xml/BooleanValueHandler.java | 46 ++
.../org/jclouds/ec2/xml/BundleTaskHandler.java | 111 +++
.../ec2/xml/CreateVolumeResponseHandler.java | 198 +++++
.../xml/DescribeAddressesResponseHandler.java | 80 ++
...escribeAvailabilityZonesResponseHandler.java | 104 +++
.../xml/DescribeBundleTasksResponseHandler.java | 73 ++
.../ec2/xml/DescribeImagesResponseHandler.java | 223 +++++
.../xml/DescribeInstancesResponseHandler.java | 109 +++
.../xml/DescribeKeyPairsResponseHandler.java | 84 ++
.../ec2/xml/DescribeRegionsResponseHandler.java | 67 ++
.../DescribeSecurityGroupsResponseHandler.java | 126 +++
.../xml/DescribeSnapshotsResponseHandler.java | 76 ++
.../ec2/xml/DescribeSubnetsResponseHandler.java | 91 +++
.../ec2/xml/DescribeTagsResponseHandler.java | 99 +++
.../ec2/xml/DescribeVolumesResponseHandler.java | 79 ++
.../xml/GetConsoleOutputResponseHandler.java | 55 ++
.../ec2/xml/GetPasswordDataResponseHandler.java | 61 ++
.../org/jclouds/ec2/xml/ImageIdHandler.java | 49 ++
...nstanceInitiatedShutdownBehaviorHandler.java | 48 ++
.../ec2/xml/InstanceStateChangeHandler.java | 112 +++
.../jclouds/ec2/xml/InstanceTypeHandler.java | 47 ++
.../jclouds/ec2/xml/IpPermissionHandler.java | 94 +++
.../jclouds/ec2/xml/KeyPairResponseHandler.java | 79 ++
.../org/jclouds/ec2/xml/PermissionHandler.java | 55 ++
.../ec2/xml/RunInstancesResponseHandler.java | 48 ++
.../jclouds/ec2/xml/SecurityGroupHandler.java | 143 ++++
.../org/jclouds/ec2/xml/SnapshotHandler.java | 107 +++
.../org/jclouds/ec2/xml/StringValueHandler.java | 47 ++
.../java/org/jclouds/ec2/xml/SubnetHandler.java | 95 +++
.../java/org/jclouds/ec2/xml/TagHandler.java | 77 ++
.../java/org/jclouds/ec2/xml/TagSetHandler.java | 78 ++
.../ec2/xml/UnencodeStringValueHandler.java | 37 +
.../services/org.jclouds.apis.ApiMetadata | 1 +
...dApplicationArchitecturesEC2ApiLiveTest.java | 427 ++++++++++
.../org/jclouds/ec2/EBSBootEC2ApiLiveTest.java | 607 ++++++++++++++
.../org/jclouds/ec2/EC2ApiMetadataTest.java | 32 +
.../org/jclouds/ec2/EC2ContextBuilderText.java | 36 +
...ockDeviceMappingToIndexedFormParamsTest.java | 70 ++
.../BindBundleIdsToIndexedFormParamsTest.java | 57 ++
.../BindFiltersToIndexedFormParamsTest.java | 63 ++
.../BindGroupNamesToIndexedFormParamsTest.java | 57 ++
.../BindInstanceIdsToIndexedFormParamsTest.java | 57 ++
.../BindKeyNamesToIndexedFormParamsTest.java | 57 ++
...BindProductCodesToIndexedFormParamsTest.java | 58 ++
.../BindPublicIpsToIndexedFormParamsTest.java | 57 ++
.../BindResourceIdsToIndexedFormParamsTest.java | 57 ++
.../BindS3UploadPolicyAndSignatureTest.java | 61 ++
.../BindTagKeysToIndexedFormParamsTest.java | 54 ++
.../BindTagsToIndexedFormParamsTest.java | 62 ++
.../BindUserGroupsToIndexedFormParamsTest.java | 63 ++
...PairToSourceSecurityGroupFormParamsTest.java | 60 ++
.../BindUserIdsToIndexedFormParamsTest.java | 58 ++
.../BindVolumeIdsToIndexedFormParamsTest.java | 57 ++
...NullBindAvailabilityZoneToFormParamTest.java | 59 ++
.../compute/EC2ComputeServiceExpectTest.java | 148 ++++
.../ec2/compute/EC2ComputeServiceLiveTest.java | 362 +++++++++
.../ec2/compute/EC2TemplateBuilderLiveTest.java | 94 +++
.../ec2/compute/EC2TemplateBuilderTest.java | 240 ++++++
.../compute/TestCanRecreateGroupLiveTest.java | 57 ++
.../EC2ComputeServiceContextModuleTest.java | 65 ++
.../extensions/EC2ImageExtensionExpectTest.java | 84 ++
.../extensions/EC2ImageExtensionLiveTest.java | 64 ++
.../EC2SecurityGroupExtensionExpectTest.java | 583 ++++++++++++++
.../EC2SecurityGroupExtensionLiveTest.java | 36 +
.../AddElasticIpsToNodemetadataTest.java | 90 +++
.../functions/CreateUniqueKeyPairTest.java | 116 +++
.../compute/functions/EC2ImageParserTest.java | 124 +++
.../EC2SecurityGroupToSecurityGroupTest.java | 83 ++
.../compute/functions/PresentInstancesTest.java | 69 ++
.../RunningInstanceToNodeMetadataTest.java | 298 +++++++
...wsLoginCredentialsFromEncryptedDataTest.java | 77 ++
.../BaseEC2ComputeServiceContextExpectTest.java | 42 +
.../BaseEC2ComputeServiceExpectTest.java | 246 ++++++
.../internal/EC2TemplateBuilderImplTest.java | 237 ++++++
.../CreateSecurityGroupIfNeededTest.java | 108 +++
.../LoadPublicIpForInstanceOrNullTest.java | 106 +++
.../compute/loaders/RegionAndIdToImageTest.java | 143 ++++
.../compute/options/EC2TemplateOptionsTest.java | 288 +++++++
...tyGroupsAsNeededAndReturnRunOptionsTest.java | 577 +++++++++++++
.../EC2CreateNodesInGroupThenAddToSetTest.java | 343 ++++++++
.../strategy/EC2DestroyNodeStrategyTest.java | 189 +++++
.../ec2/config/EC2HttpApiModuleExpectTest.java | 145 ++++
.../jclouds/ec2/features/AMIApiExpectTest.java | 76 ++
.../jclouds/ec2/features/AMIApiLiveTest.java | 249 ++++++
.../org/jclouds/ec2/features/AMIApiTest.java | 521 ++++++++++++
.../AvailabilityZoneAndRegionApiLiveTest.java | 91 +++
.../AvailabilityZoneAndRegionApiTest.java | 116 +++
.../jclouds/ec2/features/BaseEC2ApiTest.java | 145 ++++
.../EC2ElasticBlockStoreApiExpectTest.java | 172 ++++
.../features/ElasticBlockStoreApiLiveTest.java | 291 +++++++
.../ec2/features/ElasticBlockStoreApiTest.java | 401 +++++++++
.../features/ElasticIPAddressApiExpectTest.java | 102 +++
.../features/ElasticIPAddressApiLiveTest.java | 77 ++
.../ec2/features/ElasticIPAddressApiTest.java | 140 ++++
.../ec2/features/InstanceApiExpectTest.java | 101 +++
.../ec2/features/InstanceApiLiveTest.java | 97 +++
.../jclouds/ec2/features/InstanceApiTest.java | 593 ++++++++++++++
.../ec2/features/KeyPairApiExpectTest.java | 76 ++
.../ec2/features/KeyPairApiLiveTest.java | 143 ++++
.../jclouds/ec2/features/KeyPairApiTest.java | 88 ++
.../features/SecurityGroupApiExpectTest.java | 76 ++
.../ec2/features/SecurityGroupApiLiveTest.java | 334 ++++++++
.../ec2/features/SecurityGroupApiTest.java | 236 ++++++
.../ec2/features/SubnetApiExpectTest.java | 119 +++
.../jclouds/ec2/features/SubnetApiLiveTest.java | 84 ++
.../jclouds/ec2/features/TagApiExpectTest.java | 285 +++++++
.../ec2/features/WindowsApiExpectTest.java | 115 +++
.../ec2/features/WindowsApiLiveTest.java | 37 +
.../jclouds/ec2/features/WindowsApiTest.java | 162 ++++
.../features/internal/BaseTagApiLiveTest.java | 159 ++++
...UnencodedBytesToBase64EncodedStringTest.java | 44 +
.../EncodedRSAPublicKeyToBase64Test.java | 44 +
.../ec2/internal/BaseEC2ApiExpectTest.java | 67 ++
.../ec2/internal/BaseEC2ApiLiveTest.java | 30 +
.../jclouds/ec2/internal/BaseEC2ExpectTest.java | 85 ++
.../BundleInstanceS3StorageOptionsTest.java | 74 ++
.../ec2/options/CreateImageOptionsTest.java | 80 ++
.../ec2/options/CreateSnapshotOptionsTest.java | 66 ++
.../ec2/options/DescribeImagesOptionsTest.java | 134 ++++
.../options/DescribeSnapshotsOptionsTest.java | 129 +++
.../ec2/options/DetachVolumeOptionsTest.java | 91 +++
.../RegisterImageBackedByEbsOptionsTest.java | 329 ++++++++
.../ec2/options/RegisterImageOptionsTest.java | 146 ++++
.../ec2/options/RunInstancesOptionsTest.java | 247 ++++++
.../ec2/parse/DescribeSubnetsResponseTest.java | 71 ++
.../ec2/parse/DescribeTagsResponseTest.java | 74 ++
.../ec2/parse/GetPasswordDataResponseTest.java | 55 ++
.../ec2/predicates/VolumeDetachedTest.java | 112 +++
.../DescribeAvailabilityZonesInRegionTest.java | 124 +++
.../org/jclouds/ec2/util/IpPermissionsTest.java | 106 +++
.../java/org/jclouds/ec2/util/TagsTest.java | 55 ++
.../xml/AllocateAddressResponseHandlerTest.java | 44 +
.../jclouds/ec2/xml/AttachmentHandlerTest.java | 53 ++
.../org/jclouds/ec2/xml/BaseEC2HandlerTest.java | 86 ++
.../ec2/xml/BlockDeviceMappingHandlerTest.java | 57 ++
.../jclouds/ec2/xml/BundleTaskHandlerTest.java | 68 ++
.../xml/CreateVolumeResponseHandlerTest.java | 60 ++
.../DescribeAddressesResponseHandlerTest.java | 57 ++
...ibeAvailabilityZonesResponseHandlerTest.java | 85 ++
.../DescribeBundleTasksResponseHandlerTest.java | 56 ++
.../xml/DescribeImagesResponseHandlerTest.java | 151 ++++
.../ec2/xml/DescribeInstanceAttributeTest.java | 80 ++
.../DescribeInstancesResponseHandlerTest.java | 173 ++++
.../DescribeKeyPairsResponseHandlerTest.java | 53 ++
.../xml/DescribeRegionsResponseHandlerTest.java | 136 ++++
...scribeSecurityGroupsResponseHandlerTest.java | 89 ++
.../DescribeSnapshotsResponseHandlerTest.java | 59 ++
.../xml/DescribeVolumesResponseHandlerTest.java | 67 ++
.../GetConsoleOutputResponseHandlerTest.java | 55 ++
.../ec2/xml/InstanceStateChangeHandlerTest.java | 93 +++
.../ec2/xml/KeyPairResponseHandlerTest.java | 80 ++
.../jclouds/ec2/xml/PermissionHandlerTest.java | 48 ++
.../xml/RunInstancesResponseHandlerTest.java | 110 +++
.../jclouds/ec2/xml/SnapshotHandlerTest.java | 53 ++
.../src/test/resources/allocate_address.xml | 3 +
.../src/test/resources/amzn_images.xml | 113 +++
.../1.7.1-stratos/src/test/resources/attach.xml | 7 +
...authorize_securitygroup_ingress_response.xml | 4 +
.../availabilityZones-ap-northeast-1.xml | 17 +
.../availabilityZones-ap-southeast-1.xml | 17 +
.../resources/availabilityZones-eu-west-1.xml | 23 +
.../resources/availabilityZones-sa-east-1.xml | 17 +
.../resources/availabilityZones-us-east-1.xml | 35 +
.../resources/availabilityZones-us-west-1.xml | 23 +
.../resources/availabilityZones-us-west-2.xml | 23 +
.../src/test/resources/availabilityZones.xml | 35 +
.../src/test/resources/bundle_instance.xml | 18 +
.../src/test/resources/cancel_bundle_task.xml | 16 +
.../src/test/resources/create_keypair.xml | 28 +
.../test/resources/created_securitygroup.xml | 6 +
.../src/test/resources/created_snapshot.xml | 10 +
.../src/test/resources/created_volume.xml | 9 +
.../src/test/resources/delete_securitygroup.xml | 4 +
.../src/test/resources/describe_addresses.xml | 11 +
.../resources/describe_addresses_single.xml | 8 +
.../test/resources/describe_bundle_tasks.xml | 18 +
...cribe_image_attribute_blockDeviceMapping.xml | 24 +
...escribe_image_attribute_launchPermission.xml | 11 +
.../src/test/resources/describe_images.xml | 23 +
.../src/test/resources/describe_images_ebs.xml | 40 +
.../describe_images_imageextension0.xml | 24 +
.../describe_images_imageextension1.xml | 24 +
.../describe_images_imageextension2.xml | 24 +
.../src/test/resources/describe_images_nova.xml | 21 +
.../src/test/resources/describe_images_tags.xml | 33 +
.../test/resources/describe_images_windows.xml | 22 +
.../src/test/resources/describe_instances.xml | 85 ++
.../test/resources/describe_instances_ebs.xml | 63 ++
.../resources/describe_instances_multiple.xml | 130 +++
.../resources/describe_instances_running-1.xml | 74 ++
.../describe_instances_running-named.xml | 74 ++
.../resources/describe_instances_running.xml | 45 ++
...escribe_instances_running_securitygroups.xml | 74 ++
.../src/test/resources/describe_keypairs.xml | 8 +
.../test/resources/describe_securitygroups.xml | 39 +
.../resources/describe_securitygroups_empty.xml | 41 +
.../describe_securitygroups_extension_cidr.xml | 24 +
.../describe_securitygroups_extension_group.xml | 26 +
.../describe_securitygroups_extension_new.xml | 27 +
...describe_securitygroups_extension_single.xml | 12 +
.../src/test/resources/describe_snapshots.xml | 20 +
.../src/test/resources/describe_subnets.xml | 33 +
.../src/test/resources/describe_tags.xml | 29 +
.../src/test/resources/describe_volumes.xml | 32 +
.../test/resources/describe_volumes_single.xml | 15 +
.../test/resources/disableApiTermination.xml | 8 +
.../resources/get_console_output_response.xml | 13 +
.../src/test/resources/get_passworddata.xml | 6 +
.../instanceInitiatedShutdownBehavior.xml | 7 +
.../src/test/resources/instanceType.xml | 9 +
.../1.7.1-stratos/src/test/resources/log4j.xml | 166 ++++
.../src/test/resources/new_instance.xml | 56 ++
.../src/test/resources/new_securitygroup.xml | 14 +
.../src/test/resources/ramdisk.xml | 8 +
.../resources/regionEndpoints-additional.xml | 22 +
.../src/test/resources/regionEndpoints-all.xml | 34 +
.../src/test/resources/regionEndpoints.xml | 18 +
.../src/test/resources/run_instances.xml | 74 ++
.../resources/run_instances_cloudbridge.xml | 68 ++
.../src/test/resources/start_instances.xml | 15 +
.../src/test/resources/stop_instances.xml | 15 +
.../src/test/resources/terminate_instances.xml | 15 +
.../src/test/resources/userData.xml | 8 +
.../provider/aws-ec2/1.7.1-stratos/pom.xml | 2 +-
373 files changed, 40773 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/README.txt
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/README.txt b/dependencies/jclouds/apis/ec2/1.7.1-stratos/README.txt
new file mode 100644
index 0000000..11db7a2
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/README.txt
@@ -0,0 +1,15 @@
+#
+# The jclouds API for Amazon's EC2 service (http://aws.amazon.com/ec2/).
+#
+# TODO: Implementation status.
+# TODO: Supported features.
+# TODO: Usage example.
+
+NOTE: The live tests in apis/ec2 will *not* work against AWS EC2 with AWS accounts created
+from December 04, 2013 and onward, due to those accounts only supporting VPC, and VPC requiring
+different parameters (ID rather than name) for referring to and acting on security groups.
+
+To run the EC2 live tests against AWS, go to providers/aws-ec2.
+
+apis/ec2 will retain the older security group name usage to support EC2 API shims,
+such as OpenStack, CloudStack, etc.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/pom.xml
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/pom.xml b/dependencies/jclouds/apis/ec2/1.7.1-stratos/pom.xml
new file mode 100644
index 0000000..4552ecd
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/pom.xml
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-project</artifactId>
+ <version>1.7.1</version>
+ </parent>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>ec2</artifactId>
+ <version>1.7.1-stratos</version>
+ <name>jclouds ec2 api</name>
+ <description>jclouds components to access an implementation of EC2</description>
+ <packaging>bundle</packaging>
+
+ <properties>
+ <jclouds.version>1.7.1</jclouds.version>
+ <test.ec2.endpoint>https://ec2.us-east-1.amazonaws.com</test.ec2.endpoint>
+ <test.ec2.api-version>2010-08-31</test.ec2.api-version>
+ <test.ec2.build-version />
+ <test.ec2.identity>${test.aws.identity}</test.ec2.identity>
+ <test.ec2.credential>${test.aws.credential}</test.ec2.credential>
+ <!-- default template pattern gets a problematic Ubuntu 10.04 AMI -->
+ <test.ec2.template>hardwareId=m1.small,imageId=us-east-1/ami-1ab3ce73</test.ec2.template>
+ <!-- Active EBS template as of 9/25/2013 -->
+ <test.ec2.ebs-template>hardwareId=m1.small,imageId=us-east-1/ami-53b1ff3a</test.ec2.ebs-template>
+ <!-- Windows_Server-2008-R2 with WinRM enabled (setup instructions at http://www.frontiertown.co.uk/2011/12/overthere-control-windows-from-java/) -->
+ <test.ec2.windows-template>hardwareId=m1.small,imageId=us-east-1/ami-0cb76d65</test.ec2.windows-template>
+ <jclouds.osgi.export>org.jclouds.ec2*;version="${project.version}"</jclouds.osgi.export>
+ <jclouds.osgi.import>
+ org.jclouds.compute.internal;version="${jclouds.version}",
+ org.jclouds.rest.internal;version="${jclouds.version}",
+ org.jclouds*;version="${jclouds.version}",
+ *
+ </jclouds.osgi.import>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.jclouds.api</groupId>
+ <artifactId>sts</artifactId>
+ <version>${jclouds.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-core</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds</groupId>
+ <artifactId>jclouds-compute</artifactId>
+ <version>${jclouds.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-log4j</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jclouds.driver</groupId>
+ <artifactId>jclouds-sshj</artifactId>
+ <version>${jclouds.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.theoryinpractise</groupId>
+ <artifactId>clojure-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+ <profiles>
+ <profile>
+ <id>live</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <systemPropertyVariables>
+ <test.ec2.endpoint>${test.ec2.endpoint}</test.ec2.endpoint>
+ <test.ec2.api-version>${test.ec2.api-version}</test.ec2.api-version>
+ <test.ec2.build-version>${test.ec2.build-version}</test.ec2.build-version>
+ <test.ec2.identity>${test.ec2.identity}</test.ec2.identity>
+ <test.ec2.credential>${test.ec2.credential}</test.ec2.credential>
+ <test.ec2.template>${test.ec2.template}</test.ec2.template>
+ <test.ec2.ebs-template>${test.ec2.ebs-template}</test.ec2.ebs-template>
+ <test.ec2.windows-template>${test.ec2.windows-template}</test.ec2.windows-template>
+ <test.ec2.windows-owner>${test.ec2.windows-owner}</test.ec2.windows-owner>
+ </systemPropertyVariables>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj
new file mode 100644
index 0000000..d58eb6b
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ami2.clj
@@ -0,0 +1,84 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements. See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License. You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+(ns
+ #^{:author "Hunter Hutchinson, hunter.hutchinson@gmail.com"
+ :doc "A clojure binding to the jclouds AMI service interface."}
+ org.jclouds.ec2.ami2
+ (:use org.jclouds.compute2)
+ (:import org.jclouds.aws.domain.Region
+ org.jclouds.ec2.features.AMIApi
+ org.jclouds.ec2.options.CreateImageOptions
+ org.jclouds.compute.domain.NodeMetadata
+ (org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo)))
+
+(defn ^org.jclouds.ec2.features.AMIApi
+ ami-service
+ ""
+ [compute]
+ (-> compute
+ .getContext
+ .getProviderSpecificContext
+ .getApi
+ .getAMIApi().get))
+
+(defn get-region
+ "Coerces the first parameter into a Region string; strings, keywords, and
+ NodeMetadata instances are acceptable arguments. An optional second argument
+ is returned if the first cannot be coerced into a region string.
+ Returns nil otherwise."
+ ([v] (get-region v nil))
+ ([v default-region]
+ (cond
+ (string? v) v
+ (keyword? v) (name v)
+ (instance? NodeMetadata v) (let [zone (location v)]
+ ; no easier way to go from zone -> region?
+ (if (> (.indexOf zone "-") -1)
+ (subs zone 0 (-> zone count dec))
+ zone))
+ :else default-region)))
+
+(defn- as-string
+ [v]
+ (cond
+ (string? v) v
+ (keyword? v) (name v)
+ :else v))
+
+(defn- get-string
+ [map key]
+ (as-string (get map key)))
+
+(defn- as-int
+ [v]
+ (cond
+ (number? v) (int v)
+ (string? v) (Integer/parseInt v)
+ :else (throw (IllegalArgumentException.
+ (str "Don't know how to convert object of type " (class v) " to a string")))))
+
+(defn create-image-in-region
+ ([compute region name node-id description]
+ (.createImageInRegion (ami-service compute)
+ (get-region region)
+ (as-string name)
+ (as-string node-id)
+ (into-array CreateImageOptions
+ (when description
+ [(.withDescription (CreateImageOptions.) description)])))))
+
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj
new file mode 100644
index 0000000..2bde9a5
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/ebs2.clj
@@ -0,0 +1,286 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements. See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License. You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+(ns
+ #^{:author "Chas Emerick, cemerick@snowtide.com"
+ :doc "A clojure binding to the jclouds EBS service interface."}
+ org.jclouds.ec2.ebs2
+ (:use org.jclouds.compute2 [clojure.core.incubator :only (-?>)])
+ (:import org.jclouds.aws.domain.Region
+ org.jclouds.compute.domain.NodeMetadata
+ (org.jclouds.ec2.domain Volume Volume$Status Snapshot Snapshot$Status AvailabilityZoneInfo)
+ (org.jclouds.ec2.options DescribeSnapshotsOptions DetachVolumeOptions CreateSnapshotOptions)))
+(defn snapshot?
+ "Returns true iff the argument is a org.jclouds.ec2.domain.Snapshot."
+ [s]
+ (instance? Snapshot s))
+
+(defn volume?
+ "Returns true iff the argument is a org.jclouds.ec2.domain.Volume."
+ [v]
+ (instance? Volume v))
+
+(defn ^org.jclouds.ec2.services.ElasticBlockStoreClient
+ ebs-service
+ ""
+ [compute]
+ (-> compute
+ .getContext
+ .getProviderSpecificContext
+ .getApi
+ .getElasticBlockStoreServices))
+
+(defn get-region
+ "Coerces the first parameter into a Region string; strings, keywords, and
+ NodeMetadata instances are acceptable arguments. An optional second argument
+ is returned if the first cannot be coerced into a region string.
+ Returns nil otherwise."
+ ([v] (get-region v nil))
+ ([v default-region]
+ (cond
+ (string? v) v
+ (keyword? v) (name v)
+ (instance? NodeMetadata v) (let [zone (location v)]
+ ; no easier way to go from zone -> region?
+ (if (> (.indexOf zone "-") -1)
+ (subs zone 0 (-> zone count dec))
+ zone))
+ :else default-region)))
+
+(defn get-volume-id
+ "Returns a string volume ID taken from the given string, keyword, or Volume argument."
+ [v]
+ (cond
+ (instance? Volume v) (.getId ^Volume v)
+ (keyword? v) (name v)
+ (string? v) v
+ :else (throw (IllegalArgumentException.
+ (str "Can't obtain volume id from argument of type " (class v))))))
+
+(defn volumes
+ "Returns a set of org.jclouds.ec2.domain.Volume instances corresponding to the
+ volumes in the specified region (defaulting to your account's default region)."
+ [compute & [region & volume-ids]]
+ (set
+ (.describeVolumesInRegion (ebs-service compute)
+ (get-region region)
+ (into-array String (map get-volume-id
+ (if (get-region region)
+ volume-ids
+ (when region (cons region volume-ids))))))))
+
+(defn- as-string
+ [v]
+ (cond
+ (string? v) v
+ (keyword? v) (name v)
+ :else v))
+(defn- get-string
+ [map key]
+ (as-string (get map key)))
+
+(defn- as-int
+ [v]
+ (cond
+ (number? v) (int v)
+ (string? v) (Integer/parseInt v)
+ :else (throw (IllegalArgumentException.
+ (str "Don't know how to convert object of type " (class v) " to a string")))))
+
+(defn- snapshot-options
+ [optmap]
+ (let [string-array #(let [v (% optmap)]
+ (into-array String (cond
+ (keyword? v) [(name v)]
+ (string? v) [v]
+ :else (map as-string v))))]
+ (-> (DescribeSnapshotsOptions.)
+ (.ownedBy (string-array :owner))
+ (.snapshotIds (string-array :ids))
+ (.restorableBy (string-array :restorable-by)))))
+
+(defn snapshots
+ "Returns a set of org.jclouds.aws.ec2.domain.Snapshot instances that match
+ the criteria provided. Options include:
+
+ :region - region string, keyword, or NodeMetadata
+ :owner - AWS account id (or \"amazon\" or \"self\")
+ :restorable-by - AWS account id
+
+ Multiple values for each type of criteria can be provided by passing a seq
+ of the appropriate types as values."
+ [compute & options]
+ (let [options (apply hash-map options)
+ region (:region options)
+ options (snapshot-options (dissoc options :region))]
+ (set
+ (.describeSnapshotsInRegion (ebs-service compute)
+ (get-region region)
+ (into-array DescribeSnapshotsOptions [options])))))
+
+(defn create-snapshot
+ "Creates a snapshot of a volume in the specified region with an optional description.
+ If provided, the description must be < 255 characters in length. Returns the
+ org.jclouds.aws.ec2.domain.Snapshot object representing the created snapshot."
+ ([compute ^Volume volume] (create-snapshot compute volume nil))
+ ([compute ^Volume volume description] (create-snapshot compute (.getRegion volume) (.getId volume) description))
+ ([compute region volume-id description]
+ (.createSnapshotInRegion (ebs-service compute)
+ (get-region region)
+ (as-string volume-id)
+ (into-array CreateSnapshotOptions (when description
+ [(.withDescription (CreateSnapshotOptions.) description)])))))
+
+(defn delete-snapshot
+ "Deletes a snapshot in the specified region."
+ ([compute ^Snapshot snapshot] (delete-snapshot compute (.getRegion snapshot) (.getId snapshot)))
+ ([compute region snapshot-id]
+ (.deleteSnapshotInRegion (ebs-service compute)
+ (get-region region)
+ (as-string snapshot-id))))
+
+(defn get-zone
+ [v]
+ (cond
+ (instance? AvailabilityZoneInfo v) (.getZone v)
+ (instance? NodeMetadata v) (location ^NodeMetadata v)
+ (string? v) v
+ (keyword? v) (name v)
+ :else (throw (IllegalArgumentException.
+ (str "Can't obtain zone from argument of type " (class v))))))
+
+(defn attach-volume
+ "Attaches a volume to an instance, returning the resulting org.jclouds.aws.ec2.domain.Attachment."
+ ([compute ^NodeMetadata node volume device]
+ (attach-volume compute node (.getProviderId node) (get-volume-id volume) device))
+ ([compute region instance-id volume-id device]
+ (apply #(.attachVolumeInRegion (ebs-service compute)
+ (get-region region) % %2 %3)
+ (map as-string [volume-id instance-id device]))))
+
+(defn detach-volume
+ "Detaches a volume from the instance to which it is currently attached.
+ The volume may be specified with a Volume instance, a string, or a keyword.
+ Providing a logical true value for the :force option will cause the volume
+ to be forcibly detached, regardless of whether it is in-use (mounted) or not.
+
+ If the volume is specified as a string or keyword, one of the following options
+ is additionally required:
+
+ :region - the region where the volume is allocated
+ :node - a node in the region where the volume is allocated
+
+ FYI: It appears that issuing a detatch-volume command while the volume in question is mounted
+ will cause the volume to be detatched immediately upon the volume beign unmounted."
+ [compute volume & options]
+ (let [options (apply hash-map options)
+ volume-id (get-volume-id volume)
+ region (get-region (if (instance? Volume volume)
+ (.getRegion volume)
+ (or (:region options) (:node options))))]
+ (when (not region)
+ (throw (IllegalArgumentException.
+ "Must specify volume's region via :region or :node options, or by providing a Volume instance.")))
+ (.detachVolumeInRegion (ebs-service compute)
+ region
+ volume-id
+ (boolean (:force options))
+ (into-array DetachVolumeOptions []))))
+
+(defn create-volume
+ "Creates a new volume given a set of options:
+
+ - one of :zone (keyword, string, or AvailabilityZoneInfo) or :node (NodeMetadata)
+ - one or both of :snapshot (keyword, string, or Snapshot instance) or :size
+ (string, keyword, or number)
+ - :device (string or keyword) provided *only* when you want to attach the new volume to
+ the :node you specified!
+
+ Returns a vector of [created org.jclouds.ec2.domain.Volume,
+ optional org.jclouds.ec2.domain.Attachment]
+
+ Note that specifying :node instead of :zone will only attach the created volume
+ :device is also provided. Otherwise, the node is only used to obtain the desired
+ availability zone.
+
+ Note also that if :device and :node are specified, and the attach operation fails,
+ you will have \"leaked\" the newly-created volume
+ (volume creation and attachment cannot be done atomically)."
+ [compute & options]
+ (when (-> options count odd?)
+ (throw (IllegalArgumentException. "Must provide key-value pairs, e.g. :zone :us-east-1d :size 200")))
+ (let [options (apply hash-map options)
+ snapshot (get-string options :snapshot)
+ snapshot (if (snapshot? snapshot) (.getId snapshot) snapshot)
+ size (-?> (get-string options :size) as-int)
+ ^NodeMetadata node (:node options)
+ zone (or node (get-string options :zone))
+ zone (if zone
+ (get-zone zone)
+ (throw (IllegalArgumentException. "Must supply a :zone or :node option.")))
+ ebs (ebs-service compute)]
+ (when (and (:device options) (not node))
+ (throw (IllegalArgumentException. "Cannot create and attach new volume; no :node specified")))
+ (let [new-volume (cond
+ (and snapshot size) (.createVolumeFromSnapshotInAvailabilityZone ebs zone size snapshot)
+ snapshot (.createVolumeFromSnapshotInAvailabilityZone ebs zone snapshot)
+ size (.createVolumeInAvailabilityZone ebs zone size)
+ :else (throw (IllegalArgumentException. "Must supply :size and/or :snapshot options.")))]
+ [new-volume (when (:device options)
+ (attach-volume compute node new-volume (as-string (:device options))))])))
+
+(defn delete-volume
+ "Deletes a volume in the specified region."
+ ([compute ^Volume volume]
+ (delete-volume (.getRegion volume) (.getId volume)))
+ ([compute region volume-id]
+ (.deleteVolumeInRegion (ebs-service compute)
+ (get-region region)
+ (as-string volume-id))))
+
+(defn status
+ "Returns the status of the given entity; works for Volumes and Snapshots."
+ [k]
+ (.getStatus k))
+
+(defn status-available?
+ [^Volume v]
+ (= Volume$Status/AVAILABLE (status v)))
+
+(defn status-creating?
+ [^Volume v]
+ (= Volume$Status/CREATING (status v)))
+
+(defn status-deleting?
+ [^Volume v]
+ (= Volume$Status/DELETING (status v)))
+
+(defn status-in-use?
+ [^Volume v]
+ (= Volume$Status/IN_USE (status v)))
+
+(defn status-completed?
+ [^Snapshot s]
+ (= Snapshot$Status/COMPLETED (status s)))
+
+(defn status-error?
+ [^Snapshot s]
+ (= Snapshot$Status/ERROR (status s)))
+
+(defn status-pending?
+ [^Snapshot s]
+ (= Snapshot$Status/PENDING (status s)))
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj
new file mode 100644
index 0000000..68c372f
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/elastic_ip2.clj
@@ -0,0 +1,80 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements. See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License. You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+(ns
+ #^{:author "Chas Emerick, cemerick@snowtide.com"
+ :doc "A clojure binding for the jclouds AWS elastic IP address interface."}
+ org.jclouds.ec2.elastic-ip2
+ (:require (org.jclouds [compute2 :as compute])
+ [org.jclouds.ec2.ebs2 :as ebs])
+ (:import org.jclouds.compute.domain.NodeMetadata
+ (org.jclouds.ec2.domain PublicIpInstanceIdPair)))
+
+(defn ^org.jclouds.ec2.features.ElasticIPAddressApi
+ eip-service
+ "Returns an ElasticIPAddressApi for the given ComputeService"
+ [compute]
+ (-> compute
+ .getContext .getProviderSpecificContext .getApi .getElasticIPAddressApi().get))
+
+(defn allocate
+ "Claims a new elastic IP address within the (optionally) specified region for your account.
+ Region may be a string, keyword, or a node from which the region
+ is inferred. Returns the IP address as a string."
+ ([compute] (allocate compute nil))
+ ([compute region]
+ (.allocateAddressInRegion (eip-service compute) (ebs/get-region region))))
+
+(defn associate
+ "Associates an elastic IP address with a node."
+ ([compute ^NodeMetadata node public-ip]
+ (associate node public-ip (.getProviderId node)))
+ ([compute region public-ip instance-id]
+ (.associateAddressInRegion (eip-service compute)
+ (ebs/get-region region)
+ public-ip
+ instance-id)))
+
+(defn addresses
+ "Returns a map of elastic IP addresses to maps with slots:
+
+ :region - the region (string/keyword/NodeMetadata) the IP address is allocated within
+ :node-id - the ID of the instance with which the IP address is associated (optional)
+
+ You may optionally specify which IP addresses you would like to query."
+ ([compute] (addresses compute nil))
+ ([compute region & public-ips]
+ (into {} (for [^PublicIpInstanceIdPair pair (.describeAddressesInRegion (eip-service compute)
+ (ebs/get-region region)
+ (into-array String public-ips))]
+ [(.getPublicIp pair) (merge {:region (.getRegion pair)}
+ (when (.getInstanceId pair) {:node-id (.getInstanceId pair)}))]))))
+
+(defn dissociate
+ "Dissociates an elastic IP address from the node with which it is currently associated."
+ [compute region public-ip]
+ (.disassociateAddressInRegion (eip-service compute)
+ (ebs/get-region region)
+ public-ip))
+
+(defn release
+ "Disclaims an elastic IP address from your account."
+ ([compute public-ip] (release compute public-ip nil))
+ ([compute public-ip region]
+ (.releaseAddressInRegion (eip-service compute)
+ (ebs/get-region region)
+ public-ip)))
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj
new file mode 100644
index 0000000..a4f33cf
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/clojure/org/jclouds/ec2/security_group2.clj
@@ -0,0 +1,99 @@
+;
+; Licensed to the Apache Software Foundation (ASF) under one or more
+; contributor license agreements. See the NOTICE file distributed with
+; this work for additional information regarding copyright ownership.
+; The ASF licenses this file to You under the Apache License, Version 2.0
+; (the "License"); you may not use this file except in compliance with
+; the License. You may obtain a copy of the License at
+;
+; http://www.apache.org/licenses/LICENSE-2.0
+;
+; Unless required by applicable law or agreed to in writing, software
+; distributed under the License is distributed on an "AS IS" BASIS,
+; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+; See the License for the specific language governing permissions and
+; limitations under the License.
+;
+
+(ns
+ #^{:author "Juegen Hoetzel, juergen@archlinux.org"
+ :doc "A clojure binding for the jclouds AWS security group interface."}
+ org.jclouds.ec2.security-group2
+ (:require (org.jclouds [compute2 :as compute])
+ [org.jclouds.ec2.ebs2 :as ebs])
+ (:import org.jclouds.ec2.domain.SecurityGroup
+ org.jclouds.ec2.features.SecurityGroupApi
+ org.jclouds.net.domain.IpProtocol))
+
+(defn #^SecurityGroupApi
+ sg-service
+ "Returns the SecurityGroup Api associated with the specified compute service."
+ [compute]
+ (-> compute .getContext .getProviderSpecificContext .getApi .getSecurityGroupApi().get))
+
+(defn create-group
+ "Creates a new security group.
+
+ e.g. (create-group compute \"Database Server\" \"Description for group\" :region :us-west-1)"
+ [compute name & {:keys [description region]}]
+ (.createSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name (or description name)))
+
+(defn delete-group
+ "Deletes a security group.
+
+ e.g. (delete-group compute \"Database Server\" :region :us-west-1)"
+ [compute name & {:keys [region]}]
+ (.deleteSecurityGroupInRegion (sg-service compute) (ebs/get-region region) name))
+
+(defn groups
+ "Returns a map of GroupName -> org.jclouds.ec2.domain.SecurityGroup instances.
+
+ e.g. (groups compute :region :us-east-1)"
+ [compute & {:keys [region]}]
+ (into {} (for [#^SecurityGroup group (.describeSecurityGroupsInRegion (sg-service compute)
+ (ebs/get-region region)
+ (into-array String '()))]
+ [(.getName group) group])))
+
+(defn get-protocol [v]
+ "Coerce argument to a IP Protocol."
+ (cond
+ (instance? IpProtocol v) v
+ (keyword? v) (if-let [p (get {:tcp IpProtocol/TCP
+ :udp IpProtocol/UDP
+ :icmp IpProtocol/ICMP}
+ v)]
+ p
+ (throw (IllegalArgumentException.
+ (str "Can't obtain IP protocol from " v " (valid :tcp, :udp and :icmp)"))))
+ (nil? v) IpProtocol/TCP
+ :else (throw (IllegalArgumentException.
+ (str "Can't obtain IP protocol from argument of type " (type v))))))
+
+(defn authorize
+ "Adds permissions to a security group.
+
+ e.g. (authorize compute \"jclouds#webserver#us-east-1\" 80 :ip-range \"0.0.0.0/0\")
+ (authorize compute \"jclouds#webserver#us-east-1\" [1000,2000] :protocol :udp)"
+
+ [compute group-name port & {:keys [protocol ip-range region]}]
+ (let [group ((groups compute :region region) group-name)
+ [from-port to-port] (if (number? port) [port port] port)]
+ (if group
+ (.authorizeSecurityGroupIngressInRegion
+ (sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0"))
+ (throw (IllegalArgumentException.
+ (str "Can't find security group for name " group-name))))))
+
+(defn revoke
+ "Revokes permissions from a security group.
+
+ e.g. (revoke compute 80 \"jclouds#webserver#us-east-1\" :protocol :tcp 80 80 :ip-range \"0.0.0.0/0\")"
+ [compute group-name port & {:keys [protocol ip-range region]}]
+ (let [group ((groups compute :region region) group-name)
+ [from-port to-port] (if (number? port) [port port] port)]
+ (if group
+ (.revokeSecurityGroupIngressInRegion
+ (sg-service compute) (ebs/get-region region) (.getName group) (get-protocol protocol) from-port to-port (or ip-range "0.0.0.0/0"))
+ (throw (IllegalArgumentException.
+ (str "Can't find security group for name " group-name))))))
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Api.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Api.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Api.java
new file mode 100644
index 0000000..d8637e8
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Api.java
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2;
+
+import java.io.Closeable;
+import java.util.Set;
+import org.jclouds.ec2.features.SubnetApi;
+import org.jclouds.ec2.features.TagApi;
+import org.jclouds.ec2.features.WindowsApi;
+import org.jclouds.ec2.features.AMIApi;
+import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
+import org.jclouds.ec2.features.ElasticBlockStoreApi;
+import org.jclouds.ec2.features.ElasticIPAddressApi;
+import org.jclouds.ec2.features.InstanceApi;
+import org.jclouds.ec2.features.KeyPairApi;
+import org.jclouds.ec2.features.SecurityGroupApi;
+import org.jclouds.javax.annotation.Nullable;
+import org.jclouds.location.Region;
+import org.jclouds.location.functions.RegionToEndpointOrProviderIfNull;
+import org.jclouds.rest.annotations.Delegate;
+import org.jclouds.rest.annotations.EndpointParam;
+
+import com.google.common.base.Optional;
+import com.google.inject.Provides;
+
+/**
+ * Provides access to EC2 features, broken up by feature group. Use of the
+ * {@link Optional} type allows you to check to see if the underlying
+ * implementation supports a particular feature before attempting to use it.
+ * This is useful in clones like OpenStack, CloudStack, or Eucalyptus, which
+ * track the api, but are always behind Amazon's service. In the case of Amazon
+ * ({@code aws-ec2}), you can expect all features to be present.
+ *
+ *
+ * Example
+ *
+ * <pre>
+ * Optional<? extends WindowsApi> windowsOption = ec2Api.getWindowsApi();
+ * checkState(windowsOption.isPresent(), "windows feature required, but not present");
+ * </pre>
+ *
+ * @author Adrian Cole
+ */
+public interface EC2Api extends Closeable {
+ /**
+ *
+ * @return the Region codes configured
+ */
+ @Provides
+ @Region
+ Set<String> getConfiguredRegions();
+
+ /**
+ * Provides synchronous access to Windows features.
+ */
+ @Delegate
+ Optional<? extends WindowsApi> getWindowsApi();
+
+ @Delegate
+ Optional<? extends WindowsApi> getWindowsApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to Tag features.
+ */
+ @Delegate
+ Optional<? extends TagApi> getTagApi();
+
+ @Delegate
+ Optional<? extends TagApi> getTagApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to Subnet features.
+ */
+ @Delegate
+ Optional<? extends SubnetApi> getSubnetApi();
+
+ @Delegate
+ Optional<? extends SubnetApi> getSubnetApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to AMI services.
+ */
+ @Delegate
+ Optional<? extends AMIApi> getAMIApi();
+
+ @Delegate
+ Optional<? extends AMIApi> getAMIApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+
+ /**
+ * Provides synchronous access to Elastic IP Address services.
+ */
+ @Delegate
+ Optional<? extends ElasticIPAddressApi> getElasticIPAddressApi();
+
+ @Delegate
+ Optional<? extends ElasticIPAddressApi> getElasticIPAddressApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to Instance services.
+ */
+ @Delegate
+ Optional<? extends InstanceApi> getInstanceApi();
+
+ @Delegate
+ Optional<? extends InstanceApi> getInstanceApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to KeyPair services.
+ */
+ @Delegate
+ Optional<? extends KeyPairApi> getKeyPairApi();
+
+ @Delegate
+ Optional<? extends KeyPairApi> getKeyPairApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to SecurityGroup services.
+ */
+ @Delegate
+ Optional<? extends SecurityGroupApi> getSecurityGroupApi();
+
+ @Delegate
+ Optional<? extends SecurityGroupApi> getSecurityGroupApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to Availability Zones and Regions services.
+ */
+ @Delegate
+ Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApi();
+
+ @Delegate
+ Optional<? extends AvailabilityZoneAndRegionApi> getAvailabilityZoneAndRegionApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+
+ /**
+ * Provides synchronous access to Elastic Block Store services.
+ */
+ @Delegate
+ Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApi();
+
+ @Delegate
+ Optional<? extends ElasticBlockStoreApi> getElasticBlockStoreApiForRegion(
+ @EndpointParam(parser = RegionToEndpointOrProviderIfNull.class) @Nullable String region);
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java
new file mode 100644
index 0000000..2b081c5
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2ApiMetadata.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2;
+
+import static org.jclouds.aws.reference.AWSConstants.PROPERTY_AUTH_TAG;
+import static org.jclouds.aws.reference.AWSConstants.PROPERTY_HEADER_TAG;
+import static org.jclouds.compute.config.ComputeServiceProperties.RESOURCENAME_DELIMITER;
+import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AMI_OWNERS;
+import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS;
+import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_GENERATE_INSTANCE_NAMES;
+import static org.jclouds.ec2.reference.EC2Constants.PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.apis.ApiMetadata;
+import org.jclouds.ec2.compute.EC2ComputeServiceContext;
+import org.jclouds.ec2.compute.config.EC2ComputeServiceContextModule;
+import org.jclouds.ec2.compute.config.EC2ResolveImagesModule;
+import org.jclouds.ec2.config.EC2HttpApiModule;
+import org.jclouds.rest.internal.BaseHttpApiMetadata;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.inject.Module;
+
+public final class EC2ApiMetadata extends BaseHttpApiMetadata<EC2Api> {
+
+ @Override
+ public Builder toBuilder() {
+ return new Builder().fromApiMetadata(this);
+ }
+
+ public EC2ApiMetadata() {
+ super(new Builder());
+ }
+
+ protected EC2ApiMetadata(Builder builder) {
+ super(builder);
+ }
+
+ public static Properties defaultProperties() {
+ Properties properties = BaseHttpApiMetadata.defaultProperties();
+ properties.setProperty(PROPERTY_AUTH_TAG, "AWS");
+ properties.setProperty(PROPERTY_HEADER_TAG, "amz");
+ properties.setProperty(PROPERTY_EC2_AMI_OWNERS, "*");
+ properties.setProperty(PROPERTY_EC2_TIMEOUT_SECURITYGROUP_PRESENT, "500");
+ properties.setProperty(PROPERTY_EC2_AUTO_ALLOCATE_ELASTIC_IPS, "false");
+ properties.setProperty(RESOURCENAME_DELIMITER, "#");
+ properties.setProperty(PROPERTY_EC2_GENERATE_INSTANCE_NAMES, "true");
+ return properties;
+ }
+
+ public static final class Builder extends BaseHttpApiMetadata.Builder<EC2Api, Builder> {
+ public Builder() {
+ id("ec2")
+ .name("Amazon Elastic Compute Cloud (EC2) API")
+ .identityName("Access Key ID")
+ .credentialName("Secret Access Key")
+ .defaultEndpoint("https://ec2.us-east-1.amazonaws.com")
+ .documentation(URI.create("http://docs.amazonwebservices.com/AWSEC2/latest/APIReference"))
+ .version("2010-08-31")
+ .defaultProperties(EC2ApiMetadata.defaultProperties())
+ .view(EC2ComputeServiceContext.class)
+ .defaultModules(ImmutableSet.<Class<? extends Module>>of(EC2HttpApiModule.class, EC2ResolveImagesModule.class, EC2ComputeServiceContextModule.class));
+ }
+
+ @Override
+ public ApiMetadata build() {
+ return new EC2ApiMetadata(this);
+ }
+
+ @Override
+ protected Builder self() {
+ return this;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
new file mode 100644
index 0000000..7cb4675
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/EC2Fallbacks.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+import static com.google.common.base.Throwables.propagate;
+import static com.google.common.util.concurrent.Futures.immediateFuture;
+
+import org.jclouds.Fallback;
+import org.jclouds.aws.AWSResponseException;
+
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.util.concurrent.ListenableFuture;
+
+public final class EC2Fallbacks {
+ private EC2Fallbacks() {
+ }
+
+ public static final class VoidOnVolumeAvailable implements Fallback<Void> {
+ @Override
+ public ListenableFuture<Void> create(Throwable t) throws Exception {
+ return immediateFuture(createOrPropagate(t));
+ }
+
+ @Override
+ public Void createOrPropagate(Throwable t) throws Exception {
+ if (checkNotNull(t, "throwable") instanceof AWSResponseException) {
+ AWSResponseException e = AWSResponseException.class.cast(t);
+ if (Predicates.in(ImmutableSet.of("IncorrectState", "available")).apply(e.getError().getCode()))
+ return null;
+ }
+ throw propagate(t);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java
new file mode 100644
index 0000000..2286d56
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBlockDeviceMappingToIndexedFormParams.java
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+import static java.lang.String.format;
+import static org.jclouds.http.utils.Queries.queryParser;
+import static org.jclouds.io.Payloads.newUrlEncodedFormPayload;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.jclouds.ec2.domain.BlockDevice;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.Multimap;
+
+/**
+ * @author Oleksiy Yarmula
+ * @author Adrian Cole
+ */
+public class BindBlockDeviceMappingToIndexedFormParams implements Binder {
+
+ private static final String deviceNamePattern = "BlockDeviceMapping.%d.DeviceName";
+ private static final String deleteOnTerminationPattern = "BlockDeviceMapping.%d.Ebs.DeleteOnTermination";
+ private static final String volumeIdPattern = "BlockDeviceMapping.%d.Ebs.VolumeId";
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(checkNotNull(input, "input") instanceof Map, "this binder is only valid for Map");
+ Map<String, BlockDevice> blockDeviceMapping = (Map<String, BlockDevice>) input;
+ Multimap<String, String> original = queryParser().apply(request.getPayload().getRawContent().toString());
+ ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.builder();
+ builder.putAll("Action", "ModifyInstanceAttribute");
+ int amazonOneBasedIndex = 1; // according to docs, counters must start with 1
+ for (Entry<String, BlockDevice> ebsBlockDeviceName : blockDeviceMapping.entrySet()) {
+ // not null by contract
+ builder.put(format(deviceNamePattern, amazonOneBasedIndex), ebsBlockDeviceName.getKey());
+ builder.put(format(deleteOnTerminationPattern, amazonOneBasedIndex),
+ String.valueOf(ebsBlockDeviceName.getValue().isDeleteOnTermination()));
+ builder.put(format(volumeIdPattern, amazonOneBasedIndex), ebsBlockDeviceName.getValue().getVolumeId());
+ amazonOneBasedIndex++;
+ }
+ builder.putAll("InstanceId", original.get("InstanceId"));
+ request.setPayload(newUrlEncodedFormPayload(builder.build()));
+ return request;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java
new file mode 100644
index 0000000..c37d3e1
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindBundleIdsToIndexedFormParams.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.util.AWSUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+/**
+ * Binds the String [] to form parameters named with BundleId.index
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindBundleIdsToIndexedFormParams implements Binder {
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return AWSUtils.indexStringArrayToFormValuesWithPrefix(request, "BundleId", input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindFiltersToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindFiltersToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindFiltersToIndexedFormParams.java
new file mode 100644
index 0000000..db22895
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindFiltersToIndexedFormParams.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.util.AWSUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+import com.google.common.collect.Multimap;
+
+/**
+ * Binds the Multimap to form parameters for filtering.
+ *
+ * <pre>
+ * https://ec2.amazonaws.com/?Action=DescribeTags
+ * &Filter.1.Name=resource-type
+ * &Filter.1.Value.1=instance
+ * &Filter.2.Name=key
+ * &Filter.2.Value.1=stack
+ * &Filter.3.Name=value
+ * &Filter.3.Value.1=Test
+ * &Filter.3.Value.2=Production
+ * &AUTHPARAMS
+ * </pre>
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindFiltersToIndexedFormParams implements Binder {
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(checkNotNull(input, "input") instanceof Multimap, "this binder is only valid for Multimap");
+ @SuppressWarnings("unchecked")
+ Multimap<String, String> filters = (Multimap<String, String>) input;
+ return AWSUtils.indexMultimapToFormValuesWithPrefix(request, "Filter", "Name", "Value", filters);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupIdsToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupIdsToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupIdsToIndexedFormParams.java
new file mode 100644
index 0000000..bafc493
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupIdsToIndexedFormParams.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.util.AWSUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+/**
+ * Binds the String [] to query parameters named with GroupId.index
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindGroupIdsToIndexedFormParams implements Binder {
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return AWSUtils.indexStringArrayToFormValuesWithPrefix(request, "GroupId", input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupNamesToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupNamesToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupNamesToIndexedFormParams.java
new file mode 100644
index 0000000..1efc743
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindGroupNamesToIndexedFormParams.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.util.AWSUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+/**
+ * Binds the String [] to query parameters named with GroupName.index
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindGroupNamesToIndexedFormParams implements Binder {
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return AWSUtils.indexStringArrayToFormValuesWithPrefix(request, "GroupName", input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindInstanceIdsToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindInstanceIdsToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindInstanceIdsToIndexedFormParams.java
new file mode 100644
index 0000000..1c90791
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindInstanceIdsToIndexedFormParams.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import javax.inject.Singleton;
+
+import org.jclouds.aws.util.AWSUtils;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.rest.Binder;
+
+/**
+ * Binds the String [] to form parameters named with InstanceId.index
+ *
+ * @author Adrian Cole
+ */
+@Singleton
+public class BindInstanceIdsToIndexedFormParams implements Binder {
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ return AWSUtils.indexStringArrayToFormValuesWithPrefix(request, "InstanceId", input);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionToIndexedFormParams.java
new file mode 100644
index 0000000..403f592
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionToIndexedFormParams.java
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.ec2.util.IpPermissions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.rest.Binder;
+
+/**
+ * @author Adrian Cole
+ */
+public class BindIpPermissionToIndexedFormParams implements Binder {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(checkNotNull(input, "input") instanceof IpPermission, "this binder is only valid for IpPermission");
+ IpPermission perm = (IpPermission) input;
+ return (R) request.toBuilder().replaceFormParams(IpPermissions.buildFormParametersForIndex(0, perm)).build();
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/58fe66df/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionsToIndexedFormParams.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionsToIndexedFormParams.java b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionsToIndexedFormParams.java
new file mode 100644
index 0000000..4bead83
--- /dev/null
+++ b/dependencies/jclouds/apis/ec2/1.7.1-stratos/src/main/java/org/jclouds/ec2/binders/BindIpPermissionsToIndexedFormParams.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.ec2.binders;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import org.jclouds.ec2.util.IpPermissions;
+import org.jclouds.http.HttpRequest;
+import org.jclouds.net.domain.IpPermission;
+import org.jclouds.rest.Binder;
+
+import com.google.common.collect.ImmutableMultimap;
+import com.google.common.collect.ImmutableMultimap.Builder;
+
+/**
+ * @author Adrian Cole
+ */
+public class BindIpPermissionsToIndexedFormParams implements Binder {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <R extends HttpRequest> R bindToRequest(R request, Object input) {
+ checkArgument(checkNotNull(input, "input") instanceof Iterable,
+ "this binder is only valid for Iterable<IpPermission>");
+ Builder<String, String> formBuilder = ImmutableMultimap.builder();
+ int index = 0;
+ for (IpPermission perm : (Iterable<IpPermission>) input)
+ formBuilder.putAll(IpPermissions.buildFormParametersForIndex(index++, perm));
+ ImmutableMultimap<String, String> forms = formBuilder.build();
+ return forms.size() == 0 ? request : (R) request.toBuilder().replaceFormParams(forms).build();
+ }
+
+}