Full Code of rightscale/right_aws for AI

master 5e45a72260f0 cached
82 files
978.3 KB
256.9k tokens
1621 symbols
1 requests
Download .txt
Showing preview only (1,017K chars total). Download the full file or copy to clipboard to get everything.
Repository: rightscale/right_aws
Branch: master
Commit: 5e45a72260f0
Files: 82
Total size: 978.3 KB

Directory structure:
gitextract_uj4pe4k8/

├── .gitignore
├── Dockerfile
├── Gemfile
├── History.txt
├── LICENSE
├── Manifest.txt
├── README.txt
├── Rakefile
├── docker-compose.yml
├── lib/
│   ├── acf/
│   │   ├── right_acf_interface.rb
│   │   ├── right_acf_invalidations.rb
│   │   ├── right_acf_origin_access_identities.rb
│   │   └── right_acf_streaming_interface.rb
│   ├── acw/
│   │   └── right_acw_interface.rb
│   ├── as/
│   │   └── right_as_interface.rb
│   ├── awsbase/
│   │   ├── benchmark_fix.rb
│   │   ├── right_awsbase.rb
│   │   ├── support.rb
│   │   └── version.rb
│   ├── ec2/
│   │   ├── right_ec2.rb
│   │   ├── right_ec2_ebs.rb
│   │   ├── right_ec2_images.rb
│   │   ├── right_ec2_instances.rb
│   │   ├── right_ec2_monitoring.rb
│   │   ├── right_ec2_placement_groups.rb
│   │   ├── right_ec2_reserved_instances.rb
│   │   ├── right_ec2_security_groups.rb
│   │   ├── right_ec2_spot_instances.rb
│   │   ├── right_ec2_tags.rb
│   │   ├── right_ec2_vpc.rb
│   │   ├── right_ec2_vpc2.rb
│   │   └── right_ec2_windows_mobility.rb
│   ├── elb/
│   │   └── right_elb_interface.rb
│   ├── emr/
│   │   └── right_emr_interface.rb
│   ├── iam/
│   │   ├── right_iam_access_keys.rb
│   │   ├── right_iam_groups.rb
│   │   ├── right_iam_interface.rb
│   │   ├── right_iam_mfa_devices.rb
│   │   └── right_iam_users.rb
│   ├── rds/
│   │   └── right_rds_interface.rb
│   ├── right_aws.rb
│   ├── route_53/
│   │   └── right_route_53_interface.rb
│   ├── s3/
│   │   ├── right_s3.rb
│   │   └── right_s3_interface.rb
│   ├── sdb/
│   │   ├── active_sdb.rb
│   │   └── right_sdb_interface.rb
│   ├── sns/
│   │   └── right_sns_interface.rb
│   └── sqs/
│       ├── right_sqs.rb
│       ├── right_sqs_gen2.rb
│       ├── right_sqs_gen2_interface.rb
│       └── right_sqs_interface.rb
├── right_aws.gemspec
└── test/
    ├── README.mdown
    ├── acf/
    │   ├── test_helper.rb
    │   └── test_right_acf.rb
    ├── awsbase/
    │   ├── test_helper.rb
    │   └── test_right_awsbase.rb
    ├── ec2/
    │   ├── test_helper.rb
    │   └── test_right_ec2.rb
    ├── elb/
    │   ├── test_helper.rb
    │   └── test_right_elb.rb
    ├── http_connection.rb
    ├── rds/
    │   ├── test_helper.rb
    │   └── test_right_rds.rb
    ├── route_53/
    │   ├── fixtures/
    │   │   ├── a_record.xml
    │   │   └── alias_record.xml
    │   ├── test_helper.rb
    │   └── test_right_route_53.rb
    ├── s3/
    │   ├── test_helper.rb
    │   ├── test_right_s3.rb
    │   └── test_right_s3_stubbed.rb
    ├── sdb/
    │   ├── test_active_sdb.rb
    │   ├── test_batch_put_attributes.rb
    │   ├── test_helper.rb
    │   └── test_right_sdb.rb
    ├── sns/
    │   ├── test_helper.rb
    │   └── test_right_sns.rb
    ├── sqs/
    │   ├── test_helper.rb
    │   ├── test_right_sqs.rb
    │   └── test_right_sqs_gen2.rb
    ├── test_credentials.rb
    └── ts_right_aws.rb

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitignore
================================================
pkg/
.rvmrc


================================================
FILE: Dockerfile
================================================
FROM ruby:2.1.10
RUN apt-get update -qq && apt-get install -y \
    build-essential \
    libxml2 \
    libxml2-dev \
    && rm -rf /var/lib/apt/lists/*
WORKDIR /right_aws
COPY Gemfile Gemfile.lock /right_aws/
RUN bundle install


================================================
FILE: Gemfile
================================================
source "http://rubygems.org"

gem "right_http_connection", ">= 1.5.0", git: "https://github.com/flexera-public/right_http_connection"
gem 'libxml-ruby', "2.8.0"

group :development do
  gem 'rake', '10.4.2'
end


================================================
FILE: History.txt
================================================
== 1.1.0 2007-08-10
Initial release.

== 1.2.0 2007-09-12

* r1718, todd, 2007-09-12 15:34:37
  * # 458, Extensive documentation review, rework, and expansion.  Also added
    coverage analysis to the test suite using RCov.

* r1690, todd, 2007-09-07 15:23:11
  * # 447, Add support.rb to manifest

* r1688, todd, 2007-09-07 13:57:39
  * # 447, Use Active Support if available, but don't require it.  Load our own
    extensions if it's not present.  This keeps us from overloading ActiveSupport if
    a user's already using it.

* r1687, todd, 2007-09-07 11:36:43
  * # 447, Removed dependency on activesupport

* r1676, konstantin, 2007-09-06 01:27:09
  * paid AMIs, small fix

* r1667, konstantin, 2007-09-05 12:58:10
  * # 427, paid AMI support for ec2_instances

* r1658, konstantin, 2007-09-05 01:02:25
  * params improvements for ec2.describe_xxx, now ones can use a String as well as an Array.

* r1653, konstantin, 2007-09-04 12:31:19
  * libxml and paid AMI support added

* r1581, tve, 2007-08-24 16:21:45
  * Improved RightAws documentation

== 1.3.0 2007-09-26

* r1754, todd, 2007-09-19 13:48:34
  * # 487, # 488, Consolidate a lot of code that was repeated in three places.
    Fix error handling path when using streaming GET interfaces with S3.
    Also add a stub for RightHttpConnection which allows more control over the
    unit tests.  Expand the unit tests and coverage tests.

* r1755, todd, 2007-09-19 14:29:19
  * # 487, RDoc fixes after code consolidation

* r1866, konstantin, 2007-10-05 06:17:36
  * # 220, close connection on HTTP 5xx/4xx errors

== 1.4.0 2007-10-10

* r1868, konstantin, 2007-10-05 06:38:37
  * # 220, inst_type branch merge into 1.3.0 release

* r1869, konstantin, 2007-10-05 07:32:34
  * right_http_connection 1.1.1 requirements fixed

* r1879, konstantin, 2007-10-07 02:11:24
  * # 524, blocks added to ec2_describe_xxx to support aws_cache

* r1924, konstantin, 2007-10-12 11:35:06
  * # 536, user_data bug fix

* r1929, tve,  2007-10-15 00:00:11
  * Fix libxml/rexml selection bug

* r1938, konstantin, 2007-10-16 10:53:56
  * instance type support is set to default

== 1.4.3 2007-10-25

* r1983, konstantin, 2007-10-25 22:33:00 +0400
  * Fixed ActiveSupport requirement bug (thanks to Toby)
  * Fixed HttpConnection logging to stdout bug (thanks to Toby)

== 1.4.4

* r1999, tve, 2007-11-01 00:07:00 -0700
  * Fixed escaping issue affecting key names in S3 gem
  * Fixed duplicate marker in S3 incremental bucket listing

* r2001, konstantin, 2007-11-01 12:03:13  +0300
  * Fixed multiple permissions assignment on Grantee#grant/revoke
  * Fixed new grantee permissions set ingnore (Grantee#apply)
  * S3::Grantee#exists? method added

* r2109, konstantin, 2007-11-12 21:49:36  +0300
  * RightAwsBaseInterface: caching implemented.
    (The Ec2 functions are being cached: describe_images, describe_instances,
    describe_security_groups and describe_key_pairs)

== 1.4.5 - 1.4.6
* r 2619, konstantin, 01-17-08 16:18:36  +0300
  * S3 Location constraints support added.
  * Fixed bug with trailing '/' in the bucket name for 'EU' located buckets
  * Added: S3Interface#bucket_location, S3::Bucket#location

== 1.4.7
* r 2622, konstantin, 01-18-08 13:52:20  +0300
  * Virtual domains doc added
  * S3 Query API fixed to support virtual domains.

== 1.4.8
* r 2650, konstantin, 01-24-08 11:12:00  +0300
  * net_fix.rb moved to right_http_connection

== 1.5.0
* r 2688, konstantin, 02-30-08 15:42:00  +0300
  * SDB support added.
  * RightAws::S3::bucket and RightAws::S3::Bucket.create methods behaviour
    changed: param +create+ is set to +false+ by default.

== 1.6.0

* r2780, todd, 2008-02-11 11:41:07 -0800 (Mon, 11 Feb 2008), 4 lines
  * Some doc updates & tweaks: we now support ultra-large PUTs to S3, small SDB
    cleanups, add SDB to the list of interfaces in RightAws, update some copyrights,
    warn about loading attachment_fu AFTER right_aws (big no-no).

* r2784, todd, 2008-02-11 13:46:47 -0800 (Mon, 11 Feb 2008), 2 lines
  * One final clarification: you may get a Net::HTTP bad monkey patch exception

* r2880, todd, 2008-02-25 18:06:22 -0800 (Mon, 25 Feb 2008), 2 lines
  * Add SQS 'Gen 2' interface implementation

* r2913, todd, 2008-02-29 16:57:07 -0800 (Fri, 29 Feb 2008), 3 lines
  * SqsGen2 (object interface), unit tests for both interfaces, documentation updates.

* r2922, todd, 2008-03-03 15:26:42 -0800 (Mon, 03 Mar 2008), 2 lines
  * couple of documentation tweaks in prep for 1.6.0

== 1.6.1

* r2963, todd, 2008-03-06 19:10:23 -0800 (Thu, 06 Mar 2008), 3 lines
  * (#950) Many minor fixes in incrementally_list_bucket to prevent a death loop
    in certain rare conditions

== 1.7.0

* r3051, konstantin, 2008-03-14 21:26:12 +0300 (Fri, 14 Mar 2008), 1 line
  * #897, ActiveSdb alpha release

== 1.7.1

  Do not autoload right_sdb with the rest of the modules; it requires uuidtools.
    We want the user to explicly request ActiveSdb, at least as long as it is
    alpha/beta.

  Fix escaping problem in SqsGen2Interface: POST bodies did not properly escape the '&' character

== 1.7.2

  Release Notes:

  RightAws includes some new features, including:
  - Support in RightAws::S3 and RightAws::S3Interface for S3 key copy, move, and rename
  - Support for signature version 0 request authentication to EC2, SQS, and SDB
  - Enhanced S3 object meta-header read and update
  - Interoperability with clouds running Eucalyptus (http://eucalyptus.cs.ucsb.edu)
    [ Contributed by the Eucalyptus group ]
  - Support for c1.medium and c1.xlarge instance types

  Bug fixes include:
  - Corrected the failure, under certain conditions, of retries of streaming PUTs to S3.
    We now reset the seek pointer of the streaming IO object to its initial position.
  - Removal of an accidental dependency on ActiveSupport in RightAws::S3Interface.get_link().
  - Monkey-patch of the Ruby File class on Windows platforms to correct a problem in lstat.
    The lstat bug was causing failure of very large file uploads on Windows [ Contributed by Benjamin Allfree ]
  - Fixed parsing of the ETag field for S3 objects

== 1.7.3

  Release Notes:

  - Removed the 1.7.2 monkey-patch of the Ruby File class on Windows.  This patch broke Rails 2.0.
    The patch is now included in the README for anyone to use at their own risk.

== 1.8.0

  Release Notes:

  This release adds major new features to RightAws to support Amazon's new
  Elastic Block Store (EBS).  Via the RightAws::Ec2 module, users can create
  and delete EBS volumes, attach and detach them from instances, snapshot
  volumes, and list the available volumes and snapshots.

  Bug fixes include correction of RightAws::S3 copy's failure to url-encode
the source key.

== 1.8.1

  Release Notes:

  RightScale::SdbInterface & ::ActiveSdb have several enhancements, including:
  - RightAws::SdbInterface#last_query_expression added for debug puposes
  - RightAws::ActiveSdb::Base#query :order and :auto_load options added to support query
    result sorting and attributes auto loading
  - RightAws::ActiveSdb::Base#find_all_by_ and find_by_ helpers improved to support
    :order, :auto_load, :limit and :next_token options
  - RightAws::SdbInterface#delete_attributes bug fixed
  - SdbInterface allows specification of a string value to use for
    representing Ruby nil in SDB.
  - Sdb tests fixed and improved

  The ::S3 interface now has support for S3's server access logging.
  Amazon considers server access logging to be a beta or provisional feature.

=== 1.9.0

  Release Notes:
  - RightAws::Ec2 now supports Windows instances. Added:
   - Ec2::get_initial_password
   - Ec2::bundle_instance
   - Ec2::describe_bundle_tasks
   - Ec::cancel_bundle_task

  - Full Amazon CloudFront support added with RightAws::AcfInterface
  - Bug fixes to S3Interface::store_object_and_verify and
    S3Interface::retrieve_object_and_verify (thanks to numerous user reports)
  - Updates to caching for Ec2::describe_images_by methods
  - Ec2 now has Ec2::last_request_id

=== 1.10.0

  Release Notes:
  - AwsBase: signature v2 support added
  - Ec2: describe_availability_zones improved to support regions
  - CloudFront: docs fixes
  - SDB: added: SQL-like query, select and query_with_attributes support
  - SDB: fixed no method error when searching for id that doesn't exist

=== 1.11.0

  Release Notes:
  - Full Amazon RDS instances support added with RightAws::RdsInterface
  - Boot from EBS support added
  - VPC support added
  - Latest EC2 API 2009-10-31 support added
  - Some of bugs fixed

=== 2.0.0

  Release Notes:
  - Added:
    - Ruby 1.9 support
    - Ec2:
      - SpotInstances support
      - m2.xlarge instances
      - GetPasswordData API call (see get_password_data_v2)
      - SecurityGroups support for Eucalyptus clouds
    - EBS:
      - :delete_on_termination field for volumes
    - SimpleDB:
      - BatchPutAttributes support
    - ActiveSDB:
      - Dynamic attribute accessors
      - "Columns" support
      - Simple Type Casting support
    - ELB:
      - API '2009-11-25' support (stickiness policies)
    - ACF:
      - API '2010-03-01' support (origin access policy and streaming distributions)
  - Bunch of small issues were fixed
  - Time objects were replaced by Strings (as Amazon returns them) to make the gem more consistent:
    - :last_modified_time in:
        RightAws::AcfInterface#incrementally_list_distributions,
        RightAws::AcfInterface#create_distribution_by_config,
        RightAws::AcfInterface#get_distribution,
        RightAws::AcfInterface#get_distribution_config
    - :timestamp in:
        RightAws::AcwInterface#get_metric_statistics
    - :aws_created_at in:
        RightAws::Ec2#create_volume,
        RightAws::Ec2#describe_volumes
    - :aws_attached_at in:
        RightAws::Ec2#attach_volume,
        RightAws::Ec2#detach_volume,
        RightAws::Ec2#describe_volumes
    - :aws_started_at in:
        RightAws::Ec2#describe_snapshots,
        RightAws::Ec2#create_snapshot,
        RightAws::Ec2#try_create_snapshot
    - :created_time in:
        RightAws::ElbInterface#describe_load_balancers

=== 2.1.0
  Release Notes:
  - Added:
    - Route 53: API '2010-10-01'
    - ACF: API '2010-11-01'
    - EC2:
      - API '2010-08-31'
      - Port based group permissions support
      - HPC Support
      - Tags Suport
      - ClientToken support added on instance launch
    - RDS: API "2010-07-28"
    - ELB: API '2010-07-01' (SSL support)
    - IAM: API '2010-05-08' (AWS Identity and Access Management interface)
    - 301 Redirect support added
  - Removed:
    - ActiveSupport dependency
    - SDB: uuid gem dependency
  - this gem requires right_http_connection 0bc3343232133bdb38c237d8285525d74495d3f5 or later
  - "Raise On Timeout On Action" feature added to avoid duplicate resources creation if a timeout error occures and a retry is performed

=== 3.0.0
  Release Notes:
  - Fixed/Added:
    - ClientToken (launch_instances, run_instances) is not used for Eucalyptus clouds
    - VPC2, stage1. Next methods were updated:
      - associate_address, modify_security_group, create_security_group, create_vpc, delete_security_group,
        describe_addresses, describe_images, describe_instance_attribute, describe_regions, describe_reserved_instances_offerings,
        describe_security_groups, describe_snapshots, describe_spot_instance_requests, describe_spot_price_history,
        describe_vpcs, disassociate_address, modify_image_attribute, modify_snapshot_attribute, release_address,
        request_spot_instances, stop_instances
    - EC2: ClientToken (launch_instances, run_instances) is not used for Eucalyptus clouds
    - RDS:
      - RDS: API 2011-04-01
      - Make :instance_class param more consistent: :db_instance_class --> :instance_class
      - Issue 53: regression in latest master version of right_rds_interface
      - Issue 73: Can't get list of instances with RdsInterface
    - EBS: Issue 54: regression in right_ec2_ebs.rb
    - Add the port number with server name in the v2 signature string if it is not the RFC standard number (author: unakatsuo).
    - EMR (Elastic Map Reduce) support
    - SNS (Simple Notification Service) support
    - SDB: ConsistentRead support
    - bunch of micro bugs

=== 3.0.1
  Release Notes:
  - Fixed: 
    - SignatureDoesNotMatch on file download via get_link()
    - S3#bucket should not fail for non admin creds
    - couple doc typos

=== 3.0.2
  Release Notes:
  - Fixed:
    - S3 Content-Type not set in Ruby 1.9.2
    - error in rds_interface describe_db_snapshots in Ruby 1.9.2

=== 3.0.4
  Release Notes:
  - Fixed:
    - #125 - fixes redirect bug in file PUT requests (Cary)
    - some other minor fixes

=== 3.0.5
  Release Notes:
  - Added: API '2012-06-15' support for CreateVolume and DescribeVolumes API calls (to support IOPS)
  - Fixed:
    - Single-threaded multipart upload support (https://github.com/rightscale/right_aws/pull/116)
    - S3 multi object delete (https://github.com/rightscale/right_aws/pull/106)
    - Support for "ami_version" added in emr interface (https://github.com/rightscale/right_aws/pull/129)
    - S3: Added block references to several methods (https://github.com/rightscale/right_aws/pull/130)
    - Some other minor changes

=== 3.1.0
  Release Notes:
  - Added:
    - EC2:
      - hs1.8xlarge, cr1.8xlarge instance types
      - API version '2012-10-01' support for ReservedInstances and ReservedInstancesOfferings
      - API version '2012-10-15' for some of VPC calls (including new DescribeAccountAttributes)
  - Removed:  UUID dependency
  - Fixed:
    - EC2:
      - describe_reserved_instances_offerings was fixed to support pagination
      - typo in create_vpc
    - RDS: instances types list
    - Some other minor bugs


================================================
FILE: LICENSE
================================================
Copyright (c) 2009-2012 RightScale, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: Manifest.txt
================================================
History.txt
Manifest.txt
README.txt
Rakefile
lib/awsbase/support.rb
lib/awsbase/benchmark_fix.rb
lib/awsbase/right_awsbase.rb
lib/ec2/right_ec2.rb
lib/ec2/right_ec2_images.rb
lib/ec2/right_ec2_instances.rb
lib/ec2/right_ec2_security_groups.rb
lib/ec2/right_ec2_spot_instances.rb
lib/ec2/right_ec2_ebs.rb
lib/ec2/right_ec2_reserved_instances.rb
lib/ec2/right_ec2_vpc.rb
lib/ec2/right_ec2_vpc2.rb
lib/ec2/right_ec2_monitoring.rb
lib/ec2/right_ec2_placement_groups.rb
lib/ec2/right_ec2_windows_mobility.rb
lib/ec2/right_ec2_tags.rb
lib/right_aws.rb
lib/s3/right_s3.rb
lib/acw/right_acw_interface.rb
lib/elb/right_elb_interface.rb
lib/as/right_as_interface.rb
lib/s3/right_s3_interface.rb
lib/sdb/active_sdb.rb
lib/sdb/right_sdb_interface.rb
lib/sqs/right_sqs.rb
lib/sqs/right_sqs_gen2.rb
lib/sqs/right_sqs_gen2_interface.rb
lib/sqs/right_sqs_interface.rb
lib/acf/right_acf_interface.rb
lib/acf/right_acf_streaming_interface.rb
lib/acf/right_acf_origin_access_identities.rb
lib/acf/right_acf_invalidations.rb
lib/rds/right_rds_interface.rb
lib/iam/right_iam_interface.rb
lib/iam/right_iam_groups.rb
lib/iam/right_iam_users.rb
lib/iam/right_iam_access_keys.rb
lib/iam/right_iam_mfa_devices.rb
lib/route_53/right_route_53_interface.rb
test/ec2/test_helper.rb
test/ec2/test_right_ec2.rb
test/http_connection.rb
test/s3/test_helper.rb
test/s3/test_right_s3.rb
test/s3/test_right_s3_stubbed.rb
test/sdb/test_active_sdb.rb
test/sdb/test_helper.rb
test/sdb/test_right_sdb.rb
test/sqs/test_helper.rb
test/sqs/test_right_sqs.rb
test/sqs/test_right_sqs_gen2.rb
test/test_credentials.rb
test/ts_right_aws.rb
test/acf/test_helper.rb
test/acf/test_right_acf.rb
test/rds/test_helper.rb
test/rds/test_right_rds.rb


================================================
FILE: README.txt
================================================
= RightScale Amazon Web Services Ruby Gems

Published by RightScale, Inc. under the MIT License.
For information about RightScale, see http://www.rightscale.com

== THE GEM IS NO LONGER MAINTAINED

We recommend you use https://github.com/rightscale/right_aws_api instead.

== DESCRIPTION:

The RightScale AWS gems have been designed to provide a robust, fast, and secure interface to Amazon EC2, EBS, S3, SQS, SDB, and CloudFront. 
These gems have been used in production by RightScale since late 2006 and are being maintained to track enhancements made by Amazon. 
The RightScale AWS gems comprise:

- RightAws::Ec2 -- interface to Amazon EC2 (Elastic Compute Cloud), VPC (Virtual Private Cloud) and the associated EBS (Elastic Block Store)
- RightAws::S3 and RightAws::S3Interface -- interface to Amazon S3 (Simple Storage Service)
- RightAws::Sqs and RightAws::SqsInterface -- interface to first-generation Amazon SQS (Simple Queue Service)
- RightAws::SqsGen2 and RightAws::SqsGen2Interface -- interface to second-generation Amazon SQS (Simple Queue Service)
- RightAws::SdbInterface and RightAws::ActiveSdb -- interface to Amazon SDB (SimpleDB)
- RightAws::AcfInterface -- interface to Amazon CloudFront, a content distribution service
- RightAws::AsInterface  -- interface to Amazon Auto Scaling
- RightAws::AcwInterface -- interface to Amazon Cloud Watch
- RightAws::ElbInterface -- interface to Amazon Elastic Load Balancer
- RightAws::RdsInterface -- interface to Amazon RDS instances

== FEATURES:

- Full programmmatic access to EC2, EBS, S3, SQS, SDB, CloudFront, AS, ACW, ELB and RDS.
- Complete error handling: all operations check for errors and report complete
  error information by raising an AwsError.
- Persistent HTTP connections with robust network-level retry layer using
  RightHttpConnection).  This includes socket timeouts and retries.
- Robust HTTP-level retry layer.  Certain (user-adjustable) HTTP errors returned
  by Amazon's services are classified as temporary errors.
  These errors are automaticallly retried using exponentially increasing intervals.
  The number of retries is user-configurable.
- Fast REXML-based parsing of responses (as fast as a pure Ruby solution allows).
- Uses libxml (if available) for faster response parsing. 
- Support for large S3 list operations.  Buckets and key subfolders containing
  many (> 1000) keys are listed in entirety.  Operations based on list (like
  bucket clear) work on arbitrary numbers of keys.
- Support for streaming GETs from S3, and streaming PUTs to S3 if the data source is a file.
- Support for single-threaded usage, multithreaded usage, as well as usage with multiple
  AWS accounts.
- Support for both first- and second-generation SQS (API versions 2007-05-01
  and 2008-01-01).  These versions of SQS are not compatible.
- Support for signature versions 0 and 1 on SQS, SDB, and EC2.
- Interoperability with any cloud running Eucalyptus (http://eucalyptus.cs.ucsb.edu)
- Test suite (requires AWS account to do "live" testing).

== THREADING:

All RightScale AWS interfaces offer two threading options:
1. Use a single persistent HTTP connection per process.
2. Use a persistent HTTP connection per Ruby thread.
 
Either way, it doesn't matter how many (for example) RightAws::S3 objects you create,
they all use the same per-program or per-thread
connection. The purpose of sharing the connection is to keep a single
persistent HTTP connection open to avoid paying connection
overhead on every request. However, if you have multiple concurrent
threads, you may want or need an HTTP connection per thread to enable
concurrent requests to AWS. The way this plays out in practice is:
1. If you have a non-multithreaded Ruby program, use the non-multithreaded setting.
2. If you have a multi-threaded Ruby program, use the multithreaded setting to enable
   concurrent requests to S3 (or SQS, or SDB, or EC2).
3. For running under Mongrel/Rails, use the non-multithreaded setting even though
   mongrel is multithreaded.  This is because only one Rails handler is invoked at
   time (i.e. it acts like a single-threaded program)

Note that due to limitations in the I/O of the Ruby interpreter you
may not get the degree of parallelism you may expect with the multi-threaded setting.

== GETTING STARTED:

* For EC2 read RightAws::Ec2 and consult the Amazon EC2 API documentation at
  http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=87
* For S3 read RightAws::S3 and consult the Amazon S3 API documentation at
  http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=48
* For first generation SQS read RightAws::Sqs and consult the Amazon SQS API documentation at
  http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=31
* For second generation SQS read RightAws::SqsGen2, RightAws::SqsGen2Interface, and consult the Amazon SQS API documentation at
  http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1214&categoryID=31 

  Amazon's Migration Guide for moving from first to second generation SQS is
  avalable at:
  http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1148
* For SDB read RightAws::SdbInterface, RightAws::ActiveSdb, and consult the Amazon SDB API documentation at
  http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=141
* For CloudFront (ACF) read RightAws::AcfInterface and consult the Amazon CloudFront API documentation at 
  http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=213

== KNOWN ISSUES:

- 7/08: A user has reported that uploads of large files on Windows may be broken on some
  Win platforms due to a buggy File.lstat.size.  Use the following monkey-patch at your own risk, 
  as it has been proven to break Rails 2.0 on Windows:

    require 'win32/file'
    class File
      def lstat
        self.stat
      end
    end


- Attempting to use the Gibberish plugin (used by the Beast forum app) 
  will break right_aws as well as lots of other code.  Gibberish
  changes the semantics of core Ruby (specifically, the String class) and thus presents a reliability
  problem for most Ruby programs.

- 2/11/08: If you use RightAws in conjunction with attachment_fu, the
  right_aws gem must be included (using the require statement) AFTER
  attachment_fu.  If right_aws is loaded before attachment_fu, you'll
  encounter errors similar to:

  s3.amazonaws.com temporarily unavailable: (wrong number of arguments (5 for 4))

  or

  'incompatible Net::HTTP monkey-patch'

  This is due to a conflict between the right_http_connection gem and another
  gem required by attachment_fu.

- 8/07: Amazon has changed the semantics of the SQS service.  A
  new queue may not be created within 60 seconds of the destruction of any
  older queue with the same name.  Certain methods of RightAws::Sqs and
  RightAws::SqsInterface will fail with the message:
  "AWS.SimpleQueueService.QueueDeletedRecently: You must wait 60 seconds after deleting a queue before you can create another with the same name."
  
== REQUIREMENTS:

RightAws requires REXML and the right_http_connection gem.
If libxml and its Ruby bindings (distributed in the libxml-ruby gem) are
present, RightAws can be configured to use them:
  RightAws::RightAWSParser.xml_lib = 'libxml'
Any error with the libxml installation will result in RightAws failing-safe to
REXML parsing.

== INSTALL:

sudo gem install right_aws

== LICENSE:

Copyright (c) 2007-2013 RightScale, Inc.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


================================================
FILE: Rakefile
================================================
# -*- ruby -*-

require 'rubygems'
require "rake/testtask"
require 'rubygems/package_task'
require 'rake/clean'
$: << File.dirname(__FILE__)
testglobs =     ["test/ts_right_aws.rb"]

begin
  require 'bundler'
rescue LoadError => e
  STDERR.puts("Bundler is not available, some rake tasks will not be defined: #{e.message}")
else
  Bundler::GemHelper.install_tasks :name => 'right_aws'
end

# == Gem == #

gemtask = Gem::PackageTask.new(Gem::Specification.load("right_aws.gemspec")) do |package|
  package.package_dir = ENV['PACKAGE_DIR'] || 'pkg'
  package.need_zip = true
  package.need_tar = true
end

directory gemtask.package_dir

CLEAN.include(gemtask.package_dir)

desc "Test just the SQS interface"
task :testsqs do
  require 'test/test_credentials'
  require 'test/http_connection'
  TestCredentials.get_credentials
  require 'test/sqs/test_right_sqs.rb'
end

desc "Test just the second generation SQS interface"
task :testsqs2 do
  require 'test/test_credentials'
  require 'test/http_connection'
  TestCredentials.get_credentials
  require 'test/sqs/test_right_sqs_gen2.rb'
end

desc "Test just the S3 interface"
task :tests3 do
  require 'test/test_credentials'
  require 'test/http_connection'
  TestCredentials.get_credentials
  require 'test/s3/test_right_s3.rb'
end

desc "Test just the S3 interface using local stubs"
task :tests3local do
  require 'test/test_credentials'
  require 'test/http_connection'
  TestCredentials.get_credentials
  require 'test/s3/test_right_s3_stubbed.rb'
end

desc "Test just the EC2 interface"
task :testec2 do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/ec2/test_right_ec2.rb'
end

desc "Test just the SDB interface"
task :testsdb do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/sdb/test_right_sdb.rb'
end

desc "Test active SDB interface"
task :testactivesdb do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/sdb/test_active_sdb.rb'
end

desc "Test CloudFront interface"
task :testacf do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/acf/test_right_acf.rb'
end

desc "Test RDS interface"
task :testrds do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/rds/test_right_rds.rb'
end

desc "Test just the SNS interface"
task :testsns do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/sns/test_right_sns.rb'
end

desc "Test Route 53 interface"
task :testroute53 do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/route_53/test_right_route_53'
end

desc "Test ELB interface"
task :testelb do
  require 'test/test_credentials'
  TestCredentials.get_credentials
  require 'test/elb/test_right_elb'
end

# vim: syntax=Ruby


================================================
FILE: docker-compose.yml
================================================
version: "3.8"
services:
  app:
    build: .
    command: bash -c "bundle exec rake -T"
    volumes:
      - .:/right_aws


================================================
FILE: lib/acf/right_acf_interface.rb
================================================
#
# Copyright (c) 2008 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
module RightAws

  # = RightAws::AcfInterface -- RightScale Amazon's CloudFront interface
  # The AcfInterface class provides a complete interface to Amazon's
  # CloudFront service.
  #
  # For explanations of the semantics of each call, please refer to
  # Amazon's documentation at
  # http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=211
  #
  # Example:
  #
  #  acf = RightAws::AcfInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX')
  #
  #  list = acf.list_distributions #=>
  #    [{:status             => "Deployed",
  #      :domain_name        => "d74zzrxmpmygb.6hops.net",
  #      :aws_id             => "E4U91HCJHGXVC",
  #      :s3_origin          => {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
  #      :cnames             => ["x1.my-awesome-site.net", "x1.my-awesome-site.net"]
  #      :comment            => "My comments",
  #      :last_modified_time => "2008-09-10T17:00:04.000Z" }, ..., {...} ]
  #
  #  distibution = list.first
  #
  #  info = acf.get_distribution(distibution[:aws_id]) #=>
  #    {:last_modified_time=>"2010-05-19T18:54:38.242Z",
  #     :status=>"Deployed",
  #     :domain_name=>"dpzl38cuix402.cloudfront.net",
  #     :caller_reference=>"201005181943052207677116",
  #     :e_tag=>"EJSXFGM5JL8ER",
  #     :s3_origin=>
  #      {:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
  #       :origin_access_identity=>
  #        "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
  #     :aws_id=>"E5P8HQ3ZAZIXD",
  #     :enabled=>false}
  #
  #  config = acf.get_distribution_config(distibution[:aws_id]) #=>
  #    {:enabled          => true,
  #     :caller_reference => "200809102100536497863003",
  #     :e_tag            => "E39OHHU1ON65SI",
  #     :cnames           => ["web1.my-awesome-site.net", "web2.my-awesome-site.net"]
  #     :comment          => "Woo-Hoo!",
  #     :s3_origin        => {:dns_name => "my-bucket.s3.amazonaws.com"}}
  #
  #  config[:comment] = 'Olah-lah!'
  #  config[:enabled] = false
  #  config[:cnames] << "web3.my-awesome-site.net"
  #
  #  acf.set_distribution_config(distibution[:aws_id], config) #=> true
  #
  class AcfInterface < RightAwsBase
    
    include RightAwsBaseInterface

    API_VERSION      = "2010-11-01"
    DEFAULT_HOST     = 'cloudfront.amazonaws.com'
    DEFAULT_PORT     = 443
    DEFAULT_PROTOCOL = 'https'
    DEFAULT_PATH     = '/'

    @@bench = AwsBenchmarkingBlock.new
    def self.bench_xml
      @@bench.xml
    end
    def self.bench_service
      @@bench.service
    end

    # Create a new handle to a CloudFront account. All handles share the same per process or per thread
    # HTTP connection to CloudFront. Each handle is for a specific account. The params have the
    # following options:
    # * <tt>:endpoint_url</tt> a fully qualified url to Amazon API endpoint (this overwrites: :server, :port, :service, :protocol). Example: 'https://cloudfront.amazonaws.com'
    # * <tt>:server</tt>: CloudFront service host, default: DEFAULT_HOST
    # * <tt>:port</tt>: CloudFront service port, default: DEFAULT_PORT
    # * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
    # * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
    #
    #  acf = RightAws::AcfInterface.new('1E3GDYEOGFJPIT7XXXXXX','hgTHt68JY07JKUY08ftHYtERkjgtfERn57XXXXXX',
    #    {:logger => Logger.new('/tmp/x.log')}) #=>  #<RightAws::AcfInterface::0xb7b3c30c>
    #
    def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
      init({ :name                => 'ACF',
             :default_host        => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).host   : DEFAULT_HOST,
             :default_port        => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).port   : DEFAULT_PORT,
             :default_service     => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).path   : DEFAULT_PATH,
             :default_protocol    => ENV['ACF_URL'] ? URI.parse(ENV['ACF_URL']).scheme : DEFAULT_PROTOCOL,
             :default_api_version => ENV['ACF_API_VERSION'] || API_VERSION },
           aws_access_key_id     || ENV['AWS_ACCESS_KEY_ID'], 
           aws_secret_access_key || ENV['AWS_SECRET_ACCESS_KEY'], 
           params)
    end

    #-----------------------------------------------------------------
    #      Requests
    #-----------------------------------------------------------------

    # Generates request hash for REST API.
    def generate_request(method, path, params={}, body=nil, headers={})  # :nodoc:
      # Params
      params.delete_if{ |key, val| val.right_blank? }
      unless params.right_blank?
        path += "?" + params.to_a.collect{ |key,val| "#{AwsUtils::amz_escape(key)}=#{AwsUtils::amz_escape(val.to_s)}" }.join("&")
      end
      # Headers
      headers = AwsUtils::fix_headers(headers)
      headers['content-type'] ||= 'text/xml' if body
      headers['date'] = Time.now.httpdate
      # Auth
      signature = AwsUtils::sign(@aws_secret_access_key, headers['date'])
      headers['Authorization'] = "AWS #{@aws_access_key_id}:#{signature}"
      # Request
      path    = "#{@params[:service]}#{@params[:api_version]}/#{path}"
      request = "Net::HTTP::#{method.capitalize}".right_constantize.new(path)
      request.body = body if body
      # Set request headers
      headers.each { |key, value| request[key.to_s] = value }
      # prepare output hash
      { :request  => request, 
        :server   => @params[:server],
        :port     => @params[:port],
        :protocol => @params[:protocol] }
      end
      
      # Sends request to Amazon and parses the response.
      # Raises AwsError if any banana happened.
    def request_info(request, parser, &block) # :nodoc:
      request_info_impl(:acf_connection, @@bench, request, parser, &block)
    end

    #-----------------------------------------------------------------
    #      Helpers:
    #-----------------------------------------------------------------

    def generate_call_reference # :nodoc:
      result = Time.now.strftime('%Y%m%d%H%M%S')
      10.times{ result << rand(10).to_s }
      result
    end

    def merge_headers(hash) # :nodoc:
      hash[:location] = @last_response['Location'] if @last_response['Location']
      hash[:e_tag]    = @last_response['ETag']     if @last_response['ETag']
      hash
    end

    def distribution_config_to_xml(config, xml_wrapper='DistributionConfig') # :nodoc:
      cnames = logging = trusted_signers = s3_origin = custom_origin = default_root_object = ''
      # CNAMES
      unless config[:cnames].right_blank?
        Array(config[:cnames]).each { |cname| cnames += "  <CNAME>#{cname}</CNAME>\n" }
      end
      # Logging
      unless config[:logging].right_blank?
        logging = "  <Logging>\n" +
                  "    <Bucket>#{config[:logging][:bucket]}</Bucket>\n" +
                  "    <Prefix>#{config[:logging][:prefix]}</Prefix>\n" +
                  "  </Logging>\n"
      end
      unless config[:required_protocols].right_blank?
        required_protocols = "  <RequiredProtocols>\n" +
                             "    <Protocol>#{config[:required_protocols]}</Protocol>\n" +
                             "  </RequiredProtocols>\n"
      else required_protocols = ""
      end
      # Default Root Object
      unless config[:default_root_object].right_blank?
        default_root_object = "  <DefaultRootObject>#{config[:default_root_object]}</DefaultRootObject>\n" unless config[:default_root_object].right_blank?
      end
      # Trusted Signers
      unless config[:trusted_signers].right_blank?
        trusted_signers = "  <TrustedSigners>\n"
        Array(config[:trusted_signers]).each do |trusted_signer|
          trusted_signers += if trusted_signer.to_s[/self/i]
                               "    <Self/>\n"
                             else
                               "    <AwsAccountNumber>#{trusted_signer}</AwsAccountNumber>\n"
                             end
        end
        trusted_signers += "  </TrustedSigners>\n"
      end
      # S3Origin
      unless config[:s3_origin].right_blank?
        origin_access_identity = ''
        # Origin Access Identity
        unless config[:s3_origin][:origin_access_identity].right_blank?
          origin_access_identity = config[:s3_origin][:origin_access_identity]
          unless origin_access_identity[%r{^origin-access-identity}]
            origin_access_identity = "origin-access-identity/cloudfront/#{origin_access_identity}"
          end
          origin_access_identity = "    <OriginAccessIdentity>#{origin_access_identity}</OriginAccessIdentity>\n"
        end
        s3_origin = "  <S3Origin>\n" +
                    "    <DNSName>#{config[:s3_origin][:dns_name]}</DNSName>\n" +
                    "#{origin_access_identity}" +
                    "  </S3Origin>\n"
      end
      # Custom Origin
      unless config[:custom_origin].right_blank?
        http_port = https_port = origin_protocol_policy = ''
        http_port              = "    <HTTPPort>#{config[:custom_origin][:http_port]}</HTTPPort>\n"                                      unless config[:custom_origin][:http_port].right_blank?
        https_port             = "    <HTTPSPort>#{config[:custom_origin][:https_port]}</HTTPSPort>"                                     unless config[:custom_origin][:https_port].right_blank?
        origin_protocol_policy = "    <OriginProtocolPolicy>#{config[:custom_origin][:origin_protocol_policy]}</OriginProtocolPolicy>\n" unless config[:custom_origin][:origin_protocol_policy].right_blank?
        custom_origin = "  <CustomOrigin>\n" +
                        "    <DNSName>#{config[:custom_origin][:dns_name]}</DNSName>\n" +
                        "#{http_port}" +
                        "#{https_port}" +
                        "#{origin_protocol_policy}" +
                        "  </CustomOrigin>\n"
      end
      # XML
      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"                                +
      "<#{xml_wrapper} xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" +
      "  <CallerReference>#{config[:caller_reference]}</CallerReference>\n"         +
      "  <Comment>#{AwsUtils::xml_escape(config[:comment].to_s)}</Comment>\n"       +
      "  <Enabled>#{config[:enabled]}</Enabled>\n" +
      s3_origin           +
      custom_origin       +
      default_root_object +
      cnames              +
      logging             +
      required_protocols  +
      trusted_signers     +
      "</#{xml_wrapper}>"
    end

    #-----------------------------------------------------------------
    #      API Calls:
    #-----------------------------------------------------------------

    # List all distributions.
    # Returns an array of distributions or RightAws::AwsError exception.
    #
    #  acf.list_distributions #=>
    #    [{:status=>"Deployed",
    #      :domain_name=>"dgmde.6os.net",
    #      :comment=>"ONE LINE OF COMMENT",
    #      :last_modified_time=>"2009-06-16T16:10:02.210Z",
    #      :s3_origin=>{:dns_name=>"example.s3.amazonaws.com"},
    #      :aws_id=>"12Q05OOMFN7SYL",
    #      :enabled=>true}, ... ]
    #
    def list_distributions
      result = []
      incrementally_list_distributions do |response|
        result += response[:distributions]
        true
      end
      result
    end

    # Incrementally list distributions.
    # 
    # Optional params: +:marker+ and +:max_items+.
    #
    #   # get first distribution
    #   incrementally_list_distributions(:max_items => 1) #=>
    #      {:distributions=>
    #        [{:status=>"Deployed",
    #          :aws_id=>"E2Q0AOOMFNPSYL",
    #          :s3_origin=>{:dns_name=>"example.s3.amazonaws.com"},
    #          :domain_name=>"d1s5gmdtmafnre.6hops.net",
    #          :comment=>"ONE LINE OF COMMENT",
    #          :last_modified_time=>"2008-10-22T19:31:23.000Z",
    #          :enabled=>true,
    #          :cnames=>[]}],
    #       :is_truncated=>true,
    #       :max_items=>1,
    #       :marker=>"",
    #       :next_marker=>"E2Q0AOOMFNPSYL"}
    #
    #   # get max 100 distributions (the list will be restricted by a default MaxItems value ==100 )
    #   incrementally_list_distributions
    #
    #   # list distributions by 10
    #   incrementally_list_distributions(:max_items => 10) do |response|
    #     puts response.inspect # a list of 10 distributions
    #     true # return false if the listing should be broken otherwise use true
    #   end
    #
    def incrementally_list_distributions(params={}, &block)
      opts = {}
      opts['MaxItems'] = params[:max_items] if params[:max_items]
      opts['Marker']   = params[:marker]    if params[:marker]
      last_response = nil
      loop do
        link = generate_request('GET', 'distribution', opts)
        last_response = request_info(link,  AcfDistributionListParser.new(:logger => @logger))
        opts['Marker'] = last_response[:next_marker]
        break unless block && block.call(last_response) && !last_response[:next_marker].right_blank?
      end 
      last_response 
    end

    # Create a new distribution.
    # Returns the just created distribution or RightAws::AwsError exception.
    #
    #  # S3 Origin
    #
    #  config =  { :comment   => "kd: delete me please",
    #              :s3_origin => { :dns_name               => "devs-us-east.s3.amazonaws.com",
    #                              :origin_access_identity => "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
    #              :enabled   => true,
    #              :logging   => { :prefix => "kd/log/",
    #                              :bucket => "devs-us-west.s3.amazonaws.com"}}
    #  acf.create_distribution(config) #=>
    #    { :status=>"InProgress",
    #      :enabled=>true,
    #      :caller_reference=>"201012071910051044304704",
    #      :logging=>{:prefix=>"kd/log/", :bucket=>"devs-us-west.s3.amazonaws.com"},
    #      :e_tag=>"ESCTG5WJCFWJK",
    #      :location=> "https://cloudfront.amazonaws.com/2010-11-01/distribution/E3KUBANZ7N1B2",
    #      :comment=>"kd: delete me please",
    #      :domain_name=>"d3stykk6upgs20.cloudfront.net",
    #      :aws_id=>"E3KUBANZ7N1B2",
    #      :s3_origin=>
    #        {:origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G",
    #         :dns_name=>"devs-us-east.s3.amazonaws.com"},
    #      :last_modified_time=>"2010-12-07T16:10:07.087Z",
    #      :in_progress_invalidation_batches=>0}
    #
    #  # Custom Origin
    #
    #    custom_config = { :comment       => "kd: delete me please",
    #                      :custom_origin => { :dns_name  => "custom_origin.my-site.com",
    #                                          :http_port => 80,
    #                                          :https_port => 443,
    #                                          :origin_protocol_policy => 'match-viewer' },
    #                      :enabled       => true,
    #                      :logging       => { :prefix => "kd/log/",
    #                                          :bucket => "my-bucket.s3.amazonaws.com"}} #=>
    #    { :last_modified_time=>"2010-12-08T14:23:43.522Z",
    #      :status=>"InProgress",
    #      :custom_origin=>
    #        {:http_port=>"80",
    #        :https_port=>"443",
    #        :origin_protocol_policy=>"match-viewer",
    #        :dns_name=>"custom_origin.my-site.com"},
    #      :enabled=>true,
    #      :caller_reference=>"201012081723428499167245",
    #      :in_progress_invalidation_batches=>0,
    #      :e_tag=>"E1ZCJ8N5E52KO6",
    #      :location=>
    #        "https://cloudfront.amazonaws.com/2010-11-01/distribution/EK0AJ4RMNIF2P",
    #      :logging=>{:prefix=>"kd/log/", :bucket=>"my-bucket.s3.amazonaws.com"},
    #      :domain_name=>"do36k7s2wxklg.cloudfront.net",
    #      :comment=>"kd: delete me please",
    #      :aws_id=>"EK0AJ4RMNIF2P"}
    #
    def create_distribution(config)
      config[:caller_reference] ||= generate_call_reference
      link = generate_request('POST', 'distribution', {}, distribution_config_to_xml(config))
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end
    alias_method :create_distribution_by_config, :create_distribution

    # Get a distribution's information.
    # Returns a distribution's information or RightAws::AwsError exception.
    #
    #  acf.get_distribution('E2REJM3VUN5RSI') #=>
    #    {:last_modified_time=>"2010-05-19T18:54:38.242Z",
    #     :status=>"Deployed",
    #     :domain_name=>"dpzl38cuix402.cloudfront.net",
    #     :caller_reference=>"201005181943052207677116",
    #     :e_tag=>"EJSXFGM5JL8ER",
    #     :s3_origin=>
    #      {:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
    #       :origin_access_identity=>
    #        "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
    #     :aws_id=>"E5P8HQ3ZAZIXD",
    #     :enabled=>false}
    #
    #  acf.get_distribution('E2FNSBHNVVF11E') #=>
    #    {:e_tag=>"E1Q2DJEPTQOLJD",
    #     :status=>"InProgress",
    #     :last_modified_time=>"2010-04-17T17:24:25.000Z",
    #     :cnames=>["web1.my-awesome-site.net", "web2.my-awesome-site.net"],
    #     :aws_id=>"E2FNSBHNVVF11E",
    #     :logging=>{:prefix=>"xlog/", :bucket=>"my-bucket.s3.amazonaws.com"},
    #     :enabled=>true,
    #     :active_trusted_signers=>
    #      [{:aws_account_number=>"120288270000",
    #        :key_pair_ids=>["APKAJTD5OHNDX0000000", "APKAIK74BJWCL0000000"]},
    #       {:aws_account_number=>"self"},
    #       {:aws_account_number=>"648772220000"}],
    #     :caller_reference=>"201004171154450740700072",
    #     :domain_name=>"d1f6lpevremt5m.cloudfront.net",
    #     :s3_origin=>
    #      {:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
    #       :origin_access_identity=>
    #        "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
    #     :trusted_signers=>["self", "648772220000", "120288270000"]}
    #
    def get_distribution(aws_id)
      link = generate_request('GET', "distribution/#{aws_id}")
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end

    # Get a distribution's configuration.
    # Returns a distribution's configuration or RightAws::AwsError exception.
    #
    #  acf.get_distribution_config('E2REJM3VUN5RSI') #=>
    #    {:caller_reference=>"201005181943052207677116",
    #     :e_tag=>"EJSXFGM5JL8ER",
    #     :s3_origin=>
    #      {:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
    #       :origin_access_identity=>
    #        "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
    #     :enabled=>false}
    #
    #  acf.get_distribution_config('E2FNSBHNVVF11E') #=>
    #    {:e_tag=>"E1Q2DJEPTQOLJD",
    #     :logging=>{:prefix=>"xlog/", :bucket=>"my-bucket.s3.amazonaws.com"},
    #     :enabled=>true,
    #     :caller_reference=>"201004171154450740700072",
    #     :trusted_signers=>["self", "648772220000", "120288270000"],
    #     :s3_origin=>
    #      {:dns_name=>"bucket-for-konstantin-eu.s3.amazonaws.com",
    #       :origin_access_identity=>
    #        "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"}}
    #
    def get_distribution_config(aws_id)
      link = generate_request('GET', "distribution/#{aws_id}/config")
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end

    # Set a distribution's configuration 
    # Returns +true+ on success or RightAws::AwsError exception.
    #
    #  config = acf.get_distribution_config('E2REJM3VUN5RSI') #=>
    #    {:enabled          => true,
    #     :caller_reference => "200809102100536497863003",
    #     :e_tag            => "E39OHHU1ON65SI",
    #     :cnames           => ["web1.my-awesome-site.net", "web2.my-awesome-site.net"]
    #     :comment          => "Woo-Hoo!",
    #     :s3_origin        => { :dns_name => "my-bucket.s3.amazonaws.com"}}
    #
    #  config[:comment]                = 'Olah-lah!'
    #  config[:enabled]                = false
    #  config[:s3_origin][:origin_access_identity] = "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"
    #  # or just
    #  # config[:s3_origin][:origin_access_identity] = "E3JPJZ80ZBX24G"
    #  config[:trusted_signers]        = ['self', '648772220000', '120288270000']
    #  config[:logging]                = { :bucket => 'my-bucket.s3.amazonaws.com', :prefix => 'xlog/' }
    #  
    #  acf.set_distribution_config('E2REJM3VUN5RSI', config) #=> true
    #
    def set_distribution_config(aws_id, config)
      link = generate_request('PUT', "distribution/#{aws_id}/config", {}, distribution_config_to_xml(config),
                                     'If-Match' => config[:e_tag])
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Delete a distribution. The enabled distribution cannot be deleted.
    # Returns +true+ on success or RightAws::AwsError exception.
    #
    #  acf.delete_distribution('E2REJM3VUN5RSI', 'E39OHHU1ON65SI') #=> true
    #
    def delete_distribution(aws_id, e_tag)
      link = generate_request('DELETE', "distribution/#{aws_id}", {}, nil,
                                        'If-Match' => e_tag)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      PARSERS:
    #-----------------------------------------------------------------

    class AcfDistributionListParser < RightAWSParser # :nodoc:
      def reset
        @result = { :distributions => [] }
      end
      def tagstart(name, attributes)
        case full_tag_name
        when %r{/Signer$}
          @active_signer = {}
        when %r{(Streaming)?DistributionSummary$},
             %r{^(Streaming)?Distribution$},
             %r{^(Streaming)?DistributionConfig$}
          @distribution = { }
        when %r{/S3Origin$}     then @distribution[:s3_origin] = {}
        when %r{/CustomOrigin$} then @distribution[:custom_origin] = {}
        end
      end
      def tagend(name)
        case name
        when 'Marker'           then @result[:marker]       = @text
        when 'NextMarker'       then @result[:next_marker]  = @text
        when 'MaxItems'         then @result[:max_items]    = @text.to_i
        when 'IsTruncated'      then @result[:is_truncated] = (@text == 'true')
        when 'Id'               then @distribution[:aws_id]                    = @text
        when 'Status'           then @distribution[:status]                    = @text
        when 'LastModifiedTime' then @distribution[:last_modified_time]        = @text
        when 'DomainName'       then @distribution[:domain_name]               = @text
        when 'Comment'          then @distribution[:comment]                   = AwsUtils::xml_unescape(@text)
        when 'CallerReference'  then @distribution[:caller_reference]          = @text
        when 'CNAME'            then (@distribution[:cnames] ||= [])          << @text
        when 'Enabled'          then @distribution[:enabled]                   = (@text == 'true')
        when 'Bucket'           then (@distribution[:logging] ||= {})[:bucket] = @text
        when 'Prefix'           then (@distribution[:logging] ||= {})[:prefix] = @text
        when 'Protocol'         then (@distribution[:required_protocols] ||= {})[:protocol]        = @text
        when 'InProgressInvalidationBatches' then @distribution[:in_progress_invalidation_batches] = @text.to_i
        when 'DefaultRootObject'             then @distribution[:default_root_object]              = @text
        else
          case full_tag_name
          when %r{/S3Origin/DNSName$}                  then @distribution[:s3_origin][:dns_name]                   = @text
          when %r{/S3Origin/OriginAccessIdentity$}     then @distribution[:s3_origin][:origin_access_identity]     = @text
          when %r{/CustomOrigin/DNSName$}              then @distribution[:custom_origin][:dns_name]               = @text
          when %r{/CustomOrigin/HTTPPort}              then @distribution[:custom_origin][:http_port]              = @text
          when %r{/CustomOrigin/HTTPSPort$}            then @distribution[:custom_origin][:https_port]             = @text
          when %r{/CustomOrigin/OriginProtocolPolicy$} then @distribution[:custom_origin][:origin_protocol_policy] = @text
          when %r{/TrustedSigners/Self$}               then (@distribution[:trusted_signers] ||= [])              << 'self'
          when %r{/TrustedSigners/AwsAccountNumber$}   then (@distribution[:trusted_signers] ||= [])              << @text
          when %r{/Signer/Self$}                       then @active_signer[:aws_account_number]                    = 'self'
          when %r{/Signer/AwsAccountNumber$}           then @active_signer[:aws_account_number]                    = @text
          when %r{/Signer/KeyPairId$}                  then (@active_signer[:key_pair_ids] ||= [])                << @text
          when %r{/Signer$}                            then (@distribution[:active_trusted_signers] ||= [])       << @active_signer
          when %r{(Streaming)?DistributionSummary$},
               %r{^(Streaming)?Distribution$},
               %r{^(Streaming)?DistributionConfig$}
            @result[:distributions] << @distribution
          end
        end
      end
    end
  end
end


================================================
FILE: lib/acf/right_acf_invalidations.rb
================================================
#
# Copyright (c) 2010 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
module RightAws

  class AcfInterface

    # List Invalidations
    # 
    #  acf.list_invalidations('E3LTBMK4EAQS7D') #=>
    #    [{:status=>"InProgress", :aws_id=>"I3AW9PPQS0CBKV"},
    #     {:status=>"InProgress", :aws_id=>"I1HV23N5KD3XH9"}]
    #
    def list_invalidations(distribution_aws_id)
      result = []
      incrementally_list_invalidations(distribution_aws_id) do |response|
        result += response[:invalidations]
        true
      end
      result
    end

    # Incrementally list Invalidations.
    # Optional params: +:marker+ and +:max_items+.
    #
    def incrementally_list_invalidations(distribution_aws_id, params={}, &block)
      opts = {}
      opts['MaxItems'] = params[:max_items] if params[:max_items]
      opts['Marker']   = params[:marker]    if params[:marker]
      last_response = nil
      loop do
        link = generate_request('GET', "distribution/#{distribution_aws_id}/invalidation", opts)
        last_response = request_info(link,  AcfInvalidationsListParser.new(:logger => @logger))
        opts['Marker'] = last_response[:next_marker]
        break unless block && block.call(last_response) && !last_response[:next_marker].right_blank?
      end
      last_response
    end

    #-----------------------------------------------------------------
    #      Origin Access Identity
    #-----------------------------------------------------------------

    # Create a new Invalidation batch.
    #
    #  acf.create_invalidation('E3LTBMK4EAQS7D', :path => ['/boot.jpg', '/kd/boot.public.1.jpg']) #=>
    #    {:status=>"InProgress",
    #     :create_time=>"2010-12-08T14:03:38.449Z",
    #     :location=> "https://cloudfront.amazonaws.com/2010-11-01/distribution/E3LTBMK4EAQS7D/invalidation/I3AW9PPQS0CBKV",
    #     :aws_id=>"I3AW9PPQS0CBKV",
    #     :invalidation_batch=>
    #      {:caller_reference=>"201012081703372555972012",
    #       :path=>["/boot.jpg", "/kd/boot.public.1.jpg"]}}
    #
    def create_invalidation(distribution_aws_id, invalidation_batch)
      invalidation_batch[:caller_reference] ||= generate_call_reference
      link = generate_request('POST', "/distribution/#{distribution_aws_id}/invalidation", {}, invalidation_batch_to_xml(invalidation_batch))
      merge_headers(request_info(link, AcfInvalidationsListParser.new(:logger => @logger))[:invalidations].first)
    end

    # Get Invalidation
    #
    #  acf.get_invalidation('E3LTBMK4EAQS7D', 'I3AW9PPQS0CBKV') #=>
    #    {:create_time=>"2010-12-08T14:03:38.449Z",
    #     :status=>"InProgress",
    #     :aws_id=>"I3AW9PPQS0CBKV",
    #     :invalidation_batch=>
    #      {:caller_reference=>"201012081703372555972012",
    #       :path=>["/boot.jpg", "/kd/boot.public.1.jpg"]}}
    #
    def get_invalidation(distribution_aws_id, aws_id)
      link = generate_request('GET', "distribution/#{distribution_aws_id}/invalidation/#{aws_id}")
      merge_headers(request_info(link, AcfInvalidationsListParser.new(:logger => @logger))[:invalidations].first)
    end

    #-----------------------------------------------------------------
    #      Batch
    #-----------------------------------------------------------------

    def invalidation_batch_to_xml(invalidation_batch) # :nodoc:
      paths = ''
      Array(invalidation_batch[:path]).each do |path|
        paths << "  <Path>#{AwsUtils::xml_escape(path)}</Path>\n"
      end
      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
      "<InvalidationBatch xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" +
      "  <CallerReference>#{invalidation_batch[:caller_reference]}</CallerReference>\n" +
      paths +
      "</InvalidationBatch>"
    end

    #-----------------------------------------------------------------
    #      PARSERS:
    #-----------------------------------------------------------------

    class AcfInvalidationsListParser < RightAWSParser # :nodoc:
      def reset
        @result = { :invalidations => [] }
      end
      def tagstart(name, attributes)
        case name
        when %r{(InvalidationSummary|Invalidation)$} then @item = {}
        when %r{InvalidationBatch}                   then @item[:invalidation_batch] = {}
        end
      end
      def tagend(name)
        case name
        when 'Marker'      then @result[:marker]       = @text
        when 'NextMarker'  then @result[:next_marker]  = @text
        when 'MaxItems'    then @result[:max_items]    = @text.to_i
        when 'IsTruncated' then @result[:is_truncated] = (@text == 'true')
        when 'Id'              then @item[:aws_id]                                = @text
        when 'Status'          then @item[:status]                                = @text
        when 'CreateTime'      then @item[:create_time]                           = @text
        when 'Path'            then (@item[:invalidation_batch][:path] ||= [])   << @text
        when 'CallerReference' then @item[:invalidation_batch][:caller_reference] = @text
        when %r{(InvalidationSummary|Invalidation)$}
          @item[:invalidation_batch][:path].sort! if @item[:invalidation_batch] && !@item[:invalidation_batch][:path].right_blank?
          @result[:invalidations] << @item
        end
      end
    end

  end
end

================================================
FILE: lib/acf/right_acf_origin_access_identities.rb
================================================
#
# Copyright (c) 2010 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
module RightAws
  
  class AcfInterface

    # List Origin Access Identities.
    #
    #  acf.list_origin_access_identities #=>
    #    [{:comment=>"kd: TEST",
    #      :s3_canonical_user_id=>
    #       "c7ca36f6c5d384e60aeca02032ac748bae3c458c5322a2e279382935f1f71b16d9ac251f7f71f1ea91c37d3c214645b8",
    #      :aws_id=>"E3TL4XWF5KTGH"},
    #     {:comment=>"kd: TEST-2",
    #      :s3_canonical_user_id=>
    #       "9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
    #      :aws_id=>"E3HJ7V8C3324VF"},
    #     {:comment=>"MyTestAccessIdentity",
    #      :s3_canonical_user_id=>
    #       "de4361b33dbaf499d3d77159bfa1571d3451eaec25a2b16553de5e534da8089bb8c31a4898d73d1a658155d0e48872a7",
    #      :aws_id=>"E3JPJZ80ZBX24G"}]
    #
    def list_origin_access_identities
      result = []
      incrementally_list_origin_access_identities do |response|
        result += response[:origin_access_identities]
        true
      end
      result
    end

    # Incrementally list Origin Access Identities.
    # Optional params: +:marker+ and +:max_items+.
    #
    #  acf.incrementally_list_origin_access_identities(:max_items => 2) #=>
    #    {:origin_access_identities=>
    #      [{:comment=>"kd: TEST",
    #        :s3_canonical_user_id=>
    #         "c7ca36f6c5d384e60aeca02032ac748bae3c458c5322a2e279382935f1f71b16d9ac251f7f71f1ea91c37d3c214645b8",
    #        :aws_id=>"E3TL4XWF5KTGH"},
    #       {:comment=>"kd: TEST-2",
    #        :s3_canonical_user_id=>
    #         "9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
    #        :aws_id=>"E3HJ7V8C3324VF"}],
    #     :is_truncated=>true,
    #     :max_items=>2,
    #     :marker=>"",
    #     :next_marker=>"E3HJ7V8C3324VF"}
    #
    #   # get max 100 origin access identities (the list will be restricted by a default MaxItems value ==100 )
    #   incrementally_list_origin_access_identities
    #
    #   # list origin access identities by 10
    #   acf.incrementally_list_origin_access_identities(:max_items => 10) do |response|
    #     puts response.inspect # a list of 10 distributions
    #     true # return false if the listing should be broken otherwise use true
    #   end
    #
    def incrementally_list_origin_access_identities(params={}, &block)
      opts = {}
      opts['MaxItems'] = params[:max_items] if params[:max_items]
      opts['Marker']   = params[:marker]    if params[:marker]
      last_response = nil
      loop do
        link = generate_request('GET', 'origin-access-identity/cloudfront', opts)
        last_response = request_info(link,  AcfOriginAccesIdentitiesListParser.new(:logger => @logger))
        opts['Marker'] = last_response[:next_marker]
        break unless block && block.call(last_response) && !last_response[:next_marker].right_blank?
      end
      last_response
    end

    #-----------------------------------------------------------------
    #      Origin Access Identity
    #-----------------------------------------------------------------

    # Create a new CloudFront Origin Access Identity.
    #
    #  acf.create_origin_access_identity('MyTestAccessIdentity') #=>
    #    {:e_tag=>"E2QOKZEXCUWHJX",
    #     :comment=>"MyTestAccessIdentity",
    #     :location=>
    #       "https://cloudfront.amazonaws.com/origin-access-identity/cloudfront/E3JPJZ80ZBX24G",
    #     :caller_reference=>"201004161657467493031273",
    #     :s3_canonical_user_id=>
    #       "de4361b33dbaf499d3d77159bfa1571d3451eaec25a2b16553de5e534da8089bb8c31a4898d73d1a658155d0e48872a7",
    #     :aws_id=>"E3JPJZ80ZBX24G"}
    #
    def create_origin_access_identity(comment='', caller_reference=nil)
      config = { :comment          => comment,
                 :caller_reference => caller_reference }
      create_origin_access_identity_by_config(config)
    end

    def create_origin_access_identity_by_config(config)
      config[:caller_reference] ||= generate_call_reference
      link = generate_request('POST', 'origin-access-identity/cloudfront', {}, origin_access_identity_config_to_xml(config))
      merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first)
    end

    # Get Origin Access Identity
    #
    #  acf.get_origin_access_identity('E3HJ7V8C3324VF') #=>
    #    {:comment=>"kd: TEST-2",
    #     :caller_reference=>"201004161655035372351604",
    #     :aws_id=>"E3HJ7V8C3324VF",
    #     :s3_canonical_user_id=>
    #      "9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
    #     :e_tag=>"E309Q4IM450498"}
    #
    def get_origin_access_identity(aws_id)
      link = generate_request('GET', "origin-access-identity/cloudfront/#{aws_id}")
      merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first)
    end

    # Get Origin Access Identity
    #
    #  acf.get_origin_access_identity('E3HJ7V8C3324VF') #=>
    #    {:comment=>"kd: TEST-2",
    #     :caller_reference=>"201004161655035372351604",
    #     :aws_id=>"E3HJ7V8C3324VF",
    #     :s3_canonical_user_id=>
    #      "9af7058b1d197c2c03fdcc3ddad07012a7822f5fc4a8156025409ffac646bdae4dc714820482c92e6988e5703c8d9954",
    #     :e_tag=>"E309Q4IM450498"}
    #
    #  acf.delete_origin_access_identity("E3HJ7V8C3324VF","E309Q4IM450498") #=> true
    #
    def delete_origin_access_identity(aws_id, e_tag)
      link = generate_request('DELETE', "origin-access-identity/cloudfront/#{aws_id}", {}, nil,
                                        'If-Match' => e_tag)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      Config
    #-----------------------------------------------------------------

    def origin_access_identity_config_to_xml(config) # :nodoc:
      "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
      "<CloudFrontOriginAccessIdentityConfig xmlns=\"http://#{@params[:server]}/doc/#{API_VERSION}/\">\n" +
      "  <CallerReference>#{config[:caller_reference]}</CallerReference>\n" +
      "  <Comment>#{AwsUtils::xml_escape(config[:comment].to_s)}</Comment>\n" +
      "</CloudFrontOriginAccessIdentityConfig>"
    end

    # Get Origin Access Identity config
    #
    #  acf.get_origin_access_identity_config("E3JPJZ80ZBX24G") #=>
    #    {:comment=>"MyTestAccessIdentity",
    #     :caller_reference=>"201004161657467493031273",
    #     :e_tag=>"E2QOKZEXCUWHJX"}
    #
    def get_origin_access_identity_config(aws_id)
      link = generate_request('GET', "origin-access-identity/cloudfront/#{aws_id}/config")
      merge_headers(request_info(link, AcfOriginAccesIdentitiesListParser.new(:logger => @logger))[:origin_access_identities].first)
    end

    # Set Origin Access Identity config
    #
    #
    #  acf.set_origin_access_identity_config("E2QOKZEXCUWHJX",
    #                                        :comment => "MyBestOriginAccessConfig",
    #                                        :caller_reference => '01234567890',
    #                                        :e_tag=>"E2QOKZEXCUWHJX") #=> true
    #                                        
    # P.S. This guy is not tested yet: http://developer.amazonwebservices.com/connect/thread.jspa?threadID=45256
    def set_origin_access_identity_config(aws_id, config)
      link = generate_request('PUT', "origin-access-identity/cloudfront/#{aws_id}/config", {}, origin_access_identity_config_to_xml(config),
                                     'If-Match' => config[:e_tag])
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      PARSERS:
    #-----------------------------------------------------------------

    class AcfOriginAccesIdentitiesListParser < RightAWSParser # :nodoc:
      def reset
        @result = { :origin_access_identities => [] }
      end
      def tagstart(name, attributes)
        case full_tag_name
        when %r{CloudFrontOriginAccessIdentitySummary$},
             %r{^CloudFrontOriginAccessIdentity$},
             %r{^CloudFrontOriginAccessIdentityConfig$}
          @item = {}
        end
      end
      def tagend(name)
        case name
        when 'Marker'            then @result[:marker]       = @text
        when 'NextMarker'        then @result[:next_marker]  = @text
        when 'MaxItems'          then @result[:max_items]    = @text.to_i
        when 'IsTruncated'       then @result[:is_truncated] = (@text == 'true')
        when 'Id'                then @item[:aws_id]               = @text
        when 'S3CanonicalUserId' then @item[:s3_canonical_user_id] = @text
        when 'CallerReference'   then @item[:caller_reference]     = @text
        when 'Comment'           then @item[:comment]              = AwsUtils::xml_unescape(@text)
        end
        case full_tag_name
        when %r{CloudFrontOriginAccessIdentitySummary$},
             %r{^CloudFrontOriginAccessIdentity$},
             %r{^CloudFrontOriginAccessIdentityConfig$}
          @result[:origin_access_identities] << @item
        end
      end
    end

  end
end

================================================
FILE: lib/acf/right_acf_streaming_interface.rb
================================================
#
# Copyright (c) 2008 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
module RightAws
  
  class AcfInterface
    
    def streaming_distribution_config_to_xml(config) # :nodoc:
      distribution_config_to_xml(config, 'StreamingDistributionConfig')
    end

    #-----------------------------------------------------------------
    #      API Calls:
    #-----------------------------------------------------------------

    # List all streaming distributions.
    # Returns an array of distributions or RightAws::AwsError exception.
    #
    #  acf.list_streaming_distributions #=>
    #    [{:status=>"Deployed",
    #      :aws_id=>"E3CWE2Z9USOS6B",
    #      :enabled=>true,
    #      :domain_name=>"s2jz1ourvss1fj.cloudfront.net",
    #      :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #      :last_modified_time=>"2010-04-19T08:53:32.574Z",
    #      :comment=>"Woo-Hoo!",
    #      :cnames=>["stream.web.my-awesome-site.net"]},
    #      ...
    #     {:status=>"Deployed",
    #      :aws_id=>"E3NPQZY4LKAYQ8",
    #      :enabled=>true,
    #      :domain_name=>"sw9nrsq9pudk3.cloudfront.net",
    #      :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #      :last_modified_time=>"2010-04-19T08:59:09.600Z",
    #      :comment=>"Woo-Hoo!",
    #      :cnames=>["stream-6.web.my-awesome-site.net"]}]
    #
    def list_streaming_distributions
      result = []
      incrementally_list_streaming_distributions do |response|
        result += response[:distributions]
        true
      end
      result
    end

    # Incrementally list streaming distributions.
    #
    # Optional params: +:marker+ and +:max_items+.
    #
    #   # get first streaming distribution
    #   incrementally_list_distributions(:max_items => 1) #=>
    #    {:marker=>"",
    #     :next_marker=>"E3CWE2Z9USOS6B",
    #     :distributions=>
    #      [{:status=>"Deployed",
    #        :cnames=>["stream.web.my-awesome-site.net"],
    #        :aws_id=>"E3CWE2Z9USOS6B",
    #        :enabled=>true,
    #        :last_modified_time=>"2010-04-19T08:53:32.574Z",
    #        :domain_name=>"s2jz1ourvss1fj.cloudfront.net",
    #        :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #        :comment=>"Woo-Hoo!"}],
    #     :max_items=>1,
    #     :is_truncated=>true}
    #
    #   # get max 100 streaming distributions (the list will be restricted by a default MaxItems value ==100 )
    #   incrementally_list_streaming_distributions
    #
    #   # list streaming distributions by 10
    #   incrementally_list_streaming_distributions(:max_items => 10) do |response|
    #     puts response.inspect # a list of 10 distributions
    #     true # return false if the listing should be broken otherwise use true
    #   end
    #
    def incrementally_list_streaming_distributions(params={}, &block)
      opts = {}
      opts['MaxItems'] = params[:max_items] if params[:max_items]
      opts['Marker']   = params[:marker]    if params[:marker]
      last_response = nil
      loop do
        link = generate_request('GET', 'streaming-distribution', opts)
        last_response = request_info(link,  AcfDistributionListParser.new(:logger => @logger))
        opts['Marker'] = last_response[:next_marker]
        break unless block && block.call(last_response) && !last_response[:next_marker].right_blank?
      end
      last_response
    end

    # Create a new streaming distribution.
    # Returns the just created distribution or RightAws::AwsError exception.
    #
    #  acf.create_streaming_distribution('bucket-for-konstantin-00.s3.amazonaws.com', 'Woo-Hoo!', true,
    #                                    ['stream-1.web.my-awesome-site.net']) #=>
    #    {:status=>"InProgress",
    #     :caller_reference=>"201004191254412191173215",
    #     :cnames=>["stream-1.web.my-awesome-site.net"],
    #     :aws_id=>"E1M5LERJLU636F",
    #     :e_tag=>"E2588L5QL4BLXH",
    #     :enabled=>true,
    #     :domain_name=>"s1di8imd85wgld.cloudfront.net",
    #     :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #     :last_modified_time=>Mon Apr 19 08:54:42 UTC 2010,
    #     :location=>
    #      "https://cloudfront.amazonaws.com/streaming-distribution/E1M5LERJLU636F",
    #     :comment=>"Woo-Hoo!"}
    #
    def create_streaming_distribution(config)
      config[:caller_reference] ||= generate_call_reference
      link = generate_request('POST', 'streaming-distribution', {}, streaming_distribution_config_to_xml(config))
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end
    alias_method :create_streaming_distribution_by_config, :create_streaming_distribution

    # Get a streaming distribution's information.
    # Returns a distribution's information or RightAws::AwsError exception.
    #
    #  acf.get_streaming_distribution('E3CWE2Z9USOS6B') #=>
    #    {:status=>"Deployed",
    #     :e_tag=>"EXTZ2SXAQT39K",
    #     :cnames=>["stream.web.my-awesome-site.net"],
    #     :aws_id=>"E3CWE2Z9USOS6B",
    #     :enabled=>true,
    #     :domain_name=>"s2jz1ourvss1fj.cloudfront.net",
    #     :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #     :last_modified_time=>"2010-04-19T08:53:32.574Z",
    #     :comment=>"Woo-Hoo!",
    #     :caller_reference=>"201004191253311625537161"}
    #
    #  acf.get_streaming_distribution('E1M5LERJLU636F') #=>
    #    {:trusted_signers=>["self", "648772220000", "120288270000"],
    #     :status=>"InProgress",
    #     :e_tag=>"E2K6XD13RCJQ6E",
    #     :cnames=>["stream-1.web.my-awesome-site.net"],
    #     :active_trusted_signers=>
    #      [{:key_pair_ids=>["APKAIK74BJWCLXZUMEJA"],
    #        :aws_account_number=>"120288270000"},
    #       {:aws_account_number=>"self"},
    #       {:aws_account_number=>"648772220000"}],
    #     :aws_id=>"E1M5LERJLU636F",
    #     :enabled=>false,
    #     :domain_name=>"s1di8imd85wgld.cloudfront.net",
    #     :s3_origin=> {
    #       :dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com",
    #       :origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G"},
    #     :last_modified_time=>"2010-04-19T09:14:07.160Z",
    #     :comment=>"Olah-lah!",
    #     :caller_reference=>"201004191254412191173215"}
    #
    def get_streaming_distribution(aws_id)
      link = generate_request('GET', "streaming-distribution/#{aws_id}")
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end

    # Get a streaming distribution's configuration.
    # Returns a distribution's configuration or RightAws::AwsError exception.
    #
    #  acf.get_streaming_distribution_config('E1M5LERJLU636F') #=>
    #    {:trusted_signers=>["self", "648772220000", "120288270000"],
    #     :e_tag=>"E2K6XD13RCJQ6E",
    #     :cnames=>["stream-1.web.my-awesome-site.net"],
    #     :enabled=>false,
    #     :s3_origin=> {
    #       :dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com",
    #       :origin_access_identity=>"origin-access-identity/cloudfront/E3JPJZ80ZBX24G",},
    #     :comment=>"Olah-lah!",
    #     :caller_reference=>"201004191254412191173215"}
    #
    def get_streaming_distribution_config(aws_id)
      link = generate_request('GET', "streaming-distribution/#{aws_id}/config")
      merge_headers(request_info(link, AcfDistributionListParser.new(:logger => @logger))[:distributions].first)
    end

    # Set a streaming distribution's configuration
    # Returns +true+ on success or RightAws::AwsError exception.
    #
    #  acf.get_streaming_distribution_config('E1M5LERJLU636F') #=>
    #    {:e_tag=>"E2588L5QL4BLXH",
    #     :cnames=>["stream-1.web.my-awesome-site.net"],
    #     :enabled=>true,
    #     :s3_origin=> {:dns_name=>"bucket-for-konstantin-00.s3.amazonaws.com"},
    #     :comment=>"Woo-Hoo!",
    #     :caller_reference=>"201004191254412191173215"}
    #
    #  config[:comment]                            = 'Olah-lah!'
    #  config[:enabled]                            = false
    #  config[:s3_origin][:origin_access_identity] = "origin-access-identity/cloudfront/E3JPJZ80ZBX24G"
    #  config[:trusted_signers]                    = ['self', '648772220000', '120288270000']
    #
    #  acf.set_distribution_config('E2REJM3VUN5RSI', config) #=> true
    #
    def set_streaming_distribution_config(aws_id, config)
      link = generate_request('PUT', "streaming-distribution/#{aws_id}/config", {}, streaming_distribution_config_to_xml(config),
                                     'If-Match' => config[:e_tag])
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Delete a streaming distribution. The enabled distribution cannot be deleted.
    # Returns +true+ on success or RightAws::AwsError exception.
    #
    #  acf.delete_streaming_distribution('E1M5LERJLU636F', 'E2588L5QL4BLXH') #=> true
    #
    def delete_streaming_distribution(aws_id, e_tag)
      link = generate_request('DELETE', "streaming-distribution/#{aws_id}", {}, nil,
                                        'If-Match' => e_tag)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

  end
end


================================================
FILE: lib/acw/right_acw_interface.rb
================================================
#
# Copyright (c) 2007-2009 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

module RightAws

  # = RightAWS::AcwInterface -- RightScale Amazon Cloud Watch interface
  # The RightAws::AcwInterface class provides a complete interface to Amazon Cloud Watch service.
  #
  # For explanations of the semantics of each call, please refer to Amazon's documentation at
  # http://docs.amazonwebservices.com/AmazonCloudWatch/latest/DeveloperGuide/
  #
  class AcwInterface < RightAwsBase
    include RightAwsBaseInterface

    # Amazon ACW API version being used
    API_VERSION       = "2009-05-15"
    DEFAULT_HOST      = "monitoring.amazonaws.com"
    DEFAULT_PATH      = '/'
    DEFAULT_PROTOCOL  = 'https'
    DEFAULT_PORT      = 443

    @@bench = AwsBenchmarkingBlock.new
    def self.bench_xml
      @@bench.xml
    end
    def self.bench_service
      @@bench.service
    end

    # Create a new handle to an ACW account. All handles share the same per process or per thread
    # HTTP connection to Amazon ACW. Each handle is for a specific account. The params have the
    # following options:
    # * <tt>:endpoint_url</tt> a fully qualified url to Amazon API endpoint (this overwrites: :server, :port, :service, :protocol). Example: 'https://monitoring.amazonaws.com/'
    # * <tt>:server</tt>: ACW service host, default: DEFAULT_HOST
    # * <tt>:port</tt>: ACW service port, default: DEFAULT_PORT
    # * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
    # * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
    # * <tt>:signature_version</tt>:  The signature version : '0','1' or '2'(default)
    # * <tt>:cache</tt>: true/false(default): list_metrics
    #
    def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
      init({ :name                => 'ACW',
             :default_host        => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).host   : DEFAULT_HOST,
             :default_port        => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).port   : DEFAULT_PORT,
             :default_service     => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).path   : DEFAULT_PATH,
             :default_protocol    => ENV['ACW_URL'] ? URI.parse(ENV['ACW_URL']).scheme : DEFAULT_PROTOCOL,
             :default_api_version => ENV['ACW_API_VERSION'] || API_VERSION },
           aws_access_key_id    || ENV['AWS_ACCESS_KEY_ID'] ,
           aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],
           params)
    end

    def generate_request(action, params={}) #:nodoc:
      generate_request_impl(:get, action, params )
    end

      # Sends request to Amazon and parses the response
      # Raises AwsError if any banana happened
    def request_info(request, parser)  #:nodoc:
      request_info_impl(:ams_connection, @@bench, request, parser)
    end

    #-----------------------------------------------------------------
    #      MetricStatistics
    #-----------------------------------------------------------------

    # Get time-series data for one or more statistics of given a Metric
    # Returns a hash of stat data.
    #
    #  Options are:
    #
    #    :period       - x*60 seconds interval (where x > 0)
    #    :statistics   - Average, Minimum. Maximum, Sum, Samples
    #    :start_time   - The timestamp of the first datapoint to return, inclusive.
    #    :end_time     - The timestamp to use for determining the last datapoint to return. This is the last datapoint to fetch, exclusive.
    #    :namespace    - The namespace corresponding to the service of interest. For example, AWS/EC2 represents Amazon EC2.
    #    :unit         - Seconds, Percent, Bytes, Bits, Count, Bytes/Second, Bits/Second, Count/Second, and None
    #    :custom_unit  - The user-defined CustomUnit applied to a Measure. Please see the key term Unit.
    #    
    #    :dimentions
    #      Dimensions for EC2 Metrics:
    #      * ImageId              - shows the requested metric for all instances running this EC2 Amazon Machine Image(AMI)
    #      * AvailabilityZone     - shows the requested metric for all instances running in that EC2 Availability Zone
    #      * CapacityGroupName    - shows the requested metric for all instances in the specified capacity group - this dimension is
    #                               only available for EC2 metrics when the instances are in an Amazon Automatic Scaling Service
    #                               Capacity Group
    #      * InstanceId           - shows the requested metric for only the identified instance
    #      * InstanceType         - shows the requested metric for all instances running with that instance type
    #      * Service (required)   - the name of the service that reported the monitoring data - for EC2 metrics, use "EC2"
    #      * Namespace (required) - in private beta, the available metrics are all reported by AWS services, so set this to "AWS"
    #      Dimensions for Load Balancing Metrics:
    #      * AccessPointName      - shows the requested metric for the specified AccessPoint name
    #      * AvailabilityZone     - shows the requested metric for all instances running in that EC2 Availability Zone
    #      * Service (required)   - the name of the service that reported the monitoring data - for LoadBalancing metrics, use "LBS"
    #      * Namespace (required) - in private beta, the available metrics are all reported by AWS services, so set this to "AWS"
    #
    #    :measure_name
    #      EC2 Metrics:
    #      * CPUUtilization  the percentage of allocated EC2 Compute Units that are currently in use on the instance. Units are Percent.
    #      * NetworkIn      - the number of bytes received on all network interfaces by the instance. Units are Bytes.
    #      * NetworkOut     - the number of bytes sent out on all network interfaces by the instance. Units are Bytes.
    #      * DiskReadOps    - completed read operations from all disks available to the instance in one minute. Units are Count/Second.
    #      * DiskWriteOps   - completed writes operations to all disks available to the instance in one minute. Units are Count/Second.
    #      * DiskReadBytes  - bytes read from all disks available to the instance in one minute. Units are Bytes/Second.
    #      * DiskWriteBytes - bytes written to all disks available to the instance in one minute. Units are Bytes/Second.
    #      Load Balancing Metrics:
    #      * Latency            - time taken between a request and the corresponding response as seen by the load balancer. Units are in
    #                             seconds, and the available statistics include minimum, maximum, average and count.
    #      * RequestCount       - number of requests processed by the AccessPoint over the valid period. Units are count per second, and
    #                             the available statistics include minimum, maximum and sum. A valid period can be anything equal to or
    #                             multiple of sixty (60) seconds.
    #      * HealthyHostCount   - number of healthy EndPoints for the valid Period. A valid period can be anything equal to or a multiple
    #                             of sixty (60) seconds. Units are the count of EndPoints. The meaningful statistic for HealthyHostCount
    #                             is the average for an AccessPoint within an Availability Zone. Both Load Balancing dimensions,
    #                             AccessPointName and AvailabilityZone, should be specified when retreiving HealthyHostCount.
    #      * UnHealthyHostCount - number of unhealthy EndPoints for the valid Period. A valid period can be anything equal to or a multiple
    #                             of sixty (60) seconds. Units are the count of EndPoints. The meaningful statistic for UnHealthyHostCount
    #                             is the average for an AccessPoint within Availability Amazon Monitoring Service Developer Guide Load
    #                             Balancing Metrics Version PRIVATE BETA 2009-01-22 19 Zone. Both Load Balancing dimensions, AccessPointName
    #                             and AvailabilityZone, should be specified when retreiving UnHealthyHostCount.
    #
    def get_metric_statistics(options={})
      # Period (60 sec by default)
      period = (options[:period] && options[:period].to_i) || 60
      # Statistics ('Average' by default)
      statistics = Array(options[:statistics]).flatten
      statistics = statistics.right_blank? ? ['Average'] : statistics.map{|statistic| statistic.to_s.capitalize }
      # Times (5.min.ago up to now by default)
      start_time = options[:start_time] || (Time.now.utc - 5*60)
      start_time = start_time.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00") if start_time.is_a?(Time)
      end_time = options[:end_time] || Time.now.utc
      end_time = end_time.utc.strftime("%Y-%m-%dT%H:%M:%S+00:00") if end_time.is_a?(Time)
      # Measure name
      measure_name = options[:measure_name] || 'CPUUtilization'
      # Dimentions (a hash, empty by default)
      dimentions = options[:dimentions] || {}
      #
      request_hash = { 'Period'      => period,
                       'StartTime'   => start_time,
                       'EndTime'     => end_time,
                       'MeasureName' => measure_name }
      request_hash['Unit']       = options[:unit]        if options[:unit]
      request_hash['CustomUnit'] = options[:custom_unit] if options[:custom_unit]
      request_hash['Namespace']  = options[:namespace]   if options[:namespace]
      request_hash.merge!(amazonize_list('Statistics.member', statistics))
      # dimentions
      dim = []
      dimentions.each do |key, values|
        Array(values).each { |value|  dim << [key, value] }
      end
      request_hash.merge!(amazonize_list(['Dimensions.member.?.Name', 'Dimensions.member.?.Value'], dim))
      #
      link = generate_request("GetMetricStatistics", request_hash)
      request_info(link, GetMetricStatisticsParser.new(:logger => @logger))
    end

    # This call returns a list of the valid metrics for which there is recorded data available to a you.
    #
    #  acw.list_metrics #=>
    #      [ { :namespace    => "AWS/ELB",
    #          :measure_name => "HealthyHostCount",
    #          :dimentions   => { "LoadBalancerName"=>"test-kd1" } },
    #        { :namespace    => "AWS/ELB",
    #          :measure_name => "UnHealthyHostCount",
    #          :dimentions   => { "LoadBalancerName"=>"test-kd1" } } ]
    def list_metrics
      link = generate_request("ListMetrics")
      request_cache_or_info :list_metrics, link,  ListMetricsParser, @@bench, true
    end

    #-----------------------------------------------------------------
    #      PARSERS: MetricStatistics
    #-----------------------------------------------------------------

    class GetMetricStatisticsParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        @item = {} if name == 'member'
      end
      def tagend(name)
        case name
        when 'Timestamp'  then @item[:timestamp]   = @text
        when 'Unit'       then @item[:unit]        = @text
        when 'CustomUnit' then @item[:custom_unit] = @text
        when 'Samples'    then @item[:samples]     = @text.to_f
        when 'Average'    then @item[:average]     = @text.to_f
        when 'Minimum'    then @item[:minimum]     = @text.to_f
        when 'Maximum'    then @item[:maximum]     = @text.to_f
        when 'Sum'        then @item[:sum]         = @text.to_f
        when 'member'     then @result[:datapoints] << @item
        when 'Label'      then @result[:label]     = @text
        end
      end
      def reset
        @result = { :datapoints => [] }
      end
    end

    class ListMetricsParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case name
        when 'member'
          case @xmlpath
            when @p then @item = { :dimentions => {} }
          end
        end
      end
      def tagend(name)
        case name
        when 'MeasureName' then @item[:measure_name] = @text
        when 'Namespace'   then @item[:namespace] = @text
        when 'Name'        then @dname  = @text
        when 'Value'       then @dvalue = @text
        when 'member'
          case @xmlpath
          when "#@p/member/Dimensions" then @item[:dimentions][@dname] = @dvalue
          when @p then @result << @item
          end
        end
      end
      def reset
        @p      = 'ListMetricsResponse/ListMetricsResult/Metrics'
        @result = []
      end
    end

  end

end


================================================
FILE: lib/as/right_as_interface.rb
================================================
#
# Copyright (c) 2007-2009 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

module RightAws

  # = RightAWS::AsInterface -- RightScale Amazon Auto Scaling interface
  # The RightAws::AsInterface class provides a complete interface to Amazon Auto Scaling service.
  #
  # For explanations of the semantics of each call, please refer to Amazon's documentation at
  # http://docs.amazonwebservices.com/AutoScaling/latest/DeveloperGuide/
  #
  # Create an interface handle:
  #
  #  as = RightAws::AsInterface.new(aws_access_key_id, aws_security_access_key)
  #
  # Create a launch configuration:
  #
  #  as.create_launch_configuration('CentOS.5.1-c', 'ami-08f41161', 'm1.small',
  #                                 :key_name        => 'kd-moo-test',
  #                                 :security_groups => ['default'],
  #                                 :user_data       => "Woohoo: CentOS.5.1-c" )
  #
  # Create an AutoScaling group:
  #
  #  as.create_auto_scaling_group('CentOS.5.1-c-array', 'CentOS.5.1-c', 'us-east-1c',
  #                               :min_size => 2,
  #                               :max_size => 5)
  #
  # Create a new trigger:
  # 
  #  as.create_or_update_scaling_trigger('kd.tr.1', 'CentOS.5.1-c-array',
  #                                      :measure_name => 'CPUUtilization',
  #                                      :statistic => :average,
  #                                      :dimensions => {
  #                                         'AutoScalingGroupName' => 'CentOS.5.1-c-array',
  #                                         'Namespace' => 'AWS',
  #                                         'Service' => 'EC2' },
  #                                      :period => 60,
  #                                      :lower_threshold => 5,
  #                                      :lower_breach_scale_increment => -1,
  #                                      :upper_threshold => 60,
  #                                      :upper_breach_scale_increment => 1,
  #                                      :breach_duration => 300 )
  #
  # Describe scaling activity:
  #
  #  as.incrementally_describe_scaling_activities('CentOS.5.1-c-array') #=> List of activities
  #
  # Describe the Auto Scaling group status:
  #
  #  as.describe_auto_scaling_groups('CentOS.5.1-c-array') #=> Current group status
  #
  class AsInterface < RightAwsBase
    include RightAwsBaseInterface

    # Amazon AS API version being used
    API_VERSION       = '2009-05-15'
    DEFAULT_HOST      = 'autoscaling.amazonaws.com'
    DEFAULT_PATH      = '/'
    DEFAULT_PROTOCOL  = 'https'
    DEFAULT_PORT      = 443

    @@bench = AwsBenchmarkingBlock.new
    def self.bench_xml
      @@bench.xml
    end
    def self.bench_service
      @@bench.service
    end

    # Create a new handle to an CSLS account. All handles share the same per process or per thread
    # HTTP connection to Amazon CSLS. Each handle is for a specific account. The params have the
    # following options:
    # * <tt>:endpoint_url</tt> a fully qualified url to Amazon API endpoint (this overwrites: :server, :port, :service, :protocol). Example: 'https://autoscaling.amazonaws.com/'
    # * <tt>:server</tt>: AS service host, default: DEFAULT_HOST
    # * <tt>:port</tt>: AS service port, default: DEFAULT_PORT
    # * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
    # * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LOGGER else STDOUT
    # * <tt>:signature_version</tt>:  The signature version : '0','1' or '2'(default)
    # * <tt>:cache</tt>: true/false(default): describe_auto_scaling_groups
    #
    def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
      init({ :name                => 'AS',
             :default_host        => ENV['AS_URL'] ? URI.parse(ENV['AS_URL']).host   : DEFAULT_HOST,
             :default_port        => ENV['AS_URL'] ? URI.parse(ENV['AS_URL']).port   : DEFAULT_PORT,
             :default_service     => ENV['AS_URL'] ? URI.parse(ENV['AS_URL']).path   : DEFAULT_PATH,
             :default_protocol    => ENV['AS_URL'] ? URI.parse(ENV['AS_URL']).scheme : DEFAULT_PROTOCOL,
             :default_api_version => ENV['AS_API_VERSION'] || API_VERSION },
           aws_access_key_id    || ENV['AWS_ACCESS_KEY_ID'] ,
           aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],
           params)
    end

    def generate_request(action, params={}) #:nodoc:
      generate_request_impl(:get, action, params )
    end

      # Sends request to Amazon and parses the response
      # Raises AwsError if any banana happened
    def request_info(request, parser)  #:nodoc:
      request_info_impl(:aass_connection, @@bench, request, parser)
    end

    #-----------------------------------------------------------------
    #      Auto Scaling Groups
    #-----------------------------------------------------------------

    # Describe auto scaling groups.
    # Returns a full description of the AutoScalingGroups from the given list.
    # This includes all EC2 instances that are members of the group. If a list
    # of names is not provided, then the full details of all AutoScalingGroups
    # is returned. This style conforms to the EC2 DescribeInstances API behavior.
    #
    def describe_auto_scaling_groups(*auto_scaling_group_names)
      auto_scaling_group_names = auto_scaling_group_names.flatten.compact
      request_hash = amazonize_list('AutoScalingGroupNames.member', auto_scaling_group_names)
      link = generate_request("DescribeAutoScalingGroups", request_hash)
      request_cache_or_info(:describe_auto_scaling_groups, link,  DescribeAutoScalingGroupsParser, @@bench, auto_scaling_group_names.right_blank?)
    end

    # Creates a new auto scaling group with the specified name.
    # Returns +true+ or raises an exception.
    #
    # Options: +:min_size+, +:max_size+, +:cooldown+, +:load_balancer_names+
    #
    #  as.create_auto_scaling_group('CentOS.5.1-c-array', 'CentOS.5.1-c', 'us-east-1c',
    #                               :min_size => 2,
    #                               :max_size => 5)  #=> true
    #
    # Amazon's notice: Constraints: Restricted to one Availability Zone
    def create_auto_scaling_group(auto_scaling_group_name, launch_configuration_name, availability_zones, options={})
      options[:min_size] ||= 1
      options[:max_size] ||= 20
      options[:cooldown] ||= 0
      request_hash = amazonize_list('AvailabilityZones.member', availability_zones)
      request_hash.merge!( amazonize_list('LoadBalancerNames.member', options[:load_balancer_names]) )
      request_hash.merge!( 'AutoScalingGroupName'    => auto_scaling_group_name,
                           'LaunchConfigurationName' => launch_configuration_name,
                           'MinSize'                 => options[:min_size],
                           'MaxSize'                 => options[:max_size],
                           'Cooldown'                => options[:cooldown] )
      link = generate_request("CreateAutoScalingGroup", request_hash)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Deletes all configuration for this auto scaling group and also deletes the group.
    # Returns +true+ or raises an exception.
    #
    def delete_auto_scaling_group(auto_scaling_group_name)
      link = generate_request('DeleteAutoScalingGroup', 'AutoScalingGroupName' => auto_scaling_group_name)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Adjusts the desired size of the Capacity Group by using scaling actions, as necessary. When
    # adjusting the size of the group downward, it is not possible to define which EC2 instances will be
    # terminated. This also applies to any auto-scaling decisions that might result in the termination of
    # instances.
    #
    # Returns +true+ or raises an exception.
    #
    #  as.set_desired_capacity('CentOS.5.1-c',3) #=> 3
    #
    def set_desired_capacity(auto_scaling_group_name, desired_capacity)
      link = generate_request('SetDesiredCapacity', 'AutoScalingGroupName' => auto_scaling_group_name,
                                                    'DesiredCapacity'      => desired_capacity )
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Updates the configuration for the given AutoScalingGroup. If MaxSize is lower than the current size,
    # then there will be an implicit call to SetDesiredCapacity to set the group to the new MaxSize. The
    # same is true for MinSize there will also be an implicit call to SetDesiredCapacity. All optional
    # parameters are left unchanged if not passed in the request.
    #
    # The new settings are registered upon the completion of this call. Any launch configuration settings
    # will take effect on any triggers after this call returns. However, triggers that are currently in
    # progress can not be affected. See key term Trigger.
    # 
    # Returns +true+ or raises an exception.
    #
    # Options: +:launch_configuration_name+, +:min_size+, +:max_size+, +:cooldown+, +:availability_zones+.
    # (Amazon's notice: +:availability_zones+ is reserved for future use.)
    #
    #  as.update_auto_scaling_group('CentOS.5.1-c', :min_size => 1, :max_size => 4) #=> true
    #
    def update_auto_scaling_group(auto_scaling_group_name, options={})
      request_hash = amazonize_list('AvailabilityZones.member', options[:availability_zones])
      request_hash['AutoScalingGroupName']    = auto_scaling_group_name
      request_hash['LaunchConfigurationName'] = options[:launch_configuration_name] if options[:launch_configuration_name]
      request_hash['MinSize']  = options[:min_size] if options[:min_size]
      request_hash['MaxSize']  = options[:max_size] if options[:max_size]
      request_hash['Cooldown'] = options[:cooldown] if options[:cooldown]
      link = generate_request("UpdateAutoScalingGroup", request_hash)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      Scaling Activities
    #-----------------------------------------------------------------

    # Describe all Scaling Activities.
    #
    #  describe_scaling_activities('CentOS.5.1-c-array') #=>
    #        [{:cause=>
    #            "At 2009-05-28 10:11:35Z trigger kd.tr.1 breached high threshold value for
    #             CPUUtilization, 10.0, adjusting the desired capacity from 1 to 2.  At 2009-05-28 10:11:35Z
    #             a breaching trigger explicitly set group desired capacity changing the desired capacity
    #             from 1 to 2.  At 2009-05-28 10:11:40Z an instance was started in response to a difference
    #             between desired and actual capacity, increasing the capacity from 1 to 2.",
    #          :activity_id=>"067c9abb-f8a7-4cf8-8f3c-dc6f280457c4",
    #          :progress=>0,
    #          :description=>"Launching a new EC2 instance",
    #          :status_code=>"InProgress",
    #          :start_time=>Thu May 28 10:11:40 UTC 2009},
    #         {:end_time=>Thu May 28 09:35:23 UTC 2009,
    #          :cause=>
    #            "At 2009-05-28 09:31:21Z a user request created an AutoScalingGroup changing the desired
    #             capacity from 0 to 1.  At 2009-05-28 09:32:35Z an instance was started in response to a
    #             difference between desired and actual capacity, increasing the capacity from 0 to 1.",
    #          :activity_id=>"90d506ba-1b75-4d29-8739-0a75b1ba8030",
    #          :progress=>100,
    #          :description=>"Launching a new EC2 instance",
    #          :status_code=>"Successful",
    #          :start_time=>Thu May 28 09:32:35 UTC 2009}]}
    #
    def describe_scaling_activities(auto_scaling_group_name, *activity_ids)
      result = []
      incrementally_describe_scaling_activities(auto_scaling_group_name, *activity_ids) do |response|
        result += response[:scaling_activities]
        true
      end
      result
    end

    # Incrementally describe Scaling Activities.
    # Returns the scaling activities specified for the given group. If the input list is empty, all the
    # activities from the past six weeks will be returned. Activities will be sorted by completion time.
    # Activities that have no completion time will be considered as using the most recent possible time.
    #
    # Optional params: +:max_records+, +:next_token+.
    #
    #  # get max 100 first activities
    #  as.incrementally_describe_scaling_activities('CentOS.5.1-c-array') #=>
    #      {:scaling_activities=>
    #        [{:cause=>
    #            "At 2009-05-28 10:11:35Z trigger kd.tr.1 breached high threshold value for
    #             CPUUtilization, 10.0, adjusting the desired capacity from 1 to 2.  At 2009-05-28 10:11:35Z
    #             a breaching trigger explicitly set group desired capacity changing the desired capacity
    #             from 1 to 2.  At 2009-05-28 10:11:40Z an instance was started in response to a difference
    #             between desired and actual capacity, increasing the capacity from 1 to 2.",
    #          :activity_id=>"067c9abb-f8a7-4cf8-8f3c-dc6f280457c4",
    #          :progress=>0,
    #          :description=>"Launching a new EC2 instance",
    #          :status_code=>"InProgress",
    #          :start_time=>Thu May 28 10:11:40 UTC 2009},
    #         {:end_time=>Thu May 28 09:35:23 UTC 2009,
    #          :cause=>
    #            "At 2009-05-28 09:31:21Z a user request created an AutoScalingGroup changing the desired
    #             capacity from 0 to 1.  At 2009-05-28 09:32:35Z an instance was started in response to a
    #             difference between desired and actual capacity, increasing the capacity from 0 to 1.",
    #          :activity_id=>"90d506ba-1b75-4d29-8739-0a75b1ba8030",
    #          :progress=>100,
    #          :description=>"Launching a new EC2 instance",
    #          :status_code=>"Successful",
    #          :start_time=>Thu May 28 09:32:35 UTC 2009}]}
    #
    #  # list by 5 records
    #  incrementally_describe_scaling_activities('CentOS.5.1-c-array', :max_records => 5) do |response|
    #    puts response.inspect
    #    true
    #  end
    #
    def incrementally_describe_scaling_activities(auto_scaling_group_name, *activity_ids, &block)
      activity_ids = activity_ids.flatten.compact
      params = activity_ids.last.kind_of?(Hash) ? activity_ids.pop : {}
      request_hash = amazonize_list('ActivityIds.member', activity_ids)
      request_hash['AutoScalingGroupName'] = auto_scaling_group_name
      request_hash['MaxRecords'] = params[:max_records] if params[:max_records]
      request_hash['NextToken']  = params[:next_token]  if params[:next_token]
      last_response = nil
      loop do
        link = generate_request("DescribeScalingActivities", request_hash)
        last_response = request_info( link,  DescribeScalingActivitiesParser.new(:logger => @logger))
        request_hash['NextToken'] = last_response[:next_token]
        break unless block && block.call(last_response) && !last_response[:next_token].right_blank?
      end
      last_response
    end

    #-----------------------------------------------------------------
    #      Instance and Instance Workflow Operations
    #-----------------------------------------------------------------

    # This call will terminate the specified Instance. Optionally, the desired group size can be adjusted.
    # If set to true, the default, the AutoScalingGroup size will decrease by one. If the AutoScalingGroup
    # is associated with a LoadBalancer, the system will deregister the instance before terminating it.
    # This call simply registers a termination request. The termination of the instance can not happen
    # immediately.
    #
    # Returns the activity to terminate the instance.
    #
    def terminate_instance_in_auto_scaling_group(instance_id, should_decrement_desired_capacity=true)
      request_hash = { 'InstanceId' => instance_id }
      request_hash['ShouldDecrementDesiredCapacity'] = should_decrement_desired_capacity
      link = generate_request('TerminateInstanceInAutoScalingGroup', request_hash )
      request_info(link, DescribeScalingActivitiesParser.new(:logger => @logger))[:scaling_activities].first
    end

    #-----------------------------------------------------------------
    #      Launch Configuration Operations
    #-----------------------------------------------------------------

    # Creates a new Launch Configuration. Please note that the launch configuration name used must
    # be unique, within the scope of your Amazon Web Services AWS account, and the maximum limit of
    # launch configurations must not yet have been met, or else the call will fail.
    #
    # Once created, the new launch configuration is available for immediate use.
    #
    # Options: +:security_groups+, +:block_device_mappings+, +:key_name+,
    # +:user_data+, +:kernel_id+, +:ramdisk_id+
    #
    #  as.create_launch_configuration('kd: CentOS.5.1-c.1', 'ami-08f41161', 'c1.medium',
    #    :key_name        => 'tim',
    #    :security_groups => ['default'],
    #    :user_data       => "Woohoo: CentOS.5.1-c",
    #    :block_device_mappings => [ { :device_name     => '/dev/sdk',
    #                                  :ebs_snapshot_id => 'snap-145cbc7d',
    #          :ebs_delete_on_termination => true,
    #          :ebs_volume_size => 3,
    #          :virtual_name => 'ephemeral2'
    #                                } ]
    #    ) #=> true
    #
    def create_launch_configuration(launch_configuration_name, image_id, instance_type, options={})
      request_hash = { 'LaunchConfigurationName' => launch_configuration_name,
                       'ImageId'                 => image_id,
                       'InstanceType'            => instance_type }
      request_hash.merge!(amazonize_list('SecurityGroups.member',      options[:security_groups]))       unless options[:security_groups].right_blank?
      request_hash.merge!(amazonize_block_device_mappings(options[:block_device_mappings], 'BlockDeviceMappings.member'))
      request_hash['KeyName']   = options[:key_name]   if options[:key_name]
      request_hash['UserData']  = Base64.encode64(options[:user_data]).delete("\n") unless options[:user_data].right_blank? if options[:user_data]
      request_hash['KernelId']  = options[:kernel_id]  if options[:kernel_id]
      request_hash['RamdiskId'] = options[:ramdisk_id] if options[:ramdisk_id]
      link = generate_request("CreateLaunchConfiguration", request_hash)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end


    # Describe all Launch Configurations.
    # Returns an array of configurations.
    #
    #  as.describe_launch_configurations #=>
    #    [{:security_groups=>["default"],
    #      :ramdisk_id=>"",
    #      :user_data=>"V29vaG9vOiBDZW50T1MuNS4xLWM=",
    #      :instance_type=>"c1.medium",
    #      :block_device_mappings=>
    #       [{:virtual_name=>"ephemeral2", :device_name=>"/dev/sdk"}],
    #      :launch_configuration_name=>"kd: CentOS.5.1-c.1",
    #      :created_time=>"2010-03-29T10:00:32.742Z",
    #      :image_id=>"ami-08f41161",
    #      :key_name=>"tim",
    #      :kernel_id=>""}, ...]
    #
    def describe_launch_configurations(*launch_configuration_names)
      result = []
      incrementally_describe_launch_configurations(*launch_configuration_names) do |response|
        result += response[:launch_configurations]
        true
      end
      result
    end

    # Incrementally describe Launch Configurations.
    # Returns a full description of the launch configurations given the specified names. If no names
    # are specified, then the full details of all launch configurations are returned.
    # 
    # Optional params: +:max_records+, +:next_token+.
    #
    #  # get max 100 first configurations
    #  as.incrementally_describe_launch_configurations #=>
    #      {:launch_configurations=>
    #        [{:created_time=>Thu May 28 09:31:20 UTC 2009,
    #          :kernel_id=>"",
    #          :launch_configuration_name=>"CentOS.5.1-c",
    #          :ramdisk_id=>"",
    #          :security_groups=>["default"],
    #          :key_name=>"kd-moo-test",
    #          :user_data=>"Woohoo: CentOS.5.1-c-array",
    #          :image_id=>"ami-08f41161",
    #          :block_device_mappings=>[],
    #          :instance_type=>"m1.small"}, ... ]}
    #
    #  # list by 5 records
    #  incrementally_describe_launch_configurations(:max_records => 5) do |response|
    #    puts response.inspect
    #    true
    #  end
    #
    def incrementally_describe_launch_configurations(*launch_configuration_names, &block)
      launch_configuration_names = launch_configuration_names.flatten.compact
      params = launch_configuration_names.last.kind_of?(Hash) ? launch_configuration_names.pop : {}
      request_hash = amazonize_list('LaunchConfigurationNames.member', launch_configuration_names)
      request_hash['MaxRecords'] = params[:max_records] if params[:max_records]
      request_hash['NextToken']  = params[:next_token]  if params[:next_token]
      last_response = nil
      loop do
        link = generate_request("DescribeLaunchConfigurations", request_hash)
        last_response = request_info( link, DescribeLaunchConfigurationsParser.new(:logger => @logger) )
        request_hash['NextToken'] = last_response[:next_token]
        break unless block && block.call(last_response) && !last_response[:next_token].right_blank?
      end
      last_response
    end

    # Delete launch configuration.
    # Returns +true+ or an exception.
    #
    #   as.delete_launch_configuration('CentOS.5.1') #=> true
    #
    def delete_launch_configuration(launch_configuration_name)
      link = generate_request('DeleteLaunchConfiguration', 'LaunchConfigurationName' => launch_configuration_name)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      Trigger Operations
    #-----------------------------------------------------------------

    # Create or update specified trigger.
    # This call sets the parameters that governs when and how to scale an AutoScalingGroup.
    # If the Trigger, within the scope of the caller's AWS account, specified already exists,
    # it will be updated. If a trigger with a different name already exists, this call will fail.
    #
    # Returns +true+ or an exception.
    #
    # Options: +:measure_name+, +:statistic+, +:period+, +:lower_threshold+, +:lower_breach_scale_increment+,
    # +:upper_threshold+, +:upper_breach_scale_increment+, +:dimensions+, +:breach_duration+, +:unit+, +:custom_unit+
    #
    #  as.create_or_update_scaling_trigger('kd.tr.1', 'CentOS.5.1-c-array',
    #                                      :measure_name => 'CPUUtilization',
    #                                      :statistic => :average,
    #                                      :dimensions => {
    #                                         'AutoScalingGroupName' => 'CentOS.5.1-c-array',
    #                                         'Namespace' => 'AWS',
    #                                         'Service' => 'EC2' },
    #                                      :period => 60,
    #                                      :lower_threshold => 5,
    #                                      :lower_breach_scale_increment => -1,
    #                                      :upper_threshold => 60,
    #                                      :upper_breach_scale_increment => 1,
    #                                      :breach_duration => 300 ) #=> true
    #
    def create_or_update_scaling_trigger(trigger_name, auto_scaling_group_name, options={})
      request_hash = { 'TriggerName'               => trigger_name,
                       'AutoScalingGroupName'      => auto_scaling_group_name,
                       'MeasureName'               => options[:measure_name],
                       'Statistic'                 => options[:statistic].to_s.capitalize,
                       'Period'                    => options[:period],
                       'LowerThreshold'            => options[:lower_threshold],
                       'LowerBreachScaleIncrement' => options[:lower_breach_scale_increment],
                       'UpperThreshold'            => options[:upper_threshold],
                       'UpperBreachScaleIncrement' => options[:upper_breach_scale_increment],
                       'BreachDuration'            => options[:breach_duration] }
      request_hash['Unit']       = options[:unit]        if options[:unit]
      request_hash['CustomUnit'] = options[:custom_unit] if options[:custom_unit]
      dimensions = []
      (options[:dimensions] || {}).each do |key, values|
        Array(values).each { |value| dimensions << [key, value] }
      end
      request_hash.merge!(amazonize_list(['Dimensions.member.?.Name', 'Dimensions.member.?.Value'], dimensions))
      link = generate_request("CreateOrUpdateScalingTrigger", request_hash)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    # Describe triggers.
    # Returns a full description of the trigger in the specified Auto Scaling Group.
    #
    #  as.describe_triggers('CentOS.5.1-c-array') #=>
    #      [{:status=>"HighBreaching",
    #        :breach_duration=>300,
    #        :measure_name=>"CPUUtilization",
    #        :trigger_name=>"kd.tr.1",
    #        :period=>60,
    #        :lower_threshold=>0.0,
    #        :lower_breach_scale_increment=>-1,
    #        :dimensions=>
    #         {"Namespace"=>"AWS",
    #          "AutoScalingGroupName"=>"CentOS.5.1-c-array",
    #          "Service"=>"EC2"},
    #        :statistic=>"Average",
    #        :upper_threshold=>10.0,
    #        :created_time=>Thu May 28 09:48:46 UTC 2009,
    #        :auto_scaling_group_name=>"CentOS.5.1-c-array",
    #        :upper_breach_scale_increment=>1}]
    #
    def describe_triggers(auto_scaling_group_name)
      link = generate_request("DescribeTriggers", 'AutoScalingGroupName' => auto_scaling_group_name)
      request_info(link, DescribeTriggersParser.new(:logger => @logger))
    end

    # Delete specified trigger.
    # Returns +true+ or an exception.
    #
    #  as.delete_trigger('kd.tr.1', 'CentOS.5.1-c-array') #=> true
    #
    def delete_trigger(trigger_name, auto_scaling_group_name)
      link = generate_request('DeleteTrigger', 'TriggerName'          => trigger_name,
                                               'AutoScalingGroupName' => auto_scaling_group_name)
      request_info(link, RightHttp2xxParser.new(:logger => @logger))
    end

    #-----------------------------------------------------------------
    #      PARSERS: Scaling Activity
    #-----------------------------------------------------------------

    class DescribeScalingActivitiesParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case name
        when 'member', 'Activity' then @item = {}
        end
      end
      def tagend(name)
        case name
        when 'ActivityId'    then @item[:activity_id]    = @text
        when 'StartTime'     then @item[:start_time]     = @text
        when 'EndTime'       then @item[:end_time]       = @text
        when 'Progress'      then @item[:progress]       = @text.to_i
        when 'StatusCode'    then @item[:status_code]    = @text
        when 'Cause'         then @item[:cause]          = @text
        when 'Description'   then @item[:description]    = @text
        when 'member', 'Activity'  then @result[:scaling_activities] << @item
        when 'NextToken' then @result[:next_token] = @text
        end
      end
      def reset
        @result = { :scaling_activities => []}
      end
    end

    #-----------------------------------------------------------------
    #      PARSERS: Auto Scaling Groups
    #-----------------------------------------------------------------

    class DescribeAutoScalingGroupsParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case name
        when 'member'
          case @xmlpath
            when @p then @item = { :instances => [ ],
                                   :availability_zones => [],
                                   :load_balancer_names => [] }
            when "#@p/member/Instances" then @instance = { }
          end
        end
      end
      def tagend(name)
        case name
        when 'CreatedTime'             then @item[:created_time]              = @text
        when 'MinSize'                 then @item[:min_size]                  = @text.to_i
        when 'MaxSize'                 then @item[:max_size]                  = @text.to_i
        when 'DesiredCapacity'         then @item[:desired_capacity]          = @text.to_i
        when 'Cooldown'                then @item[:cooldown]                  = @text.to_i
        when 'LaunchConfigurationName' then @item[:launch_configuration_name] = @text
        when 'AutoScalingGroupName'    then @item[:auto_scaling_group_name]   = @text
        when 'InstanceId'              then @instance[:instance_id]       = @text
        when 'LifecycleState'          then @instance[:lifecycle_state]   = @text
        when 'AvailabilityZone'        then @instance[:availability_zone] = @text
        when 'member'
          case @xmlpath
          when @p then
            @item[:availability_zones].sort!
            @result << @item
          when "#@p/member/AvailabilityZones" then @item[:availability_zones] << @text
          when "#@p/member/LoadBalancerNames" then @item[:load_balancer_names] << @text
          when "#@p/member/Instances"         then @item[:instances] << @instance
          end
        end
      end
      def reset
        @p      = 'DescribeAutoScalingGroupsResponse/DescribeAutoScalingGroupsResult/AutoScalingGroups'
        @result = []
      end
    end

    #-----------------------------------------------------------------
    #      PARSERS: Launch Configurations
    #-----------------------------------------------------------------

    class DescribeLaunchConfigurationsParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case full_tag_name
        when %r{/LaunchConfigurations/member$}
          @item = { :block_device_mappings => [],
                    :security_groups       => [] }
        when %r{/BlockDeviceMappings/member$}
          @block_device_mapping = {}
        end
      end
      def tagend(name)
        case name
        when 'CreatedTime'             then @item[:created_time]              = @text
        when 'InstanceType'            then @item[:instance_type]             = @text
        when 'KeyName'                 then @item[:key_name]                  = @text
        when 'ImageId'                 then @item[:image_id]                  = @text
        when 'KernelId'                then @item[:kernel_id]                 = @text
        when 'RamdiskId'               then @item[:ramdisk_id]                = @text
        when 'LaunchConfigurationName' then @item[:launch_configuration_name] = @text
        when 'UserData'                then @item[:user_data]                 = @text
        when 'NextToken'               then @result[:next_token]              = @text
        else
          case full_tag_name
          when %r{/BlockDeviceMappings/member} # no trailing $
            case name
            when 'DeviceName'          then @block_device_mapping[:device_name]  = @text
            when 'VirtualName'         then @block_device_mapping[:virtual_name] = @text
            when 'member'              then @item[:block_device_mappings]        << @block_device_mapping
            end
          when %r{member/SecurityGroups/member$} 
            @item[:security_groups] << @text
          when %r{/LaunchConfigurations/member$}
            @item[:security_groups].sort!
            @result[:launch_configurations] << @item
          end
        end
      end
      def reset
        @result = { :launch_configurations => []}
      end
    end

    #-----------------------------------------------------------------
    #      PARSERS: Triggers
    #-----------------------------------------------------------------

    class DescribeTriggersParser < RightAWSParser #:nodoc:
      def tagstart(name, attributes)
        case name
        when 'member'
          case @xmlpath
          when 'DescribeTriggersResponse/DescribeTriggersResult/Triggers'
            @item = { :dimensions => {} }
          when 'DescribeTriggersResponse/DescribeTriggersResult/Triggers/member/Dimensions'
            @dimension = {}
          end
        end
      end
      def tagend(name)
        case name
        when 'AutoScalingGroupName'      then @item[:auto_scaling_group_name]      = @text
        when 'MeasureName'               then @item[:measure_name]                 = @text
        when 'CreatedTime'               then @item[:created_time]                 = @text
        when 'BreachDuration'            then @item[:breach_duration]              = @text.to_i
        when 'UpperBreachScaleIncrement' then @item[:upper_breach_scale_increment] = @text.to_i
        when 'UpperThreshold'            then @item[:upper_threshold]              = @text.to_f
        when 'LowerThreshold'            then @item[:lower_threshold]              = @text.to_f
        when 'LowerBreachScaleIncrement' then @item[:lower_breach_scale_increment] = @text.to_i
        when 'Period'                    then @item[:period]                       = @text.to_i
        when 'Status'                    then @item[:status]                       = @text
        when 'TriggerName'               then @item[:trigger_name]                 = @text
        when 'Statistic'                 then @item[:statistic]                    = @text
        when 'Unit'                      then @item[:unit]                         = @text
        when 'Name'                      then @dimension[:name]                    = @text
        when 'Value'                     then @dimension[:value]                   = @text
        when 'member'
          case @xmlpath
          when "#@p/member/Dimensions" then @item[:dimensions][@dimension[:name]] = @dimension[:value]
          when @p                      then @result << @item
          end
        end
      end
      def reset
        @p      = 'DescribeTriggersResponse/DescribeTriggersResult/Triggers'
        @result = []
      end
    end
  end

end


================================================
FILE: lib/awsbase/benchmark_fix.rb
================================================
#
# Copyright (c) 2007-2008 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
#


# A hack because there's a bug in add! in Benchmark::Tms
module Benchmark  #:nodoc:
  class Tms #:nodoc:
    def add!(&blk)
      t = Benchmark::measure(&blk)
      @utime  = utime + t.utime
      @stime  = stime + t.stime
      @cutime = cutime + t.cutime
      @cstime = cstime + t.cstime
      @real   = real + t.real
      self
    end
  end
end


================================================
FILE: lib/awsbase/right_awsbase.rb
================================================
#
# Copyright (c) 2007-2008 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

# Test
module RightAws
  require 'digest/md5'
  
  class AwsUtils #:nodoc:
    @@digest1   = OpenSSL::Digest.new("sha1")
    @@digest256 = nil
    if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00908000
      @@digest256 = OpenSSL::Digest.new("sha256") rescue nil # Some installation may not support sha256
    end

    def self.utc_iso8601(time)
      if    time.is_a?(Fixnum) then time = Time::at(time)
      elsif time.is_a?(String) then time = Time::parse(time)
      end
      time.utc.strftime("%Y-%m-%dT%H:%M:%S.000Z")
    end
    
    def self.sign(aws_secret_access_key, auth_string)
      Base64.encode64(OpenSSL::HMAC.digest(@@digest1, aws_secret_access_key, auth_string)).strip
    end

    # Calculates 'Content-MD5' header value for some content
    def self.content_md5(content)
      Base64.encode64(Digest::MD5::new.update(content).digest).strip
    end

    # Escape a string accordingly Amazon rulles
    # http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?REST_RESTAuth.html
    def self.amz_escape(param)
      param = param.flatten.join('') if param.is_a?(Array) # ruby 1.9.x Array#to_s fix
      param.to_s.gsub(/([^a-zA-Z0-9._~-]+)/n) do
        '%' + $1.unpack('H2' * $1.size).join('%').upcase
      end
    end

    def self.xml_escape(text) # :nodoc:
      REXML::Text::normalize(text)
    end

    def self.xml_unescape(text) # :nodoc:
      REXML::Text::unnormalize(text)
    end

    # Set a timestamp and a signature version
    def self.fix_service_params(service_hash, signature)
      service_hash["Timestamp"] ||= utc_iso8601(Time.now) unless service_hash["Expires"]
      service_hash["SignatureVersion"] = signature
      service_hash
    end

    def self.fix_headers(headers)
      result = {}
      headers.each do |header, value|
        next if !header.is_a?(String) || value.nil?
        header = header.downcase
        result[header] = value if result[header].right_blank?
      end
      result
    end

    # Signature Version 0
    # A deprecated guy (should work till septemper 2009)
    def self.sign_request_v0(aws_secret_access_key, service_hash)
      fix_service_params(service_hash, '0')
      string_to_sign = "#{service_hash['Action']}#{service_hash['Timestamp'] || service_hash['Expires']}"
      service_hash['Signature'] = AwsUtils::sign(aws_secret_access_key, string_to_sign)
      service_hash.to_a.collect{|key,val| "#{amz_escape(key)}=#{amz_escape(val.to_s)}" }.join("&")
    end

    # Signature Version 1
    # Another deprecated guy (should work till septemper 2009)
    def self.sign_request_v1(aws_secret_access_key, service_hash)
      fix_service_params(service_hash, '1')
      string_to_sign = service_hash.sort{|a,b| (a[0].to_s.downcase)<=>(b[0].to_s.downcase)}.to_s
      service_hash['Signature'] = AwsUtils::sign(aws_secret_access_key, string_to_sign)
      service_hash.to_a.collect{|key,val| "#{amz_escape(key)}=#{amz_escape(val.to_s)}" }.join("&")
    end

    # Signature Version 2
    # EC2, SQS and SDB requests must be signed by this guy.
    # See:  http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/index.html?REST_RESTAuth.html
    #       http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1928
    def self.sign_request_v2(aws_secret_access_key, service_hash, http_verb, host, uri)
      fix_service_params(service_hash, '2')
      # select a signing method (make an old openssl working with sha1)
      # make 'HmacSHA256' to be a default one
      service_hash['SignatureMethod'] = 'HmacSHA256' unless ['HmacSHA256', 'HmacSHA1'].include?(service_hash['SignatureMethod'])
      service_hash['SignatureMethod'] = 'HmacSHA1'   unless @@digest256
      # select a digest
      digest = (service_hash['SignatureMethod'] == 'HmacSHA256' ? @@digest256 : @@digest1)
      # form string to sign
      canonical_string = service_hash.keys.sort.map do |key|
        "#{amz_escape(key)}=#{amz_escape(service_hash[key])}"
      end.join('&')
      string_to_sign = "#{http_verb.to_s.upcase}\n#{host.downcase}\n#{uri}\n#{canonical_string}"
      # sign the string
      signature      = amz_escape(Base64.encode64(OpenSSL::HMAC.digest(digest, aws_secret_access_key, string_to_sign)).strip)
      "#{canonical_string}&Signature=#{signature}"
    end

    # From Amazon's SQS Dev Guide, a brief description of how to escape:
    # "URL encode the computed signature and other query parameters as specified in 
    # RFC1738, section 2.2. In addition, because the + character is interpreted as a blank space 
    # by Sun Java classes that perform URL decoding, make sure to encode the + character 
    # although it is not required by RFC1738."
    # Avoid using CGI::escape to escape URIs. 
    # CGI::escape will escape characters in the protocol, host, and port
    # sections of the URI.  Only target chars in the query
    # string should be escaped.
    def self.URLencode(raw)
      e = URI.escape(raw)
      e.gsub(/\+/, "%2b")
    end
    
    def self.allow_only(allowed_keys, params)
      bogus_args = []
      params.keys.each {|p| bogus_args.push(p) unless allowed_keys.include?(p) }
      raise AwsError.new("The following arguments were given but are not legal for the function call #{caller_method}: #{bogus_args.inspect}") if bogus_args.length > 0
    end
    
    def self.mandatory_arguments(required_args, params)
      rargs = required_args.dup
      params.keys.each {|p| rargs.delete(p)}
      raise AwsError.new("The following mandatory arguments were not provided to #{caller_method}: #{rargs.inspect}") if rargs.length > 0
    end
    
    def self.caller_method
      caller[1]=~/`(.*?)'/
      $1
    end

    def self.split_items_and_params(array)
      items  = Array(array).flatten.compact
      params = items.last.kind_of?(Hash) ? items.pop : {}
      [items, params]
    end

    # Generates a token in format of:
    #  1. "1dd8d4e4-db6b-11df-b31d-0025b37efad0 (if UUID gem is loaded)
    #  2. "1287483761-855215-zSv2z-bWGj2-31M5t-ags9m" (if UUID gem is not loaded)
    TOKEN_GENERATOR_CHARSET = ('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a
    def self.generate_unique_token
      time  = Time.now
      token = "%d-%06d" % [time.to_i, time.usec]
      4.times do
        token << "-"
        5.times { token << TOKEN_GENERATOR_CHARSET[rand(TOKEN_GENERATOR_CHARSET.size)] }
      end
      token
    end
  end

  class AwsBenchmarkingBlock #:nodoc:
    attr_accessor :xml, :service
    def initialize
      # Benchmark::Tms instance for service (Ec2, S3, or SQS) access benchmarking.
      @service = Benchmark::Tms.new()
      # Benchmark::Tms instance for XML parsing benchmarking.
      @xml = Benchmark::Tms.new()
    end
  end

  class AwsNoChange < RuntimeError
  end
  
  class RightAwsBase

    # Amazon HTTP Error handling

    # Text, if found in an error message returned by AWS, indicates that this may be a transient
    # error. Transient errors are automatically retried with exponential back-off.
    AMAZON_PROBLEMS = [ 'internal service error', 
                        'is currently unavailable',
                        'no response from',
                        'Please try again',
                        'InternalError',
                        'Internal Server Error',
                        'ServiceUnavailable', #from SQS docs
                        'Unavailable',
                        'This application is not currently available',
                        'InsufficientInstanceCapacity'
                      ]
    @@amazon_problems = AMAZON_PROBLEMS
      # Returns a list of Amazon service responses which are known to be transient problems. 
      # We have to re-request if we get any of them, because the problem will probably disappear. 
      # By default this method returns the same value as the AMAZON_PROBLEMS const.
    def self.amazon_problems
      @@amazon_problems
    end
    
      # Sets the list of Amazon side problems.  Use in conjunction with the
      # getter to append problems.
    def self.amazon_problems=(problems_list)
      @@amazon_problems = problems_list
    end

    # Raise an exception if a timeout occures while an API call is in progress.
    # This helps to avoid a duplicate resources creation when Amazon hangs for some time and
    # RightHttpConnection is forced to use retries to get a response from it.
    #
    # If an API call action is in the list then no attempts to retry are performed.
    #
    RAISE_ON_TIMEOUT_ON_ACTIONS = %w{ 
      AllocateAddress
      CreateSnapshot
      CreateVolume
      PurchaseReservedInstancesOffering
      RequestSpotInstances
      RunInstances
    }
    @@raise_on_timeout_on_actions = RAISE_ON_TIMEOUT_ON_ACTIONS.dup

    def self.raise_on_timeout_on_actions
      @@raise_on_timeout_on_actions
    end

    def self.raise_on_timeout_on_actions=(actions_list)
      @@raise_on_timeout_on_actions = actions_list
    end

  end

  module RightAwsBaseInterface
    DEFAULT_SIGNATURE_VERSION = '2'
    
    @@caching = false
    def self.caching
      @@caching
    end
    def self.caching=(caching)
      @@caching = caching
    end

      # Current aws_access_key_id
    attr_reader :aws_access_key_id
      # Current aws_secret_access_key
    attr_reader :aws_secret_access_key
      # Last HTTP request object
    attr_reader :last_request
      # Last HTTP response object
    attr_reader :last_response
      # Last AWS errors list (used by AWSErrorHandler)
    attr_accessor :last_errors
      # Last AWS request id (used by AWSErrorHandler)
    attr_accessor :last_request_id
      # Logger object
    attr_accessor :logger
      # Initial params hash
    attr_accessor :params
      # RightHttpConnection instance
    attr_reader :connection
      # Cache
    attr_reader :cache
      # Signature version (all services except s3)
    attr_reader :signature_version

    def init(service_info, aws_access_key_id, aws_secret_access_key, params={}) #:nodoc:
      @params = params
      # If one defines EC2_URL he may forget to use a single slash as an "empty service" path.
      # Amazon does not like this therefore add this bad boy if he is missing...
      service_info[:default_service] = '/' if service_info[:default_service].right_blank?
      raise AwsError.new("AWS access keys are required to operate on #{service_info[:name]}") \
        if aws_access_key_id.right_blank? || aws_secret_access_key.right_blank?
      @aws_access_key_id     = aws_access_key_id
      @aws_secret_access_key = aws_secret_access_key
      # if the endpoint was explicitly defined - then use it
      if @params[:endpoint_url]
        uri = URI.parse(@params[:endpoint_url])
        @params[:server]   = uri.host
        @params[:port]     = uri.port
        @params[:service]  = uri.path
        @params[:protocol] = uri.scheme
        # make sure the 'service' path is not empty
        @params[:service]  = service_info[:default_service] if @params[:service].right_blank?
        @params[:region]   = nil
        default_port       = uri.default_port
      else
        @params[:server]   ||= service_info[:default_host]
        @params[:server]     = "#{@params[:region]}.#{@params[:server]}" if @params[:region]
        @params[:port]     ||= service_info[:default_port]
        @params[:service]  ||= service_info[:default_service]
        @params[:protocol] ||= service_info[:default_protocol]
        default_port         = @params[:protocol] == 'https' ? 443 : 80
      end
      # build a host name to sign
      @params[:host_to_sign]  = @params[:server].dup
      @params[:host_to_sign] << ":#{@params[:port]}" unless default_port == @params[:port].to_i
      # a set of options to be passed to RightHttpConnection object
      @params[:connection_options] = {} unless @params[:connection_options].is_a?(Hash) 
      @with_connection_options = {}
      @params[:connections] ||= :shared # || :dedicated
      @params[:max_connections] ||= 10
      @params[:connection_lifetime] ||= 20*60
      @params[:api_version]  ||= service_info[:default_api_version]
      @logger = @params[:logger]
      @logger = ::Rails.logger       if !@logger && defined?(::Rails) && ::Rails.respond_to?(:logger)
      @logger = RAILS_DEFAULT_LOGGER if !@logger && defined?(RAILS_DEFAULT_LOGGER)
      @logger = Logger.new(STDOUT)   if !@logger
      @logger.info "New #{self.class.name} using #{@params[:connections]} connections mode"
      @error_handler = nil
      @cache = {}
      @signature_version = (params[:signature_version] || DEFAULT_SIGNATURE_VERSION).to_s
    end

    def signed_service_params(aws_secret_access_key, service_hash, http_verb=nil, host=nil, service=nil )
      case signature_version.to_s
      when '0' then AwsUtils::sign_request_v0(aws_secret_access_key, service_hash)
      when '1' then AwsUtils::sign_request_v1(aws_secret_access_key, service_hash)
      when '2' then AwsUtils::sign_request_v2(aws_secret_access_key, service_hash, http_verb, host, service)
      else raise AwsError.new("Unknown signature version (#{signature_version.to_s}) requested")
      end
    end

    # Returns +true+ if the describe_xxx responses are being cached 
    def caching?
      @params.key?(:cache) ? @params[:cache] : @@caching
    end
    
    # Check if the aws function response hits the cache or not.
    # If the cache hits:
    # - raises an +AwsNoChange+ exception if +do_raise+ == +:raise+.
    # - returnes parsed response from the cache if it exists or +true+ otherwise.
    # If the cache miss or the caching is off then returns +false+.
    def cache_hits?(function, response, do_raise=:raise)
      result = false
      if caching?
        function = function.to_sym
        # get rid of requestId (this bad boy was added for API 2008-08-08+ and it is uniq for every response)
        # feb 04, 2009 (load balancer uses 'RequestId' hence use 'i' modifier to hit it also)
        response = response.sub(%r{<requestId>.+?</requestId>}i, '')
        # this should work for both ruby 1.8.x and 1.9.x
        response_md5 = Digest::MD5::new.update(response).to_s
        # check for changes
        unless @cache[function] && @cache[function][:response_md5] == response_md5
          # well, the response is new, reset cache data
          update_cache(function, {:response_md5 => response_md5, 
                                  :timestamp    => Time.now, 
                                  :hits         => 0, 
                                  :parsed       => nil})
        else
          # aha, cache hits, update the data and throw an exception if needed
          @cache[function][:hits] += 1
          if do_raise == :raise
            raise(AwsNoChange, "Cache hit: #{function} response has not changed since "+
                               "#{@cache[function][:timestamp].strftime('%Y-%m-%d %H:%M:%S')}, "+
                               "hits: #{@cache[function][:hits]}.")
          else
            result = @cache[function][:parsed] || true
          end
        end
      end
      result
    end
    
    def update_cache(function, hash)
      (@cache[function.to_sym] ||= {}).merge!(hash) if caching?
    end
    
    def on_exception(options={:raise=>true, :log=>true}) # :nodoc:
      raise if $!.is_a?(AwsNoChange)
      AwsError::on_aws_exception(self, options)
    end

    #----------------------------
    # HTTP Connections handling
    #----------------------------

    def get_server_url(request) # :nodoc:
      "#{request[:protocol]}://#{request[:server]}:#{request[:port]}"
    end

    def get_connections_storage(aws_service) # :nodoc:
      case @params[:connections].to_s
      when 'dedicated' then @connections_storage        ||= {}
      else                  Thread.current[aws_service] ||= {}
      end
    end

    def destroy_connection(request, reason) # :nodoc:
      connections = get_connections_storage(request[:aws_service])
      server_url  = get_server_url(request)
      if connections[server_url]
        connections[server_url][:connection].finish(reason)
        connections.delete(server_url)
      end
    end

    # Expire the connection if it has expired.
    def get_connection(request) # :nodoc:
      server_url         = get_server_url(request)
      connection_storage = get_connections_storage(request[:aws_service])
      life_time_scratch  = Time.now-@params[:connection_lifetime]
      # Delete out-of-dated connections
      connections_in_list = 0
      connection_storage.to_a.sort{|conn1, conn2| conn2[1][:last_used_at] <=> conn1[1][:last_used_at]}.each do |serv_url, conn_opts|
        if    @params[:max_connections] <= connections_in_list
          conn_opts[:connection].finish('out-of-limit')
          connection_storage.delete(server_url)
        elsif conn_opts[:last_used_at] < life_time_scratch
          conn_opts[:connection].finish('out-of-date')
          connection_storage.delete(server_url)
        else
          connections_in_list += 1
        end
      end
      connection = (connection_storage[server_url] ||= {})
      connection[:last_used_at] = Time.now
      connection[:connection] ||= Rightscale::HttpConnection.new(:exception => RightAws::AwsError, :logger => @logger)
    end

    #----------------------------
    # HTTP Requests handling
    #----------------------------

    # ACF, AMS, EC2, LBS and SDB uses this guy
    # SQS and S3 use their own methods
    def generate_request_impl(verb, action, options={}, custom_options={}) #:nodoc:
      # Form a valid http verb: 'GET' or 'POST' (all the other are not supported now)
      http_verb = verb.to_s.upcase
      # remove empty keys from request options
      options.delete_if { |key, value| value.nil? }
      # prepare service data
      service_hash = {"Action"         => action,
                      "AWSAccessKeyId" => @aws_access_key_id,
                      "Version"        => custom_options[:api_version] || @params[:api_version] }
      service_hash.merge!(options)
      service_hash["SecurityToken"] = @params[:token] if @params[:token]
      # Sign request options
      service_params = signed_service_params(@aws_secret_access_key, service_hash, http_verb, @params[:host_to_sign], @params[:service])
      # Use POST if the length of the query string is too large
      # see http://docs.amazonwebservices.com/AmazonSimpleDB/2007-11-07/DeveloperGuide/MakingRESTRequests.html
      if http_verb != 'POST' && service_params.size > 2000
        http_verb = 'POST'
        if signature_version == '2'
          service_params = signed_service_params(@aws_secret_access_key, service_hash, http_verb, @params[:host_to_sign], @params[:service])
        end
      end
      # create a request
      case http_verb
      when 'GET'
        request = Net::HTTP::Get.new("#{@params[:service]}?#{service_params}")
      when 'POST'
        request      = Net::HTTP::Post.new(@params[:service])
        request.body = service_params
        request['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8'
      else
        raise "Unsupported HTTP verb #{verb.inspect}!"
      end
      # prepare output hash
      request_hash = { :request  => request,
                       :server   => @params[:server],
                       :port     => @params[:port],
                       :protocol => @params[:protocol] }
      request_hash.merge!(@params[:connection_options])
      request_hash.merge!(@with_connection_options)
      
      # If an action is marked as "non-retryable" and there was no :raise_on_timeout option set
      # explicitly then do set that option
      if Array(RightAwsBase::raise_on_timeout_on_actions).include?(action) && !request_hash.has_key?(:raise_on_timeout)
        request_hash.merge!(:raise_on_timeout => true)
      end

      request_hash
    end

    # All services uses this guy.
    def request_info_impl(aws_service, benchblock, request, parser, &block) #:nodoc:
      request[:aws_service] = aws_service
      @connection    = get_connection(request)
      @last_request  = request[:request]
      @last_response = nil
      response = nil
      blockexception = nil

      if(block != nil)
        # TRB 9/17/07 Careful - because we are passing in blocks, we get a situation where
        # an exception may get thrown in the block body (which is high-level
        # code either here or in the application) but gets caught in the
        # low-level code of HttpConnection.  The solution is not to let any
        # exception escape the block that we pass to HttpConnection::request.
        # Exceptions can originate from code directly in the block, or from user
        # code called in the other block which is passed to response.read_body.
        benchblock.service.add! do
          begin
            responsehdr = @connection.request(request) do |response|
            #########
              begin
                @last_response = response
                if response.is_a?(Net::HTTPSuccess)
                  @error_handler = nil
                  response.read_body(&block)
                else
                  @error_handler = AWSErrorHandler.new(self, parser, :errors_list => self.class.amazon_problems) unless @error_handler
                  check_result   = @error_handler.check(request)
                  if check_result
                    @error_handler = nil
                    return check_result
                  end
                  raise AwsError.new(@last_errors, @last_response.code, @last_request_id)
                end
              rescue Exception => e
                blockexception = e
              end
            end
          rescue Exception => e
            # Kill a connection if we run into a low level connection error
            destroy_connection(request, "error: #{e.message}")
            raise e
          end
          #########

          #OK, now we are out of the block passed to the lower level
          if(blockexception)
            raise blockexception
          end
          benchblock.xml.add! do
            parser.parse(responsehdr)
          end
          return parser.result
        end
      else
        benchblock.service.add! do
          begin
            response = @connection.request(request)
          rescue Exception => e
            # Kill a connection if we run into a low level connection error
            destroy_connection(request, "error: #{e.message}")
            raise e
          end
        end
          # check response for errors...
        @last_response = response
        if response.is_a?(Net::HTTPSuccess)
          @error_handler = nil
          benchblock.xml.add! { parser.parse(response) }
          return parser.result
        else
          @error_handler = AWSErrorHandler.new(self, parser, :errors_list => self.class.amazon_problems) unless @error_handler
          check_result   = @error_handler.check(request)
          if check_result
            @error_handler = nil
            return check_result 
          end
          raise AwsError.new(@last_errors, @last_response.code, @last_request_id)
        end
      end
    rescue
      @error_handler = nil
      raise
    end

    def request_cache_or_info(method, link, parser_class, benchblock, use_cache=true, &block) #:nodoc:
      # We do not want to break the logic of parsing hence will use a dummy parser to process all the standard
      # steps (errors checking etc). The dummy parser does nothig - just returns back the params it received.
      # If the caching is enabled and hit then throw  AwsNoChange.
      # P.S. caching works for the whole images list only! (when the list param is blank)
      # check cache
      response, params = request_info(link, RightDummyParser.new)
      cache_hits?(method.to_sym, response.body) if use_cache
      parser = parser_class.new(:logger => @logger)
      benchblock.xml.add!{ parser.parse(response, params) }
      result = block ? block.call(parser) : parser.result
      # update parsed data
      update_cache(method.to_sym, :parsed => result) if use_cache
      result
    end

    # Returns Amazons request ID for the latest request
    def last_request_id
      @last_response && @last_response.body.to_s[%r{<requestId>(.+?)</requestId>}i] && $1
    end

    # Incrementally lists something.
    def incrementally_list_items(action, parser_class, params={}, &block) # :nodoc:
      params = params.dup
      params['MaxItems'] = params.delete(:max_items) if params[:max_items]
      params['Marker']   = params.delete(:marker)    if params[:marker]
      last_response = nil
      loop do
        last_response    = request_info( generate_request(action, params), parser_class.new(:logger => @logger))
        params['Marker'] = last_response[:marker]
        break unless block && block.call(last_response) && !last_response[:marker].right_blank?
      end
      last_response
    end

    # Format array of items into Amazons handy hash ('?' is a place holder):
    # Options:
    #   :default => "something"   : Set a value to "something" when it is nil
    #   :default => :skip_nils    : Skip nil values
    #
    #  amazonize_list('Item', ['a', 'b', 'c']) =>
    #    { 'Item.1' => 'a', 'Item.2' => 'b', 'Item.3' => 'c' }
    #
    #  amazonize_list('Item.?.instance', ['a', 'c']) #=>
    #    { 'Item.1.instance' => 'a', 'Item.2.instance' => 'c' }
    #
    #  amazonize_list(['Item.?.Name', 'Item.?.Value'], {'A' => 'a', 'B' => 'b'}) #=>
    #    { 'Item.1.Name' => 'A', 'Item.1.Value' => 'a',
    #      'Item.2.Name' => 'B', 'Item.2.Value' => 'b'  }
    #
    #  amazonize_list(['Item.?.Name', 'Item.?.Value'], [['A','a'], ['B','b']]) #=>
    #    { 'Item.1.Name' => 'A', 'Item.1.Value' => 'a',
    #      'Item.2.Name' => 'B', 'Item.2.Value' => 'b'  }
    #
    #  amazonize_list(['Filter.?.Key', 'Filter.?.Value.?'], {'A' => ['aa','ab'], 'B' => ['ba','bb']}) #=>
    #  amazonize_list(['Filter.?.Key', 'Filter.?.Value.?'], [['A',['aa','ab']], ['B',['ba','bb']]])   #=>
    #    {"Filter.1.Key"=>"A",
    #     "Filter.1.Value.1"=>"aa",
    #     "Filter.1.Value.2"=>"ab",
    #     "Filter.2.Key"=>"B",
    #     "Filter.2.Value.1"=>"ba",
    #     "Filter.2.Value.2"=>"bb"}
    def amazonize_list(masks, list, options={}) #:nodoc:
      groups = {}
      list_idx = options[:index] || 1
      Array(list).each do |list_item|
        Array(masks).each_with_index do |mask, mask_idx|
          key = mask[/\?/] ? mask.dup : mask.dup + '.?'
          key.sub!('?', list_idx.to_s)
          value = Array(list_item)[mask_idx]
          if value.is_a?(Array)
            groups.merge!(amazonize_list(key, value, options))
          else
            if value.nil?
              next if options[:default] == :skip_nils
              value = options[:default]
            end
            # Hack to avoid having unhandled '?' in keys : do replace them all with '1':
            #  bad:  ec2.amazonize_list(['Filter.?.Key', 'Filter.?.Value.?'], { a: => :b }) => {"Filter.1.Key"=>:a, "Filter.1.Value.?"=>1}
            #  good: ec2.amazonize_list(['Filter.?.Key', 'Filter.?.Value.?'], { a: => :b }) => {"Filter.1.Key"=>:a, "Filter.1.Value.1"=>1}
            key.gsub!('?', '1')
            groups[key] = value
          end
        end
        list_idx += 1
      end
      groups
    end

    BLOCK_DEVICE_KEY_MAPPING = {                                                           # :nodoc:
      :device_name               => 'DeviceName',
      :virtual_name              => 'VirtualName',
      :no_device                 => 'NoDevice',
      :ebs_snapshot_id           => 'Ebs.SnapshotId',
      :ebs_volume_size           => 'Ebs.VolumeSize',
      :ebs_delete_on_termination => 'Ebs.DeleteOnTermination' }

    def amazonize_block_device_mappings(block_device_mappings, key = 'BlockDeviceMapping') # :nodoc:
      result = {}
      unless block_device_mappings.right_blank?
        block_device_mappings = [block_device_mappings] unless block_device_mappings.is_a?(Array)
        block_device_mappings.each_with_index do |b, idx|
          BLOCK_DEVICE_KEY_MAPPING.each do |local_name, remote_name|
            value = b[local_name]
            case local_name
            when :no_device then value = value ? '' : nil   # allow to pass :no_device as boolean
            end
            result["#{key}.#{idx+1}.#{remote_name}"] = value unless value.nil?
          end
        end
      end
      result
    end

    # Build API request keys set.
    #
    # Options is a hash, expectations is a set of keys [and rules] how to represent options.
    # Mappings is an Array (may include hashes) or a Hash.
    #
    #  Example:
    #
    #  options = { :valid_from              => Time.now - 10,
    #              :instance_count          => 3,
    #              :image_id                => 'ami-08f41161',
    #              :spot_price              => 0.059,
    #              :instance_type           => 'c1.medium',
    #              :instance_count          => 1,
    #              :key_name                => 'tim',
    #              :availability_zone       => 'us-east-1a',
    #              :monitoring_enabled      => true,
    #              :launch_group            => 'lg1',
    #              :availability_zone_group => 'azg1',
    #              :groups                  => ['a', 'b', 'c'],
    #              :group_ids               => 'sg-1',
    #              :user_data               => 'konstantin',
    #              :block_device_mappings   => [ { :device_name     => '/dev/sdk',
    #                                              :ebs_snapshot_id => 'snap-145cbc7d',
    #                                              :ebs_delete_on_termination => true,
    #                                              :ebs_volume_size => 3,
    #                                              :virtual_name => 'ephemeral2' }]}
    #  mappings = { :spot_price,
    #               :availability_zone_group,
    #               :launch_group,
    #               :type,
    #               :instance_count,
    #               :image_id              => 'LaunchSpecification.ImageId',
    #               :instance_type         => 'LaunchSpecification.InstanceType',
    #               :key_name              => 'LaunchSpecification.KeyName',
    #               :addressing_type       => 'LaunchSpecification.AddressingType',
    #               :kernel_id             => 'LaunchSpecification.KernelId',
    #               :ramdisk_id            => 'LaunchSpecification.RamdiskId',
    #               :subnet_id             => 'LaunchSpecification.SubnetId',
    #               :availability_zone     => 'LaunchSpecification.Placement.AvailabilityZone',
    #               :monitoring_enabled    => 'LaunchSpecification.Monitoring.Enabled',
    #               :valid_from            => { :value => Proc.new { !options[:valid_from].right_blank?  && AwsUtils::utc_iso8601(options[:valid_from]) }},
    #               :valid_until           => { :value => Proc.new { !options[:valid_until].right_blank? && AwsUtils::utc_iso8601(options[:valid_until]) }},
    #               :user_data             => { :name  => 'LaunchSpecification.UserData',
    #                                           :value => Proc.new { !options[:user_data].right_blank? && Base64.encode64(options[:user_data]).delete("\n") }},
    #               :groups                => { :amazonize_list => 'LaunchSpecification.SecurityGroup'},
    #               :group_ids             => { :amazonize_list => 'LaunchSpecification.SecurityGroupId'},
    #               :block_device_mappings => { :amazonize_bdm  => 'LaunchSpecification.BlockDeviceMapping'})
    #
    #  map_api_keys_and_values( options, mappings) #=>
    #    {"LaunchSpecification.BlockDeviceMapping.1.Ebs.DeleteOnTermination" => true,
    #     "LaunchSpecification.BlockDeviceMapping.1.VirtualName"             => "ephemeral2",
    #     "LaunchSpecification.BlockDeviceMapping.1.Ebs.VolumeSize"          => 3,
    #     "LaunchSpecification.BlockDeviceMapping.1.Ebs.SnapshotId"          => "snap-145cbc7d",
    #     "LaunchSpecification.BlockDeviceMapping.1.DeviceName"              => "/dev/sdk",
    #     "LaunchSpecification.SecurityGroupId.1"                            => "sg-1",
    #     "LaunchSpecification.InstanceType"                                 => "c1.medium",
    #     "LaunchSpecification.KeyName"                                      => "tim",
    #     "LaunchSpecification.ImageId"                                      => "ami-08f41161",
    #     "LaunchSpecification.SecurityGroup.1"                              => "a",
    #     "LaunchSpecification.SecurityGroup.2"                              => "b",
    #     "LaunchSpecification.SecurityGroup.3"                              => "c",
    #     "LaunchSpecification.Placement.AvailabilityZone"                   => "us-east-1a",
    #     "LaunchSpecification.Monitoring.Enabled"                           => true,
    #     "LaunchGroup"                                                      => "lg1",
    #     "InstanceCount"                                                    => 1,
    #     "SpotPrice"                                                        => 0.059,
    #     "AvailabilityZoneGroup"                                            => "azg1",
    #     "ValidFrom"                                                        => "2011-06-30T08:06:30.000Z",
    #     "LaunchSpecification.UserData"                                     => "a29uc3RhbnRpbg=="}
    #
    def map_api_keys_and_values(options, *mappings) # :nodoc:
      result = {}
      vars   = {}
      # Fix inputs and make them all to be hashes
      mappings.flatten.each do |mapping|
        unless mapping.is_a?(Hash)
          # mapping is just a :key_name
          mapping = { mapping => { :name  => mapping.to_s.right_camelize, :value => options[mapping] }}
        else
          mapping.each do |local_key, api_opts|
            unless api_opts.is_a?(Hash)
              # mapping is a { :key_name => 'ApiKeyName' }
              mapping[local_key] = { :name  => api_opts.to_s, :value => options[local_key]}
            else
              # mapping is a { :key_name => { :name => 'ApiKeyName', :value => 'Value', ... etc}  }
              api_opts[:name]  = local_key.to_s.right_camelize if (api_opts.keys & [:name, :amazonize_list, :amazonize_bdm]).right_blank?
              api_opts[:value] = options[local_key] unless api_opts.has_key?(:value)
            end
          end
        end
        vars.merge! mapping
      end
      # Build API keys set
      #  vars now is a Hash:
      #    { :key1 => { :name           => 'ApiKey1',   :value => 'BlahBlah'},
      #      :key2 => { :amazonize_list => 'ApiKey2.?', :value => [1, ...] },
      #      :key3 => { :amazonize_bdm  => 'BDM',       :value => [{..}, ...] }, ... }
      #
      vars.each do |local_key, api_opts|
        if api_opts[:amazonize_list]
          result.merge!(amazonize_list( api_opts[:amazonize_list], api_opts[:value] )) unless api_opts[:value].right_blank?
        elsif api_opts[:amazonize_bdm]
          result.merge!(amazonize_block_device_mappings( api_opts[:value], api_opts[:amazonize_bdm] )) unless api_opts[:value].right_blank?
        else
          api_key = api_opts[:name]
          value   = api_opts[:value]
          value   = value.call if value.is_a?(Proc)
          next if value.right_blank?
          result[api_key] = value
        end
      end
      #
      result
    end

    # Transform a hash of parameters into a hash suitable for sending
    # to Amazon using a key mapping.
    #
    #  amazonize_hash_with_key_mapping('Group.Filter',
    #    {:some_param => 'SomeParam'},
    #    {:some_param => 'value'}) #=> {'Group.Filter.SomeParam' => 'value'}
    #
    def amazonize_hash_with_key_mapping(key, mapping, hash, options={})
      result = {}
      unless hash.right_blank?
        mapping.each do |local_name, remote_name|
          value = hash[local_name]
          next if value.nil?
          result["#{key}.#{remote_name}"] = value
        end
      end
      result
    end

    # Transform a list of hashes of parameters into a hash suitable for sending
    # to Amazon using a key mapping.
    #
    #  amazonize_list_with_key_mapping('Group.Filter',
    #    [{:some_param => 'SomeParam'}, {:some_param => 'SomeParam'}],
    #    {:some_param => 'value'}) #=>
    #      {'Group.Filter.1.SomeParam' => 'value',
    #       'Group.Filter.2.SomeParam' => 'value'}
    #
    def amazonize_list_with_key_mapping(key, mapping, list, options={})
      result = {}
      unless list.right_blank?
        list.each_with_index do |item, index|
          mapping.each do |local_name, remote_name|
            value = item[local_name]
            next if value.nil?
            result["#{key}.#{index+1}.#{remote_name}"] = value
          end
        end
      end
    end
    
    # Execute a block of code with custom set of settings for right_http_connection.
    # Accepts next options (see Rightscale::HttpConnection for explanation):
    #  :raise_on_timeout
    #  :http_connection_retry_count
    #  :http_connection_open_timeout
    #  :http_connection_read_timeout
    #  :http_connection_retry_delay
    #  :user_agent
    #  :exception
    #
    #  Example #1:
    #
    #  # Try to create a snapshot but stop with exception if timeout is received
    #  # to avoid having a duplicate API calls that create duplicate snapshots.
    #  ec2 = Rightscale::Ec2::new(aws_access_key_id, aws_secret_access_key)
    #  ec2.with_connection_options(:raise_on_timeout => true) do
    #    ec2.create_snapshot('vol-898a6fe0', 'KD: WooHoo!!')
    #  end
    #
    #  Example #2:
    #
    #  # Opposite case when the setting is global:
    #  @ec2 = Rightscale::Ec2::new(aws_access_key_id, aws_secret_access_key,
    #                           :connection_options => { :raise_on_timeout => true })
    #  # Create an SSHKey but do tries on timeout
    #  ec2.with_connection_options(:raise_on_timeout => false) do
    #    new_key = ec2.create_key_pair('my_test_key')
    #  end
    #
    #  Example #3:
    #
    #  # Global settings (HttpConnection level):
    #  Rightscale::HttpConnection::params[:http_connection_open_timeout] = 5
    #  Rightscale::HttpConnection::params[:http_connection_read_timeout] = 250
    #  Rightscale::HttpConnection::params[:http_connection_retry_count]  = 2
    #
    #  # Local setings (RightAws level)
    #  ec2 = Rightscale::Ec2::new(AWS_ID, AWS_KEY,
    #    :region => 'us-east-1',
    #    :connection_options => {
    #      :http_connection_read_timeout => 2,
    #      :http_connection_retry_count  => 5,
    #      :user_agent => 'Mozilla 4.0'
    #    })
    #
    #  # Custom settings (API call level)
    #  ec2.with_connection_options(:raise_on_timeout => true,
    #                              :http_connection_read_timeout => 10,
    #                              :user_agent => '') do
    #    pp ec2.describe_images
    #  end
    #
    def with_connection_options(options, &block)
      @with_connection_options = options
      block.call self
    ensure
      @with_connection_options = {}
    end
  end


  # Exception class to signal any Amazon errors. All errors occuring during calls to Amazon's
  # web services raise this type of error.
  # Attribute inherited by RuntimeError:
  #  message    - the text of the error, generally as returned by AWS in its XML response.
  class AwsError < RuntimeError
    
    # either an array of errors where each item is itself an array of [code, message]),
    # or an error string if the error was raised manually, as in <tt>AwsError.new('err_text')</tt>
    attr_reader :errors
    
    # Request id (if exists)
    attr_reader :request_id
    
    # Response HTTP error code
    attr_reader :http_code
    
    def initialize(errors=nil, http_code=nil, request_id=nil)
      @errors      = errors
      @request_id  = request_id
      @http_code   = http_code
      super(@errors.is_a?(Array) ? @errors.map{|code, msg| "#{code}: #{msg}"}.join("; ") : @errors.to_s)
    end
    
    # Does any of the error messages include the regexp +pattern+?
    # Used to determine whether to retry request.
    def include?(pattern)
      if @errors.is_a?(Array)
        @errors.each{ |code, msg| return true if code =~ pattern } 
      else
        return true if @errors_str =~ pattern 
      end
      false
    end
    
    # Generic handler for AwsErrors. +aws+ is the RightAws::S3, RightAws::EC2, or RightAws::SQS
    # object that caused the exception (it must provide last_request and last_response). Supported
    # boolean options are:
    # * <tt>:log</tt> print a message into the log using aws.logger to access the Logger
    # * <tt>:puts</tt> do a "puts" of the error
    # * <tt>:raise</tt> re-raise the error after logging
    def self.on_aws_exception(aws, options={:raise=>true, :log=>true})
 	    # Only log & notify if not user error
      if !options[:raise] || system_error?($!)
        error_text = "#{$!.inspect}\n#{$@}.join('\n')}"
        puts error_text if options[:puts]
          # Log the error
        if options[:log]
          request  = aws.last_request  ? aws.last_request.path :  '-none-'
          response = aws.last_response ? "#{aws.last_response.code} -- #{aws.last_response.message} -- #{aws.last_response.body}" : '-none-'
          aws.logger.error error_text
          aws.logger.error "Request was:  #{request}"
          aws.logger.error "Response was: #{response}"
        end
      end
      raise if options[:raise]  # re-raise an exception
      return nil
    end
    
    # True if e is an AWS system error, i.e. something that is for sure not the caller's fault.
    # Used to force logging.
    def self.system_error?(e)
 	    !e.is_a?(self) || e.message =~ /InternalError|InsufficientInstanceCapacity|Unavailable/
    end

  end


  class AWSErrorHandler
    # 0-100 (%) 
    DEFAULT_CLOSE_ON_4XX_PROBABILITY = 10     
    
    @@reiteration_start_delay = 0.2
    def self.reiteration_start_delay
      @@reiteration_start_delay
    end
    def self.reiteration_start_delay=(reiteration_start_delay)
      @@reiteration_start_delay = reiteration_start_delay
    end

    @@reiteration_time = 5
    def self.reiteration_time
      @@reiteration_time
    end
    def self.reiteration_time=(reiteration_time)
      @@reiteration_time = reiteration_time
    end
    
    @@close_on_error = true 
    def self.close_on_error 
      @@close_on_error 
    end 
    def self.close_on_error=(close_on_error) 
      @@close_on_error = close_on_error 
    end 
 
    @@close_on_4xx_probability = DEFAULT_CLOSE_ON_4XX_PROBABILITY 
    def self.close_on_4xx_probability 
      @@close_on_4xx_probability 
    end 
    def self.close_on_4xx_probability=(close_on_4xx_probability) 
      @@close_on_4xx_probability = close_on_4xx_probability 
    end 
 
    # params: 
    #  :reiteration_time 
    #  :errors_list 
    #  :close_on_error           = true | false 
    #  :close_on_4xx_probability = 1-100 
    def initialize(aws, parser, params={}) #:nodoc:     
      @aws           = aws              # Link to RightEc2 | RightSqs | RightS3 instance
      @parser        = parser           # parser to parse Amazon response
      @started_at    = Time.now
      @stop_at       = @started_at  + (params[:reiteration_time] || @@reiteration_time) 
      @errors_list   = params[:errors_list] || [] 
      @reiteration_delay = @@reiteration_start_delay
      @retries       = 0
      # close current HTTP(S) connection on 5xx, errors from list and 4xx errors 
      @close_on_error           = params[:close_on_error].nil? ? @@close_on_error : params[:close_on_error]
      @close_on_4xx_probability = params[:close_on_4xx_probability] || @@close_on_4xx_probability       
    end
    
      # Returns false if 
    def check(request)  #:nodoc:
      result           = false
      error_found      = false
      redirect_detected= false
      error_match      = nil
      last_errors_text = ''
      response         = @aws.last_response
      # log error
      request_text_data = "#{request[:protocol]}://#{request[:server]}:#{request[:port]}#{request[:request].path}"
      # is this a redirect?
      # yes!
      if response.is_a?(Net::HTTPRedirection)
        redirect_detected = true 
      else
        # no, it's an error ...
        @aws.logger.warn("##### #{@aws.class.name} returned an error: #{response.code} #{response.message}\n#{response.body} #####")
        @aws.logger.warn("##### #{@aws.class.name} request: #{request_text_data} ####")
      end

      # Extract error/redirection message from the response body
      # Amazon claims that a redirection must have a body but somethimes it is nil....
      if response.body && response.body[/^(<\?xml|<ErrorResponse)/]
        error_parser = RightErrorResponseParser.new
        @aws.class.bench_xml.add! do
          error_parser.parse(response.body)
        end
        @aws.last_errors     = error_parser.errors
        @aws.last_request_id = error_parser.requestID
        last_errors_text     = @aws.last_errors.flatten.join("\n")
      else
        @aws.last_errors     = [[response.code, "#{response.message} (#{request_text_data})"]]
        @aws.last_request_id = '-undefined-'
        last_errors_text     = response.message
      end
      
      # Ok, it is a redirect, find the new destination location
      if redirect_detected
        location = response['location']
        # As for 301 ( Moved Permanently) Amazon does not return a 'Location' header but
        # it is possible to extract a new endpoint from the response body
        if location.right_blank? && response.code=='301' && response.body
          new_endpoint = response.body[/<Endpoint>(.*?)<\/Endpoint>/] && $1
          location     = "#{request[:protocol]}://#{new_endpoint}:#{request[:port]}#{request[:request].path}"
        end
        # ... log information and ...
        @aws.logger.info("##### #{@aws.class.name} redirect requested: #{response.code} #{response.message} #####")
        @aws.logger.info("      Old location: #{request_text_data}")
        @aws.logger.info("      New location: #{location}")
        @aws.logger.info("      Request Verb: #{request[:request].class.name}")
        # ... fix the connection data
        request[:server]   = URI.parse(location).host
        request[:protocol] = URI.parse(location).scheme
        request[:port]     = URI.parse(location).port
      else
        # Not a redirect but an error: try to find the error in our list
        @errors_list.each do |error_to_find|
          if last_errors_text[/#{error_to_find}/i]
            error_found = true
            error_match = error_to_find
            @aws.logger.warn("##### Retry is needed, error pattern match: #{error_to_find} #####")
            break
          end
        end
      end
      
        # check the time has gone from the first error come
      if redirect_detected || error_found
        # Close the connection to the server and recreate a new one. 
        # It may have a chance that one server is a semi-down and reconnection 
        # will help us to connect to the other server 
        if !redirect_detected && @close_on_error
          @aws.destroy_connection(request, "#{self.class.name}: error match to pattern '#{error_match}'")
        end 
                 
        if (Time.now < @stop_at)
          @retries += 1
          unless redirect_detected
            @aws.logger.warn("##### Retry ##{@retries} is being performed. Sleeping for #{@reiteration_delay} sec. Whole time: #{Time.now-@started_at} sec ####")
            sleep @reiteration_delay 
            @reiteration_delay *= 2

          else
            @aws.logger.info("##### Retry ##{@retries} is being performed due to a redirect.  ####")
          end

          # Always make sure that the fp is set to point to the beginning(?)
          # of the File/IO. TODO: it assumes that offset is 0, which is bad.
          if(request[:request].body_stream && request[:request].body_stream.respond_to?(:pos))
            begin
              request[:request].body_stream.pos = 0
            rescue Exception => e
              @logger.warn("Retry may fail due to unable to reset the file pointer" +
                           " -- #{self.class.name} : #{e.inspect}")
            end
          end

          result = @aws.request_info(request, @parser)
        else
          @aws.logger.warn("##### Ooops, time is over... ####")
        end 
      # aha, this is unhandled error: 
      elsif @close_on_error 
        # On 5xx(Server errors), 403(RequestTimeTooSkewed) and 408(Request Timeout) a conection has to be closed
        if @aws.last_response.code.to_s[/^(5\d\d|403|408)$/]
          @aws.destroy_connection(request, "#{self.class.name}: code: #{@aws.last_response.code}: '#{@aws.last_response.message}'")
        # Is this a 4xx error ? 
        elsif @aws.last_response.code.to_s[/^4\d\d$/] && @close_on_4xx_probability > rand(100) 
          @aws.destroy_connection(request, "#{self.class.name}: code: #{@aws.last_response.code}: '#{@aws.last_response.message}', " +
                                           "probability: #{@close_on_4xx_probability}%")
        end
      end
      result
    end
    
  end


  #-----------------------------------------------------------------

  class RightSaxParserCallbackTemplate #:nodoc:
    def initialize(right_aws_parser) 
      @right_aws_parser = right_aws_parser 
    end 
    def on_characters(chars) 
      @right_aws_parser.text(chars)
    end 
    def on_start_document; end 
    def on_comment(msg); end 
    def on_processing_instruction(target, data); end 
    def on_cdata_block(cdata); end 
    def on_end_document; end 
  end 

  class RightSaxParserCallback < RightSaxParserCallbackTemplate
    def self.include_callback
      include XML::SaxParser::Callbacks
    end
    def on_start_element(name, attr_hash)
      @right_aws_parser.tag_start(name, attr_hash)
    end
    def on_end_element(name)
      @right_aws_parser.tag_end(name)
    end
  end

  class RightSaxParserCallbackNs < RightSaxParserCallbackTemplate
    def on_start_element_ns(name, attr_hash, prefix, uri, namespaces)
      @right_aws_parser.tag_start(name, attr_hash)
    end
    def on_end_element_ns(name, prefix, uri)
      @right_aws_parser.tag_end(name)
    end
  end

  class RightAWSParser  #:nodoc:
      # default parsing library 
    DEFAULT_XML_LIBRARY = 'rexml' 
      # a list of supported parsers 
    @@supported_xml_libs = [DEFAULT_XML_LIBRARY, 'libxml'] 
     
    @@xml_lib = DEFAULT_XML_LIBRARY # xml library name: 'rexml' | 'libxml' 
    def self.xml_lib
      @@xml_lib
    end
    def self.xml_lib=(new_lib_name)
      @@xml_lib = new_lib_name
    end
    
    attr_accessor :result
    attr_reader   :xmlpath
    attr_accessor :xml_lib
    attr_reader   :full_tag_name
    attr_reader   :tag
    
    def initialize(params={})
      @xmlpath = ''
      @full_tag_name = ''
      @result  = false
      @text    = ''
      @tag     = ''
      @xml_lib = params[:xml_lib] || @@xml_lib
      @logger  = params[:logger]
      reset
    end
    def tag_start(name, attributes)
      @text = ''
      @tag  = name
      @full_tag_name += @full_tag_name.empty? ? name : "/#{name}"
      tagstart(name, attributes)
      @xmlpath = @full_tag_name
    end
    def tag_end(name)
      @xmlpath = @full_tag_name[/^(.*?)\/?#{name}$/] && $1
      tagend(name)
      @full_tag_name = @xmlpath
    end
    def text(text)
      @text += text
      tagtext(text)
    end
      # Parser method.
      # Params:
      #   xml_text         - xml message text(String) or Net:HTTPxxx instance (response)
      #   params[:xml_lib] - library name: 'rexml' | 'libxml'
    def parse(xml_text, params={})
        # Get response body
      xml_text = xml_text.body unless xml_text.is_a?(String)
      @xml_lib = params[:xml_lib] || @xml_lib
        # check that we had no problems with this library otherwise use default 
      @xml_lib = DEFAULT_XML_LIBRARY unless @@supported_xml_libs.include?(@xml_lib)       
        # load xml library
      if @xml_lib=='libxml' && !defined?(XML::SaxParser)
        begin
          require 'xml/libxml'
          # Setup SaxParserCallback 
          if XML::Parser::VERSION >= '0.5.1' &&
             XML::Parser::VERSION  < '0.9.7'
            RightSaxParserCallback.include_callback
          end           
        rescue LoadError => e
          @@supported_xml_libs.delete(@xml_lib)
          @xml_lib = DEFAULT_XML_LIBRARY
          if @logger
            @logger.error e.inspect
            @logger.error e.backtrace
            @logger.info "Can not load 'libxml' library. '#{DEFAULT_XML_LIBRARY}' is used for parsing."
          end
        end
      end
        # Parse the xml text
      case @xml_lib
      when 'libxml'
        if XML::Parser::VERSION >= '0.9.9'
          # avoid warning on every usage
          xml        = XML::SaxParser.string(xml_text)
        else
          xml        = XML::SaxParser.new
          xml.string = xml_text 
        end
        # check libxml-ruby version 
        if    XML::Parser::VERSION >= '0.9.7'
          xml.callbacks = RightSaxParserCallbackNs.new(self)
        elsif XML::Parser::VERSION >= '0.5.1'
          xml.callbacks = RightSaxParserCallback.new(self) 
        else 
          xml.on_start_element{|name, attr_hash| self.tag_start(name, attr_hash)} 
          xml.on_characters{   |text|            self.text(text)}
          xml.on_end_element{  |name|            self.tag_end(name)} 
        end 
        xml.parse
      else
        REXML::Document.parse_stream(xml_text, self)
      end
    end
      # Parser must have a lots of methods 
      # (see /usr/lib/ruby/1.8/rexml/parsers/streamparser.rb)
      # We dont need most of them in RightAWSParser and method_missing helps us
      # to skip their definition
    def method_missing(method, *params)
        # if the method is one of known - just skip it ...
      return if [:comment, :attlistdecl, :notationdecl, :elementdecl, 
                 :entitydecl, :cdata, :xmldecl, :attlistdecl, :instruction, 
                 :doctype].include?(method)
        # ... else - call super to raise an exception
      super(method, params)
    end
      # the functions to be overriden by children (if nessesery)
    def reset                     ; end
    def tagstart(name, attributes); end
    def tagend(name)              ; end
    def tagtext(text)             ; end
  end

  #-----------------------------------------------------------------
  #      PARSERS: Errors
  #-----------------------------------------------------------------

#<Error>
#  <Code>TemporaryRedirect</Code>
#  <Message>Please re-send this request to the specified temporary endpoint. Continue to use the original request endpoint for future requests.</Message>
#  <RequestId>FD8D5026D1C5ABA3</RequestId>
#  <Endpoint>bucket-for-k.s3-external-3.amazonaws.com</Endpoint>
#  <HostId>ItJy8xPFPli1fq/JR3DzQd3iDvFCRqi1LTRmunEdM1Uf6ZtW2r2kfGPWhRE1vtaU</HostId>
#  <Bucket>bucket-for-k</Bucket>
#</Error>

  class RightErrorResponseParser < RightAWSParser #:nodoc:
    attr_accessor :errors  # array of hashes: error/message
    attr_accessor :requestID
#    attr_accessor :endpoint, :host_id, :bucket
    def tagend(name)
      case name
        when 'RequestID' ; @requestID = @text
        when 'Code'      ; @code      = @text
        when 'Message'   ; @message   = @text
#       when 'Endpoint'  ; @endpoint  = @text
#       when 'HostId'    ; @host_id   = @text
#       when 'Bucket'    ; @bucket    = @text
        when 'Error'     ; @errors   << [ @code, @message ]
      end
    end
    def reset
      @errors = []
    end
  end

  # Dummy parser - does nothing
  # Returns the original params back
  class RightDummyParser  # :nodoc:
    attr_accessor :result
    def parse(response, params={})
      @result = [response, params]
    end
  end

  class RightHttp2xxParser < RightAWSParser # :nodoc:
    def parse(response)
      @result = response.is_a?(Net::HTTPSuccess)
    end
  end

  class RightBoolResponseParser < RightAWSParser #:nodoc:
    def tagend(name)
      @result = (@text=='true') if name == 'return'
    end
  end

end



================================================
FILE: lib/awsbase/support.rb
================================================
  # These are ActiveSupport-;like extensions to do a few handy things in the gems
  # Derived from ActiveSupport, so the AS copyright notice applies:
  #
  #
  #
  # Copyright (c) 2005 David Heinemeier Hansson
  #
  # Permission is hereby granted, free of charge, to any person obtaining
  # a copy of this software and associated documentation files (the
  # "Software"), to deal in the Software without restriction, including
  # without limitation the rights to use, copy, modify, merge, publish,
  # distribute, sublicense, and/or sell copies of the Software, and to
  # permit persons to whom the Software is furnished to do so, subject to
  # the following conditions:
  #
  # The above copyright notice and this permission notice shall be
  # included in all copies or substantial portions of the Software.
  #
  # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  #++
  #
  #
  class String #:nodoc:

    def right_underscore
      self.gsub(/[A-Z]/){|match| "#{$`=='' ? '' : '_'}#{match.downcase}" }
    end
    
  end


================================================
FILE: lib/awsbase/version.rb
================================================
module RightAws #:nodoc:
  module VERSION #:nodoc:
    MAJOR = 3  unless defined?(MAJOR)
    MINOR = 1  unless defined?(MINOR)
    TINY  = 0  unless defined?(TINY)

    STRING = [MAJOR, MINOR, TINY].join('.') unless defined?(STRING)
  end
end


================================================
FILE: lib/ec2/right_ec2.rb
================================================
#
# Copyright (c) 2007-2009 RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#

module RightAws

  # = RightAWS::EC2 -- RightScale Amazon EC2 interface
  # The RightAws::EC2 class provides a complete interface to Amazon's
  # Elastic Compute Cloud service, as well as the associated EBS (Elastic Block
  # Store).
  # For explanations of the semantics
  # of each call, please refer to Amazon's documentation at
  # http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=87
  #
  # Examples:
  #
  # Create an EC2 interface handle:
  #   
  #   @ec2   = RightAws::Ec2.new(aws_access_key_id,
  #                               aws_secret_access_key)
  # Create a new SSH key pair:
  #  @key   = 'right_ec2_awesome_test_key'
  #  new_key = @ec2.create_key_pair(@key)
  #  keys = @ec2.describe_key_pairs
  #
  # Create a security group:
  #  @group = 'right_ec2_awesome_test_security_group'
  #  @ec2.create_security_group(@group,'My awesome test group')
  #  group = @ec2.describe_security_groups([@group])[0]
  #
  # Configure a security group:
  #  @ec2.authorize_security_group_named_ingress(@group, account_number, 'default')
  #  @ec2.authorize_security_group_IP_ingress(@group, 80,80,'udp','192.168.1.0/8')
  #
  # Describe the available images:
  #  images = @ec2.describe_images
  #
  # Launch an instance:
  #  ec2.run_instances('ami-9a9e7bf3', 1, 1, ['default'], @key, 'SomeImportantUserData', 'public')
  # 
  #
  # Describe running instances:
  #  @ec2.describe_instances
  #
  # Error handling: all operations raise an RightAws::AwsError in case
  # of problems. Note that transient errors are automatically retried.
    
  class Ec2 < RightAwsBase
    include RightAwsBaseInterface
    
    # Amazon EC2 API version being used
    API_VERSION       = "2011-02-28"
    DEFAULT_HOST      = "ec2.amazonaws.com"
    DEFAULT_PATH      = '/'
    DEFAULT_PROTOCOL  = 'https'
    DEFAULT_PORT      = 443
    
    # Default addressing type (public=NAT, direct=no-NAT) used when launching instances.
    DEFAULT_ADDRESSING_TYPE =  'public'
    DNS_ADDRESSING_SET      = ['public','direct']
    
    # Amazon EC2 Instance Types : http://www.amazon.com/b?ie=UTF8&node=370375011
    # Default EC2 instance type (platform) 
    DEFAULT_INSTANCE_TYPE   =  'm1.small' 
    INSTANCE_TYPES          = [  't1.micro'  ,
                                 'm1.small'  ,
                                 'm1.medium' ,
                                 'm1.large'  ,
                                 'm1.xlarge' ,
                                 'c1.medium' ,
                                 'c1.xlarge' ,
                                 'm2.xlarge' ,
                                 'm2.2xlarge',
                                 'm2.4xlarge',
                                 'm3.xlarge' ,
                                 'm3.2xlarge',
                                 'cc1.4xlarge',
                                 'cg1.4xlarge',
                                 'cc2.8xlarge',
                                 'hi1.4xlarge',
                                 'hs1.8xlarge',
                                 'cr1.8xlarge'
                              ]
    
    @@bench = AwsBenchmarkingBlock.new
    def self.bench_xml
      @@bench.xml
    end
    def self.bench_ec2
      @@bench.service
    end
    
     # Current API version (sometimes we have to check it outside the GEM).
    @@api = ENV['EC2_API_VERSION'] || API_VERSION
    def self.api 
      @@api
    end
    
    # Create a new handle to an EC2 account. All handles share the same per process or per thread
    # HTTP connection to Amazon EC2. Each handle is for a specific account. The params have the
    # following options:
    # * <tt>:endpoint_url</tt> a fully qualified url to Amazon API endpoint (this overwrites: :server, :port, :service, :protocol and :region). Example: 'https://eu-west-1.ec2.amazonaws.com/'
    # * <tt>:server</tt>: EC2 service host, default: DEFAULT_HOST
    # * <tt>:region</tt>: EC2 region (North America by default)
    # * <tt>:port</tt>: EC2 service port, default: DEFAULT_PORT
    # * <tt>:protocol</tt>: 'http' or 'https', default: DEFAULT_PROTOCOL
    # * <tt>:logger</tt>: for log messages, default: RAILS_DEFAULT_LO
Download .txt
gitextract_uj4pe4k8/

├── .gitignore
├── Dockerfile
├── Gemfile
├── History.txt
├── LICENSE
├── Manifest.txt
├── README.txt
├── Rakefile
├── docker-compose.yml
├── lib/
│   ├── acf/
│   │   ├── right_acf_interface.rb
│   │   ├── right_acf_invalidations.rb
│   │   ├── right_acf_origin_access_identities.rb
│   │   └── right_acf_streaming_interface.rb
│   ├── acw/
│   │   └── right_acw_interface.rb
│   ├── as/
│   │   └── right_as_interface.rb
│   ├── awsbase/
│   │   ├── benchmark_fix.rb
│   │   ├── right_awsbase.rb
│   │   ├── support.rb
│   │   └── version.rb
│   ├── ec2/
│   │   ├── right_ec2.rb
│   │   ├── right_ec2_ebs.rb
│   │   ├── right_ec2_images.rb
│   │   ├── right_ec2_instances.rb
│   │   ├── right_ec2_monitoring.rb
│   │   ├── right_ec2_placement_groups.rb
│   │   ├── right_ec2_reserved_instances.rb
│   │   ├── right_ec2_security_groups.rb
│   │   ├── right_ec2_spot_instances.rb
│   │   ├── right_ec2_tags.rb
│   │   ├── right_ec2_vpc.rb
│   │   ├── right_ec2_vpc2.rb
│   │   └── right_ec2_windows_mobility.rb
│   ├── elb/
│   │   └── right_elb_interface.rb
│   ├── emr/
│   │   └── right_emr_interface.rb
│   ├── iam/
│   │   ├── right_iam_access_keys.rb
│   │   ├── right_iam_groups.rb
│   │   ├── right_iam_interface.rb
│   │   ├── right_iam_mfa_devices.rb
│   │   └── right_iam_users.rb
│   ├── rds/
│   │   └── right_rds_interface.rb
│   ├── right_aws.rb
│   ├── route_53/
│   │   └── right_route_53_interface.rb
│   ├── s3/
│   │   ├── right_s3.rb
│   │   └── right_s3_interface.rb
│   ├── sdb/
│   │   ├── active_sdb.rb
│   │   └── right_sdb_interface.rb
│   ├── sns/
│   │   └── right_sns_interface.rb
│   └── sqs/
│       ├── right_sqs.rb
│       ├── right_sqs_gen2.rb
│       ├── right_sqs_gen2_interface.rb
│       └── right_sqs_interface.rb
├── right_aws.gemspec
└── test/
    ├── README.mdown
    ├── acf/
    │   ├── test_helper.rb
    │   └── test_right_acf.rb
    ├── awsbase/
    │   ├── test_helper.rb
    │   └── test_right_awsbase.rb
    ├── ec2/
    │   ├── test_helper.rb
    │   └── test_right_ec2.rb
    ├── elb/
    │   ├── test_helper.rb
    │   └── test_right_elb.rb
    ├── http_connection.rb
    ├── rds/
    │   ├── test_helper.rb
    │   └── test_right_rds.rb
    ├── route_53/
    │   ├── fixtures/
    │   │   ├── a_record.xml
    │   │   └── alias_record.xml
    │   ├── test_helper.rb
    │   └── test_right_route_53.rb
    ├── s3/
    │   ├── test_helper.rb
    │   ├── test_right_s3.rb
    │   └── test_right_s3_stubbed.rb
    ├── sdb/
    │   ├── test_active_sdb.rb
    │   ├── test_batch_put_attributes.rb
    │   ├── test_helper.rb
    │   └── test_right_sdb.rb
    ├── sns/
    │   ├── test_helper.rb
    │   └── test_right_sns.rb
    ├── sqs/
    │   ├── test_helper.rb
    │   ├── test_right_sqs.rb
    │   └── test_right_sqs_gen2.rb
    ├── test_credentials.rb
    └── ts_right_aws.rb
Download .txt
SYMBOL INDEX (1621 symbols across 58 files)

FILE: lib/acf/right_acf_interface.rb
  type RightAws (line 23) | module RightAws
    class AcfInterface (line 75) | class AcfInterface < RightAwsBase
      method bench_xml (line 86) | def self.bench_xml
      method bench_service (line 89) | def self.bench_service
      method initialize (line 105) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 122) | def generate_request(method, path, params={}, body=nil, headers={}) ...
      method request_info (line 150) | def request_info(request, parser, &block) # :nodoc:
      method generate_call_reference (line 158) | def generate_call_reference # :nodoc:
      method merge_headers (line 164) | def merge_headers(hash) # :nodoc:
      method distribution_config_to_xml (line 170) | def distribution_config_to_xml(config, xml_wrapper='DistributionConf...
      method list_distributions (line 266) | def list_distributions
      method incrementally_list_distributions (line 304) | def incrementally_list_distributions(params={}, &block)
      method create_distribution (line 373) | def create_distribution(config)
      method get_distribution (line 417) | def get_distribution(aws_id)
      method get_distribution_config (line 445) | def get_distribution_config(aws_id)
      method set_distribution_config (line 471) | def set_distribution_config(aws_id, config)
      method delete_distribution (line 482) | def delete_distribution(aws_id, e_tag)
      class AcfDistributionListParser (line 492) | class AcfDistributionListParser < RightAWSParser # :nodoc:
        method reset (line 493) | def reset
        method tagstart (line 496) | def tagstart(name, attributes)
        method tagend (line 508) | def tagend(name)

FILE: lib/acf/right_acf_invalidations.rb
  type RightAws (line 23) | module RightAws
    class AcfInterface (line 25) | class AcfInterface
      method list_invalidations (line 33) | def list_invalidations(distribution_aws_id)
      method incrementally_list_invalidations (line 45) | def incrementally_list_invalidations(distribution_aws_id, params={},...
      method create_invalidation (line 74) | def create_invalidation(distribution_aws_id, invalidation_batch)
      method get_invalidation (line 90) | def get_invalidation(distribution_aws_id, aws_id)
      method invalidation_batch_to_xml (line 99) | def invalidation_batch_to_xml(invalidation_batch) # :nodoc:
      class AcfInvalidationsListParser (line 115) | class AcfInvalidationsListParser < RightAWSParser # :nodoc:
        method reset (line 116) | def reset
        method tagstart (line 119) | def tagstart(name, attributes)
        method tagend (line 125) | def tagend(name)

FILE: lib/acf/right_acf_origin_access_identities.rb
  type RightAws (line 23) | module RightAws
    class AcfInterface (line 25) | class AcfInterface
      method list_origin_access_identities (line 43) | def list_origin_access_identities
      method incrementally_list_origin_access_identities (line 79) | def incrementally_list_origin_access_identities(params={}, &block)
      method create_origin_access_identity (line 109) | def create_origin_access_identity(comment='', caller_reference=nil)
      method create_origin_access_identity_by_config (line 115) | def create_origin_access_identity_by_config(config)
      method get_origin_access_identity (line 131) | def get_origin_access_identity(aws_id)
      method delete_origin_access_identity (line 148) | def delete_origin_access_identity(aws_id, e_tag)
      method origin_access_identity_config_to_xml (line 158) | def origin_access_identity_config_to_xml(config) # :nodoc:
      method get_origin_access_identity_config (line 173) | def get_origin_access_identity_config(aws_id)
      method set_origin_access_identity_config (line 187) | def set_origin_access_identity_config(aws_id, config)
      class AcfOriginAccesIdentitiesListParser (line 197) | class AcfOriginAccesIdentitiesListParser < RightAWSParser # :nodoc:
        method reset (line 198) | def reset
        method tagstart (line 201) | def tagstart(name, attributes)
        method tagend (line 209) | def tagend(name)

FILE: lib/acf/right_acf_streaming_interface.rb
  type RightAws (line 23) | module RightAws
    class AcfInterface (line 25) | class AcfInterface
      method streaming_distribution_config_to_xml (line 27) | def streaming_distribution_config_to_xml(config) # :nodoc:
      method list_streaming_distributions (line 57) | def list_streaming_distributions
      method incrementally_list_streaming_distributions (line 95) | def incrementally_list_streaming_distributions(params={}, &block)
      method create_streaming_distribution (line 127) | def create_streaming_distribution(config)
      method get_streaming_distribution (line 169) | def get_streaming_distribution(aws_id)
      method get_streaming_distribution_config (line 188) | def get_streaming_distribution_config(aws_id)
      method set_streaming_distribution_config (line 211) | def set_streaming_distribution_config(aws_id, config)
      method delete_streaming_distribution (line 222) | def delete_streaming_distribution(aws_id, e_tag)

FILE: lib/acw/right_acw_interface.rb
  type RightAws (line 24) | module RightAws
    class AcwInterface (line 32) | class AcwInterface < RightAwsBase
      method bench_xml (line 43) | def self.bench_xml
      method bench_service (line 46) | def self.bench_service
      method initialize (line 61) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 73) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 79) | def request_info(request, parser)  #:nodoc:
      method get_metric_statistics (line 142) | def get_metric_statistics(options={})
      method list_metrics (line 186) | def list_metrics
      class GetMetricStatisticsParser (line 195) | class GetMetricStatisticsParser < RightAWSParser #:nodoc:
        method tagstart (line 196) | def tagstart(name, attributes)
        method tagend (line 199) | def tagend(name)
        method reset (line 213) | def reset
      class ListMetricsParser (line 218) | class ListMetricsParser < RightAWSParser #:nodoc:
        method tagstart (line 219) | def tagstart(name, attributes)
        method tagend (line 227) | def tagend(name)
        method reset (line 240) | def reset

FILE: lib/as/right_as_interface.rb
  type RightAws (line 24) | module RightAws
    class AsInterface (line 73) | class AsInterface < RightAwsBase
      method bench_xml (line 84) | def self.bench_xml
      method bench_service (line 87) | def self.bench_service
      method initialize (line 102) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 114) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 120) | def request_info(request, parser)  #:nodoc:
      method describe_auto_scaling_groups (line 134) | def describe_auto_scaling_groups(*auto_scaling_group_names)
      method create_auto_scaling_group (line 151) | def create_auto_scaling_group(auto_scaling_group_name, launch_config...
      method delete_auto_scaling_group (line 169) | def delete_auto_scaling_group(auto_scaling_group_name)
      method set_desired_capacity (line 183) | def set_desired_capacity(auto_scaling_group_name, desired_capacity)
      method update_auto_scaling_group (line 205) | def update_auto_scaling_group(auto_scaling_group_name, options={})
      method describe_scaling_activities (line 245) | def describe_scaling_activities(auto_scaling_group_name, *activity_ids)
      method incrementally_describe_scaling_activities (line 292) | def incrementally_describe_scaling_activities(auto_scaling_group_nam...
      method terminate_instance_in_auto_scaling_group (line 321) | def terminate_instance_in_auto_scaling_group(instance_id, should_dec...
      method create_launch_configuration (line 353) | def create_launch_configuration(launch_configuration_name, image_id,...
      method describe_launch_configurations (line 384) | def describe_launch_configurations(*launch_configuration_names)
      method incrementally_describe_launch_configurations (line 419) | def incrementally_describe_launch_configurations(*launch_configurati...
      method delete_launch_configuration (line 440) | def delete_launch_configuration(launch_configuration_name)
      method create_or_update_scaling_trigger (line 473) | def create_or_update_scaling_trigger(trigger_name, auto_scaling_grou...
      method describe_triggers (line 516) | def describe_triggers(auto_scaling_group_name)
      method delete_trigger (line 526) | def delete_trigger(trigger_name, auto_scaling_group_name)
      class DescribeScalingActivitiesParser (line 536) | class DescribeScalingActivitiesParser < RightAWSParser #:nodoc:
        method tagstart (line 537) | def tagstart(name, attributes)
        method tagend (line 542) | def tagend(name)
        method reset (line 555) | def reset
      class DescribeAutoScalingGroupsParser (line 564) | class DescribeAutoScalingGroupsParser < RightAWSParser #:nodoc:
        method tagstart (line 565) | def tagstart(name, attributes)
        method tagend (line 576) | def tagend(name)
        method reset (line 599) | def reset
      class DescribeLaunchConfigurationsParser (line 609) | class DescribeLaunchConfigurationsParser < RightAWSParser #:nodoc:
        method tagstart (line 610) | def tagstart(name, attributes)
        method tagend (line 619) | def tagend(name)
        method reset (line 646) | def reset
      class DescribeTriggersParser (line 655) | class DescribeTriggersParser < RightAWSParser #:nodoc:
        method tagstart (line 656) | def tagstart(name, attributes)
        method tagend (line 667) | def tagend(name)
        method reset (line 691) | def reset

FILE: lib/awsbase/benchmark_fix.rb
  type Benchmark (line 27) | module Benchmark  #:nodoc:
    class Tms (line 28) | class Tms #:nodoc:
      method add! (line 29) | def add!(&blk)

FILE: lib/awsbase/right_awsbase.rb
  type RightAws (line 25) | module RightAws
    class AwsUtils (line 28) | class AwsUtils #:nodoc:
      method utc_iso8601 (line 35) | def self.utc_iso8601(time)
      method sign (line 42) | def self.sign(aws_secret_access_key, auth_string)
      method content_md5 (line 47) | def self.content_md5(content)
      method amz_escape (line 53) | def self.amz_escape(param)
      method xml_escape (line 60) | def self.xml_escape(text) # :nodoc:
      method xml_unescape (line 64) | def self.xml_unescape(text) # :nodoc:
      method fix_service_params (line 69) | def self.fix_service_params(service_hash, signature)
      method fix_headers (line 75) | def self.fix_headers(headers)
      method sign_request_v0 (line 87) | def self.sign_request_v0(aws_secret_access_key, service_hash)
      method sign_request_v1 (line 96) | def self.sign_request_v1(aws_secret_access_key, service_hash)
      method sign_request_v2 (line 107) | def self.sign_request_v2(aws_secret_access_key, service_hash, http_v...
      method URLencode (line 134) | def self.URLencode(raw)
      method allow_only (line 139) | def self.allow_only(allowed_keys, params)
      method mandatory_arguments (line 145) | def self.mandatory_arguments(required_args, params)
      method caller_method (line 151) | def self.caller_method
      method split_items_and_params (line 156) | def self.split_items_and_params(array)
      method generate_unique_token (line 166) | def self.generate_unique_token
    class AwsBenchmarkingBlock (line 177) | class AwsBenchmarkingBlock #:nodoc:
      method initialize (line 179) | def initialize
    class AwsNoChange (line 187) | class AwsNoChange < RuntimeError
    class RightAwsBase (line 190) | class RightAwsBase
      method amazon_problems (line 211) | def self.amazon_problems
      method amazon_problems= (line 217) | def self.amazon_problems=(problems_list)
      method raise_on_timeout_on_actions (line 237) | def self.raise_on_timeout_on_actions
      method raise_on_timeout_on_actions= (line 241) | def self.raise_on_timeout_on_actions=(actions_list)
    type RightAwsBaseInterface (line 247) | module RightAwsBaseInterface
      function caching (line 251) | def self.caching
      function caching= (line 254) | def self.caching=(caching)
      function init (line 281) | def init(service_info, aws_access_key_id, aws_secret_access_key, par...
      function signed_service_params (line 329) | def signed_service_params(aws_secret_access_key, service_hash, http_...
      function caching? (line 339) | def caching?
      function cache_hits? (line 348) | def cache_hits?(function, response, do_raise=:raise)
      function update_cache (line 379) | def update_cache(function, hash)
      function on_exception (line 383) | def on_exception(options={:raise=>true, :log=>true}) # :nodoc:
      function get_server_url (line 392) | def get_server_url(request) # :nodoc:
      function get_connections_storage (line 396) | def get_connections_storage(aws_service) # :nodoc:
      function destroy_connection (line 403) | def destroy_connection(request, reason) # :nodoc:
      function get_connection (line 413) | def get_connection(request) # :nodoc:
      function generate_request_impl (line 441) | def generate_request_impl(verb, action, options={}, custom_options={...
      function request_info_impl (line 491) | def request_info_impl(aws_service, benchblock, request, parser, &blo...
      function request_cache_or_info (line 576) | def request_cache_or_info(method, link, parser_class, benchblock, us...
      function last_request_id (line 593) | def last_request_id
      function incrementally_list_items (line 598) | def incrementally_list_items(action, parser_class, params={}, &block...
      function amazonize_list (line 638) | def amazonize_list(masks, list, options={}) #:nodoc:
      function amazonize_block_device_mappings (line 673) | def amazonize_block_device_mappings(block_device_mappings, key = 'Bl...
      function map_api_keys_and_values (line 760) | def map_api_keys_and_values(options, *mappings) # :nodoc:
      function amazonize_hash_with_key_mapping (line 812) | def amazonize_hash_with_key_mapping(key, mapping, hash, options={})
      function amazonize_list_with_key_mapping (line 833) | def amazonize_list_with_key_mapping(key, mapping, list, options={})
      function with_connection_options (line 898) | def with_connection_options(options, &block)
    class AwsError (line 911) | class AwsError < RuntimeError
      method initialize (line 923) | def initialize(errors=nil, http_code=nil, request_id=nil)
      method include? (line 932) | def include?(pattern)
      method on_aws_exception (line 947) | def self.on_aws_exception(aws, options={:raise=>true, :log=>true})
      method system_error? (line 967) | def self.system_error?(e)
    class AWSErrorHandler (line 974) | class AWSErrorHandler
      method reiteration_start_delay (line 979) | def self.reiteration_start_delay
      method reiteration_start_delay= (line 982) | def self.reiteration_start_delay=(reiteration_start_delay)
      method reiteration_time (line 987) | def self.reiteration_time
      method reiteration_time= (line 990) | def self.reiteration_time=(reiteration_time)
      method close_on_error (line 995) | def self.close_on_error
      method close_on_error= (line 998) | def self.close_on_error=(close_on_error)
      method close_on_4xx_probability (line 1003) | def self.close_on_4xx_probability
      method close_on_4xx_probability= (line 1006) | def self.close_on_4xx_probability=(close_on_4xx_probability)
      method initialize (line 1015) | def initialize(aws, parser, params={}) #:nodoc:
      method check (line 1029) | def check(request)  #:nodoc:
    class RightSaxParserCallbackTemplate (line 1148) | class RightSaxParserCallbackTemplate #:nodoc:
      method initialize (line 1149) | def initialize(right_aws_parser)
      method on_characters (line 1152) | def on_characters(chars)
      method on_start_document (line 1155) | def on_start_document; end
      method on_comment (line 1156) | def on_comment(msg); end
      method on_processing_instruction (line 1157) | def on_processing_instruction(target, data); end
      method on_cdata_block (line 1158) | def on_cdata_block(cdata); end
      method on_end_document (line 1159) | def on_end_document; end
    class RightSaxParserCallback (line 1162) | class RightSaxParserCallback < RightSaxParserCallbackTemplate
      method include_callback (line 1163) | def self.include_callback
      method on_start_element (line 1166) | def on_start_element(name, attr_hash)
      method on_end_element (line 1169) | def on_end_element(name)
    class RightSaxParserCallbackNs (line 1174) | class RightSaxParserCallbackNs < RightSaxParserCallbackTemplate
      method on_start_element_ns (line 1175) | def on_start_element_ns(name, attr_hash, prefix, uri, namespaces)
      method on_end_element_ns (line 1178) | def on_end_element_ns(name, prefix, uri)
    class RightAWSParser (line 1183) | class RightAWSParser  #:nodoc:
      method xml_lib (line 1190) | def self.xml_lib
      method xml_lib= (line 1193) | def self.xml_lib=(new_lib_name)
      method initialize (line 1203) | def initialize(params={})
      method tag_start (line 1213) | def tag_start(name, attributes)
      method tag_end (line 1220) | def tag_end(name)
      method text (line 1225) | def text(text)
      method parse (line 1233) | def parse(xml_text, params={})
      method method_missing (line 1287) | def method_missing(method, *params)
      method reset (line 1296) | def reset                     ; end
      method tagstart (line 1297) | def tagstart(name, attributes); end
      method tagend (line 1298) | def tagend(name)              ; end
      method tagtext (line 1299) | def tagtext(text)             ; end
    class RightErrorResponseParser (line 1315) | class RightErrorResponseParser < RightAWSParser #:nodoc:
      method tagend (line 1319) | def tagend(name)
      method reset (line 1330) | def reset
    class RightDummyParser (line 1337) | class RightDummyParser  # :nodoc:
      method parse (line 1339) | def parse(response, params={})
    class RightHttp2xxParser (line 1344) | class RightHttp2xxParser < RightAWSParser # :nodoc:
      method parse (line 1345) | def parse(response)
    class RightBoolResponseParser (line 1350) | class RightBoolResponseParser < RightAWSParser #:nodoc:
      method tagend (line 1351) | def tagend(name)

FILE: lib/awsbase/support.rb
  class String (line 29) | class String #:nodoc:
    method right_underscore (line 31) | def right_underscore

FILE: lib/awsbase/version.rb
  type RightAws (line 1) | module RightAws #:nodoc:
    type VERSION (line 2) | module VERSION #:nodoc:

FILE: lib/ec2/right_ec2.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 67) | class Ec2 < RightAwsBase
      method bench_xml (line 105) | def self.bench_xml
      method bench_ec2 (line 108) | def self.bench_ec2
      method api (line 114) | def self.api
      method initialize (line 134) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 150) | def generate_request(action, params={}, custom_options={}) #:nodoc:
      method request_info (line 156) | def request_info(request, parser)  #:nodoc:
      method describe_resources_with_list_and_options (line 160) | def describe_resources_with_list_and_options(remote_function_name, r...
      method incrementally_list_items (line 198) | def incrementally_list_items(remote_function_name, remote_item_name,...
      method merge_new_options_into_list_and_options (line 210) | def merge_new_options_into_list_and_options(list_and_options, new_op...
      method describe_key_pairs (line 237) | def describe_key_pairs(*list_and_options)
      method import_key_pair (line 247) | def import_key_pair(name, public_key_material)
      method create_key_pair (line 263) | def create_key_pair(name)
      method delete_key_pair (line 275) | def delete_key_pair(name)
      method allocate_address (line 300) | def allocate_address(options={})
      method associate_address (line 320) | def associate_address(instance_id, options={})
      method describe_addresses (line 347) | def describe_addresses(*list_and_options)
      method describe_addresses_by_allocation_ids (line 363) | def describe_addresses_by_allocation_ids(*list_and_options)
      method disassociate_address (line 373) | def disassociate_address(options = {})
      method release_address (line 389) | def release_address(options = {})
      method describe_availability_zones (line 421) | def describe_availability_zones(*list_and_options)
      method describe_regions (line 444) | def describe_regions(*list_and_options)
      method describe_account_attributes (line 464) | def describe_account_attributes(*list_and_options)
      class QEc2DescribeKeyPairParser (line 473) | class QEc2DescribeKeyPairParser < RightAWSParser #:nodoc:
        method tagstart (line 474) | def tagstart(name, attributes)
        method tagend (line 477) | def tagend(name)
        method reset (line 484) | def reset
      class QEc2CreateKeyPairParser (line 489) | class QEc2CreateKeyPairParser < RightAWSParser #:nodoc:
        method tagstart (line 490) | def tagstart(name, attributes)
        method tagend (line 493) | def tagend(name)
      class QEc2ImportKeyPairParser (line 502) | class QEc2ImportKeyPairParser < RightAWSParser #:nodoc:
        method tagstart (line 503) | def tagstart(name, attributes)
        method tagend (line 506) | def tagend(name)
      class QEc2AllocateAddressParser (line 518) | class QEc2AllocateAddressParser < RightAWSParser #:nodoc:
        method tagend (line 519) | def tagend(name)
        method reset (line 526) | def reset
      class QEc2AssociateAddressParser (line 531) | class QEc2AssociateAddressParser < RightAWSParser #:nodoc:
        method tagend (line 532) | def tagend(name)
        method reset (line 538) | def reset
      class QEc2DescribeAddressesParser (line 543) | class QEc2DescribeAddressesParser < RightAWSParser #:nodoc:
        method tagstart (line 544) | def tagstart(name, attributes)
        method tagend (line 547) | def tagend(name)
        method reset (line 557) | def reset
      class QEc2DescribeAvailabilityZonesParser (line 566) | class QEc2DescribeAvailabilityZonesParser < RightAWSParser #:nodoc:
        method tagstart (line 567) | def tagstart(name, attributes)
        method tagend (line 572) | def tagend(name)
        method reset (line 584) | def reset
      class QEc2DescribeRegionsParser (line 593) | class QEc2DescribeRegionsParser < RightAWSParser #:nodoc:
        method tagstart (line 594) | def tagstart(name, attributes)
        method tagend (line 597) | def tagend(name)
        method reset (line 604) | def reset
      class QEc2DescribeAccountAttributesParser (line 613) | class QEc2DescribeAccountAttributesParser < RightAWSParser #:nodoc:
        method tagstart (line 614) | def tagstart(name, attributes)
        method tagend (line 619) | def tagend(name)
        method reset (line 626) | def reset

FILE: lib/ec2/right_ec2_ebs.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_volumes (line 72) | def describe_volumes(*list_and_options)
      method create_volume (line 98) | def create_volume(snapshot_id, size, zone, options={})
      method delete_volume (line 121) | def delete_volume(volume_id)
      method attach_volume (line 139) | def attach_volume(volume_id, instance_id, device)
      method detach_volume (line 158) | def detach_volume(volume_id, instance_id=nil, device=nil, force=nil)
      method describe_snapshots (line 215) | def describe_snapshots(*list_and_options)
      method describe_snapshots_by_restorable_by (line 219) | def describe_snapshots_by_restorable_by(*list_and_options)
      method create_snapshot (line 235) | def create_snapshot(volume_id, description='')
      method try_create_snapshot (line 259) | def try_create_snapshot(volume_id, connect_timeout = nil, read_timeo...
      method describe_snapshot_attribute (line 293) | def describe_snapshot_attribute(snapshot_id, attribute='createVolume...
      method reset_snapshot_attribute (line 306) | def reset_snapshot_attribute(snapshot_id, attribute='createVolumePer...
      method modify_snapshot_attribute (line 320) | def modify_snapshot_attribute(snapshot_id, attribute, value)
      method modify_snapshot_attribute_create_volume_permission_add_users (line 339) | def modify_snapshot_attribute_create_volume_permission_add_users(sna...
      method modify_snapshot_attribute_create_volume_permission_remove_users (line 347) | def modify_snapshot_attribute_create_volume_permission_remove_users(...
      method modify_snapshot_attribute_create_volume_permission_add_groups (line 355) | def modify_snapshot_attribute_create_volume_permission_add_groups(sn...
      method modify_snapshot_attribute_create_volume_permission_remove_groups (line 365) | def modify_snapshot_attribute_create_volume_permission_remove_groups...
      method delete_snapshot (line 375) | def delete_snapshot(snapshot_id)
      class QEc2CreateVolumeParser (line 387) | class QEc2CreateVolumeParser < RightAWSParser #:nodoc:
        method tagend (line 388) | def tagend(name)
        method reset (line 400) | def reset
      class QEc2AttachAndDetachVolumeParser (line 405) | class QEc2AttachAndDetachVolumeParser < RightAWSParser #:nodoc:
        method tagend (line 406) | def tagend(name)
        method reset (line 415) | def reset
      class QEc2DescribeVolumesParser (line 420) | class QEc2DescribeVolumesParser < RightAWSParser #:nodoc:
        method tagstart (line 421) | def tagstart(name, attributes)
        method tagend (line 427) | def tagend(name)
        method reset (line 451) | def reset
      class QEc2DescribeSnapshotsParser (line 460) | class QEc2DescribeSnapshotsParser < RightAWSParser #:nodoc:
        method tagstart (line 461) | def tagstart(name, attributes)
        method tagend (line 468) | def tagend(name)
        method reset (line 489) | def reset
      class QEc2DescribeSnapshotAttributeParser (line 494) | class QEc2DescribeSnapshotAttributeParser < RightAWSParser #:nodoc:
        method tagstart (line 495) | def tagstart(name, attributes)
        method tagend (line 500) | def tagend(name)
        method reset (line 506) | def reset

FILE: lib/ec2/right_ec2_images.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method ec2_describe_images (line 38) | def ec2_describe_images(params={}, options={}, cache_for=nil) #:nodoc:
      method describe_images (line 93) | def describe_images(*list_and_options)
      method describe_images_by_owner (line 114) | def describe_images_by_owner(*list_and_options)
      method describe_images_by_executable_by (line 137) | def describe_images_by_executable_by(*list_and_options)
      method register_image (line 170) | def register_image(options)
      method deregister_image (line 198) | def deregister_image(image_id)
      method describe_image_attribute (line 220) | def describe_image_attribute(image_id, attribute='launchPermission')
      method reset_image_attribute (line 233) | def reset_image_attribute(image_id, attribute='launchPermission')
      method modify_image_attribute (line 251) | def modify_image_attribute(image_id, attribute, value)
      method modify_image_launch_perm_add_users (line 275) | def modify_image_launch_perm_add_users(image_id, *user_ids)
      method modify_image_launch_perm_remove_users (line 283) | def modify_image_launch_perm_remove_users(image_id, *user_ids)
      method modify_image_launch_perm_add_groups (line 292) | def modify_image_launch_perm_add_groups(image_id, *groups)
      method modify_image_launch_perm_remove_groups (line 300) | def modify_image_launch_perm_remove_groups(image_id, *groups)
      method modify_image_product_code (line 308) | def modify_image_product_code(image_id, product_codes=[])
      method modify_image_description (line 316) | def modify_image_description(image_id, description)
      method create_image (line 327) | def create_image(instance_aws_id, options={})
      class QEc2DescribeImagesParser (line 340) | class QEc2DescribeImagesParser < RightAWSParser #:nodoc:
        method tagstart (line 341) | def tagstart(name, attributes)
        method tagend (line 352) | def tagend(name)
        method reset (line 393) | def reset
      class QEc2RegisterImageParser (line 398) | class QEc2RegisterImageParser < RightAWSParser #:nodoc:
        method tagend (line 399) | def tagend(name)
      class QEc2DescribeImageAttributeParser (line 408) | class QEc2DescribeImageAttributeParser < RightAWSParser #:nodoc:
        method tagstart (line 409) | def tagstart(name, attributes)
        method tagend (line 417) | def tagend(name)
        method reset (line 437) | def reset

FILE: lib/ec2/right_ec2_instances.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method get_desc_instances (line 34) | def get_desc_instances(instances)  # :nodoc:
      method describe_instances (line 112) | def describe_instances(*list_and_options)
      method confirm_product_instance (line 124) | def confirm_product_instance(instance, product_code)
      method run_instances (line 152) | def run_instances(image_id, min_count, max_count, group_names, key_n...
      method launch_instances (line 226) | def launch_instances(image_id, options={})
      method start_instances (line 270) | def start_instances(*instance_aws_ids)
      method stop_instances (line 287) | def stop_instances(*instance_aws_ids_and_options)
      method terminate_instances (line 305) | def terminate_instances(*instance_aws_ids)
      method get_console_output (line 320) | def get_console_output(instance_id)
      method reboot_instances (line 331) | def reboot_instances(*instances)
      method describe_instance_attribute (line 353) | def describe_instance_attribute(instance_id, attribute)
      method reset_instance_attribute (line 370) | def reset_instance_attribute(instance_id, attribute)
      method modify_instance_attribute (line 386) | def modify_instance_attribute(instance_id, attribute, value)
      method get_initial_password (line 422) | def get_initial_password(instance_id, private_key)
      method get_initial_password_v2 (line 440) | def get_initial_password_v2(instance_id, private_key)
      method bundle_instance (line 468) | def bundle_instance(instance_id, s3_bucket, s3_prefix,
      method describe_bundle_tasks (line 520) | def describe_bundle_tasks(*list_and_options)
      method cancel_bundle_task (line 537) | def cancel_bundle_task(bundle_id)
      class QEc2DescribeInstancesParser (line 548) | class QEc2DescribeInstancesParser < RightAWSParser #:nodoc:
        method tagstart (line 549) | def tagstart(name, attributes)
        method tagend (line 568) | def tagend(name)
        method reset (line 641) | def reset
      class QEc2ConfirmProductInstanceParser (line 646) | class QEc2ConfirmProductInstanceParser < RightAWSParser #:nodoc:
        method tagend (line 647) | def tagend(name)
      class QEc2TerminateInstancesParser (line 652) | class QEc2TerminateInstancesParser < RightAWSParser #:nodoc:
        method tagstart (line 653) | def tagstart(name, attributes)
        method tagend (line 656) | def tagend(name)
        method reset (line 666) | def reset
      class QEc2DescribeInstanceAttributeParser (line 671) | class QEc2DescribeInstanceAttributeParser < RightAWSParser #:nodoc:
        method tagstart (line 672) | def tagstart(name, attributes)
        method tagend (line 680) | def tagend(name)
        method reset (line 709) | def reset
      class QEc2GetConsoleOutputParser (line 718) | class QEc2GetConsoleOutputParser < RightAWSParser #:nodoc:
        method tagend (line 719) | def tagend(name)
        method reset (line 727) | def reset
      class QEc2DescribeBundleTasksParser (line 736) | class QEc2DescribeBundleTasksParser < RightAWSParser #:nodoc:
        method tagstart (line 737) | def tagstart(name, attributes)
        method tagend (line 740) | def tagend(name)
        method reset (line 756) | def reset
      class QEc2BundleInstanceParser (line 761) | class QEc2BundleInstanceParser < RightAWSParser #:nodoc:
        method tagend (line 762) | def tagend(name)
        method reset (line 777) | def reset
      class QEc2GetPasswordDataParser (line 782) | class QEc2GetPasswordDataParser < RightAWSParser #:nodoc:
        method tagend (line 783) | def tagend(name)
        method reset (line 790) | def reset

FILE: lib/ec2/right_ec2_monitoring.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method monitor_instances (line 33) | def monitor_instances(*list)
      method unmonitor_instances (line 45) | def unmonitor_instances(*list)
      class QEc2MonitorInstancesParser (line 52) | class QEc2MonitorInstancesParser < RightAWSParser #:nodoc:
        method tagstart (line 53) | def tagstart(name, attributes)
        method tagend (line 56) | def tagend(name)
        method reset (line 63) | def reset

FILE: lib/ec2/right_ec2_placement_groups.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_placement_groups (line 51) | def describe_placement_groups(*list_and_options)
      method create_placement_group (line 62) | def create_placement_group(placement_group_name, strategy = 'cluster')
      method delete_placement_group (line 76) | def delete_placement_group(placement_group_name)
      class QEc2DescribePlacementGroupsParser (line 88) | class QEc2DescribePlacementGroupsParser < RightAWSParser #:nodoc:
        method tagstart (line 89) | def tagstart(name, attributes)
        method tagend (line 94) | def tagend(name)
        method reset (line 102) | def reset

FILE: lib/ec2/right_ec2_reserved_instances.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_reserved_instances (line 61) | def describe_reserved_instances(*list_and_options)
      method describe_reserved_instances_offerings (line 119) | def describe_reserved_instances_offerings(*list_and_options, &block)
      method purchase_reserved_instances_offering (line 134) | def purchase_reserved_instances_offering(reserved_instances_offering...
      class QEc2DescribeReservedInstancesParser (line 151) | class QEc2DescribeReservedInstancesParser < RightAWSParser #:nodoc:
        method tagstart (line 152) | def tagstart(name, attributes)
        method tagend (line 159) | def tagend(name)
        method reset (line 186) | def reset
      class QEc2DescribeReservedInstancesOfferingsParser (line 191) | class QEc2DescribeReservedInstancesOfferingsParser < RightAWSParser ...
        method tagstart (line 192) | def tagstart(name, attributes)
        method tagend (line 199) | def tagend(name)
        method reset (line 225) | def reset
      class QEc2PurchaseReservedInstancesOfferingParser (line 230) | class QEc2PurchaseReservedInstancesOfferingParser < RightAWSParser #...
        method tagend (line 231) | def tagend(name)
        method reset (line 236) | def reset

FILE: lib/ec2/right_ec2_security_groups.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_security_groups (line 102) | def describe_security_groups(*list_and_options)
      method describe_security_groups_by_name (line 145) | def describe_security_groups_by_name(*list)
      method create_security_group (line 158) | def create_security_group(name, description = nil, options = {})
      method delete_security_group (line 178) | def delete_security_group(group_id_or_options={})
      method grant_security_group_ingress (line 186) | def grant_security_group_ingress(group_id, permissions)
      method revoke_security_group_ingress (line 190) | def revoke_security_group_ingress(group_id, permissions)
      method grant_security_group_egress (line 194) | def grant_security_group_egress(group_id, permissions)
      method revoke_security_group_egress (line 198) | def revoke_security_group_egress(group_id, permissions)
      method modify_security_group (line 261) | def modify_security_group(action, direction, group_id, permissions)
      method edit_security_group (line 373) | def edit_security_group(action, group_name, params)
      method authorize_security_group_named_ingress (line 408) | def authorize_security_group_named_ingress(name, owner, group)
      method revoke_security_group_named_ingress (line 416) | def revoke_security_group_named_ingress(name, owner, group)
      method authorize_security_group_IP_ingress (line 425) | def authorize_security_group_IP_ingress(name, from_port, to_port, pr...
      method revoke_security_group_IP_ingress (line 433) | def revoke_security_group_IP_ingress(name, from_port, to_port, proto...
      class QEc2CreateSecurityGroupsParser (line 441) | class QEc2CreateSecurityGroupsParser < RightAWSParser #:nodoc:
        method tagend (line 442) | def tagend(name)
        method reset (line 448) | def reset
      class QEc2DescribeSecurityGroupsParser (line 453) | class QEc2DescribeSecurityGroupsParser < RightAWSParser #:nodoc:
        method tagstart (line 454) | def tagstart(name, attributes)
        method tagend (line 464) | def tagend(name)
        method reset (line 490) | def reset

FILE: lib/ec2/right_ec2_spot_instances.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_spot_price_history (line 76) | def describe_spot_price_history(options={})
      method describe_spot_instance_requests (line 132) | def describe_spot_instance_requests(*list_and_options)
      method request_spot_instances (line 218) | def request_spot_instances(options)
      method cancel_spot_instance_requests (line 250) | def cancel_spot_instance_requests(*spot_instance_request_ids)
      method create_spot_datafeed_subscription (line 264) | def create_spot_datafeed_subscription(bucket, prefix=nil)
      method describe_spot_datafeed_subscription (line 279) | def describe_spot_datafeed_subscription
      method delete_spot_datafeed_subscription (line 288) | def delete_spot_datafeed_subscription()
      class QEc2DescribeSpotPriceHistoryParser (line 297) | class QEc2DescribeSpotPriceHistoryParser < RightAWSParser #:nodoc:
        method tagstart (line 298) | def tagstart(name, attributes)
        method tagend (line 301) | def tagend(name)
        method reset (line 311) | def reset
      class QEc2DescribeSpotInstanceParser (line 316) | class QEc2DescribeSpotInstanceParser < RightAWSParser #:nodoc:
        method tagstart (line 317) | def tagstart(name, attributes)
        method tagend (line 332) | def tagend(name)
        method reset (line 383) | def reset
      class QEc2CancelSpotInstanceParser (line 388) | class QEc2CancelSpotInstanceParser < RightAWSParser #:nodoc:
        method tagstart (line 389) | def tagstart(name, attributes)
        method tagend (line 392) | def tagend(name)
        method reset (line 399) | def reset
      class QEc2DescribeSpotDatafeedSubscriptionParser (line 404) | class QEc2DescribeSpotDatafeedSubscriptionParser < RightAWSParser #:...
        method tagend (line 405) | def tagend(name)
        method reset (line 415) | def reset

FILE: lib/ec2/right_ec2_tags.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 25) | class Ec2
      method describe_tags (line 45) | def describe_tags(options={})
      method create_tags (line 74) | def create_tags(resources, tags, options={})
      method delete_tags (line 103) | def delete_tags(resources, tags, options={})
      class QEc2DescribeTagsParser (line 117) | class QEc2DescribeTagsParser < RightAWSParser #:nodoc:
        method tagstart (line 118) | def tagstart(name, attributes)
        method tagend (line 122) | def tagend(name)
        method reset (line 132) | def reset

FILE: lib/ec2/right_ec2_vpc.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_vpcs (line 59) | def describe_vpcs(*list_and_options)
      method create_vpc (line 72) | def create_vpc(cidr_block, options = {})
      method delete_vpc (line 85) | def delete_vpc(vpc_id)
      method describe_subnets (line 114) | def describe_subnets(*list_and_options)
      method create_subnet (line 129) | def create_subnet(vpc_id, cidr_block, availability_zone = nil)
      method delete_subnet (line 143) | def delete_subnet(subnet_id)
      method describe_dhcp_options (line 169) | def describe_dhcp_options(*list_and_options)
      method create_dhcp_options (line 181) | def create_dhcp_options(dhcp_configuration)
      method associate_dhcp_options (line 199) | def associate_dhcp_options(dhcp_options_id, vpc_id)
      method delete_dhcp_options (line 211) | def delete_dhcp_options(dhcp_options_id)
      method describe_customer_gateways (line 239) | def describe_customer_gateways(*list_and_options)
      method create_customer_gateway (line 252) | def create_customer_gateway(type, ip_address, bgp_asn)
      method delete_customer_gateway (line 265) | def delete_customer_gateway(customer_gateway_id)
      method describe_vpn_gateways (line 292) | def describe_vpn_gateways(*list_and_options)
      method create_vpn_gateway (line 304) | def create_vpn_gateway(type, availability_zone=nil)
      method attach_vpn_gateway (line 318) | def attach_vpn_gateway(vpn_gateway_id, vpc_id)
      method detach_vpn_gateway (line 330) | def detach_vpn_gateway(vpn_gateway_id, vpc_id)
      method delete_vpn_gateway (line 342) | def delete_vpn_gateway(vpn_gateway_id)
      method describe_vpn_connections (line 373) | def describe_vpn_connections(*list_and_options)
      method create_vpn_connection (line 387) | def create_vpn_connection(type, customer_gateway_id, vpn_gateway_id)
      method delete_vpn_connection (line 400) | def delete_vpn_connection(vpn_connection_id)
      class QEc2DescribeVpcsParser (line 412) | class QEc2DescribeVpcsParser < RightAWSParser #:nodoc:
        method tagstart (line 413) | def tagstart(name, attributes)
        method tagend (line 419) | def tagend(name)
        method reset (line 436) | def reset
      class QEc2DescribeSubnetsParser (line 441) | class QEc2DescribeSubnetsParser < RightAWSParser #:nodoc:
        method tagstart (line 442) | def tagstart(name, attributes)
        method tagend (line 448) | def tagend(name)
        method reset (line 467) | def reset
      class QEc2DescribeDhcpOptionsParser (line 472) | class QEc2DescribeDhcpOptionsParser < RightAWSParser #:nodoc:
        method tagstart (line 473) | def tagstart(name, attributes)
        method tagend (line 479) | def tagend(name)
        method reset (line 490) | def reset
      class QEc2DescribeCustomerGatewaysParser (line 495) | class QEc2DescribeCustomerGatewaysParser < RightAWSParser #:nodoc:
        method tagstart (line 496) | def tagstart(name, attributes)
        method tagend (line 502) | def tagend(name)
        method reset (line 518) | def reset
      class QEc2DescribeVpnGatewaysParser (line 523) | class QEc2DescribeVpnGatewaysParser < RightAWSParser #:nodoc:
        method tagstart (line 524) | def tagstart(name, attributes)
        method tagend (line 531) | def tagend(name)
        method reset (line 549) | def reset
      class QEc2AttachVpnGatewayParser (line 554) | class QEc2AttachVpnGatewayParser < RightAWSParser #:nodoc:
        method tagend (line 555) | def tagend(name)
        method reset (line 561) | def reset
      class QEc2DescribeVpnConnectionsParser (line 567) | class QEc2DescribeVpnConnectionsParser < RightAWSParser #:nodoc:
        method tagstart (line 568) | def tagstart(name, attributes)
        method tagend (line 574) | def tagend(name)
        method reset (line 591) | def reset

FILE: lib/ec2/right_ec2_vpc2.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method create_internet_gateway (line 43) | def create_internet_gateway
      method describe_internet_gateways (line 62) | def describe_internet_gateways(*list_and_options)
      method delete_internet_gateway (line 74) | def delete_internet_gateway(internet_gateway_id)
      method attach_internet_gateway (line 87) | def attach_internet_gateway(internet_gateway_id, vpc_id)
      method detach_internet_gateway (line 103) | def detach_internet_gateway(internet_gateway_id, vpc_id)
      method describe_route_tables (line 162) | def describe_route_tables(*list_and_options)
      method create_route_table (line 182) | def create_route_table(vpc_id)
      method delete_route_table (line 195) | def delete_route_table(route_table_id)
      method associate_route_table (line 211) | def associate_route_table(route_table_id, subnet_id)
      method disassociate_route_table (line 226) | def disassociate_route_table(route_table_association_id)
      method replace_route_table_association (line 242) | def replace_route_table_association(route_table_id, route_table_asso...
      method create_route (line 263) | def create_route(route_table_id, destination_cidr_block, options = {})
      method delete_route (line 280) | def delete_route(route_table_id, destination_cidr_block)
      method replace_route (line 295) | def replace_route(route_table_id, destination_cidr_block, options = {})
      class QEc2DescribeInternetGatewaysParser (line 310) | class QEc2DescribeInternetGatewaysParser < RightAWSParser #:nodoc:
        method tagstart (line 311) | def tagstart(name, attributes)
        method tagend (line 317) | def tagend(name)
        method reset (line 330) | def reset
      class QEc2DescribeRouteTablesParser (line 339) | class QEc2DescribeRouteTablesParser < RightAWSParser #:nodoc:
        method tagstart (line 340) | def tagstart(name, attributes)
        method tagend (line 351) | def tagend(name)
        method reset (line 375) | def reset

FILE: lib/ec2/right_ec2_windows_mobility.rb
  type RightAws (line 24) | module RightAws
    class Ec2 (line 26) | class Ec2
      method describe_licenses (line 28) | def describe_licenses(*license_ids)
      method activate_license (line 33) | def activate_license(license_id, capacity)
      method deactivate_license (line 44) | def deactivate_license(license_id, capacity)
      class QEc2DescribeLicensesParser (line 54) | class QEc2DescribeLicensesParser < RightAWSParser #:nodoc:
        method tagstart (line 55) | def tagstart(name, attributes)
        method tagend (line 61) | def tagend(name)
        method reset (line 77) | def reset

FILE: lib/elb/right_elb_interface.rb
  type RightAws (line 24) | module RightAws
    class ElbInterface (line 61) | class ElbInterface < RightAwsBase
      method bench_xml (line 74) | def self.bench_xml
      method bench_service (line 77) | def self.bench_service
      method initialize (line 92) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 104) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 110) | def request_info(request, parser)  #:nodoc:
      method describe_load_balancers (line 166) | def describe_load_balancers(*load_balancers)
      method create_load_balancer (line 186) | def create_load_balancer(load_balancer_name, availability_zones=[], ...
      method delete_load_balancer (line 209) | def delete_load_balancer(load_balancer_name)
      method create_load_balancer_listeners (line 226) | def create_load_balancer_listeners(load_balancer_name, listeners)
      method delete_load_balancer_listeners (line 237) | def delete_load_balancer_listeners(load_balancer_name, *load_balance...
      method enable_availability_zones_for_load_balancer (line 250) | def enable_availability_zones_for_load_balancer(load_balancer_name, ...
      method disable_availability_zones_for_load_balancer (line 263) | def disable_availability_zones_for_load_balancer(load_balancer_name,...
      method configure_health_check (line 282) | def configure_health_check(load_balancer_name, health_check)
      method describe_instance_health (line 306) | def describe_instance_health(load_balancer_name, *instances)
      method register_instances_with_load_balancer (line 319) | def register_instances_with_load_balancer(load_balancer_name, *insta...
      method deregister_instances_with_load_balancer (line 332) | def deregister_instances_with_load_balancer(load_balancer_name, *ins...
      method create_app_cookie_stickiness_policy (line 350) | def create_app_cookie_stickiness_policy(load_balancer_name, policy_n...
      method create_lb_cookie_stickiness_policy (line 364) | def create_lb_cookie_stickiness_policy(load_balancer_name, policy_na...
      method set_load_balancer_policies_of_listener (line 377) | def set_load_balancer_policies_of_listener(load_balancer_name, load_...
      method delete_load_balancer_policy (line 394) | def delete_load_balancer_policy(load_balancer_name, policy_name)
      method set_load_balancer_listener_ssl_certificate (line 401) | def set_load_balancer_listener_ssl_certificate(load_balancer_name, l...
      method merge_listeners_into_request_hash (line 413) | def merge_listeners_into_request_hash(request_hash, listeners) # :no...
      class DescribeLoadBalancersParser (line 434) | class DescribeLoadBalancersParser < RightAWSParser #:nodoc:
        method tagstart (line 435) | def tagstart(name, attributes)
        method tagend (line 449) | def tagend(name)
        method reset (line 489) | def reset
      class CreateLoadBalancerParser (line 494) | class CreateLoadBalancerParser < RightAWSParser #:nodoc:
        method tagend (line 495) | def tagend(name)
      class DeleteLoadBalancerParser (line 500) | class DeleteLoadBalancerParser < RightAWSParser #:nodoc:
        method tagend (line 501) | def tagend(name)
      class AvailabilityZonesForLoadBalancerParser (line 506) | class AvailabilityZonesForLoadBalancerParser < RightAWSParser #:nodoc:
        method tagend (line 507) | def tagend(name)
        method reset (line 515) | def reset
      class HealthCheckParser (line 520) | class HealthCheckParser < RightAWSParser #:nodoc:
        method tagend (line 521) | def tagend(name)
        method reset (line 530) | def reset
      class DescribeInstanceHealthParser (line 539) | class DescribeInstanceHealthParser < RightAWSParser #:nodoc:
        method tagstart (line 540) | def tagstart(name, attributes)
        method tagend (line 543) | def tagend(name)
        method reset (line 552) | def reset
      class InstancesWithLoadBalancerParser (line 557) | class InstancesWithLoadBalancerParser < RightAWSParser #:nodoc:
        method tagend (line 558) | def tagend(name)
        method reset (line 566) | def reset

FILE: lib/emr/right_emr_interface.rb
  type RightAws (line 24) | module RightAws
    class EmrInterface (line 62) | class EmrInterface < RightAwsBase
      method bench_xml (line 73) | def self.bench_xml
      method bench_service (line 76) | def self.bench_service
      method initialize (line 97) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 109) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 115) | def request_info(request, parser)  #:nodoc:
      method run_job_flow (line 244) | def run_job_flow(options={})
      method describe_job_flows (line 327) | def describe_job_flows(*job_flow_ids_and_options)
      method terminate_job_flows (line 360) | def terminate_job_flows(*job_flow_ids)
      method set_termination_protection (line 380) | def set_termination_protection(*job_flow_ids_and_options)
      method add_job_flow_steps (line 429) | def add_job_flow_steps(job_flow_id, *steps)
      method add_instance_groups (line 460) | def add_instance_groups(job_flow_id, *instance_groups)
      method modify_instance_groups (line 492) | def modify_instance_groups(*args)
      method amazonize_run_job_flow (line 508) | def amazonize_run_job_flow(options) # :nodoc:
      method amazonize_bootstrap_actions (line 519) | def amazonize_bootstrap_actions(bootstrap_actions, key = 'BootstrapA...
      method amazonize_instance_groups (line 538) | def amazonize_instance_groups(instance_groups, key = 'Instances.Inst...
      method amazonize_steps (line 557) | def amazonize_steps(steps, key = 'Steps.member') # :nodoc:
      class RunJobFlowParser (line 586) | class RunJobFlowParser < RightAWSParser #:nodoc:
        method tagend (line 587) | def tagend(name)
        method reset (line 592) | def reset
      class DescribeJobFlowsParser (line 601) | class DescribeJobFlowsParser < RightAWSParser #:nodoc:
        method tagstart (line 602) | def tagstart(name, attributes)
        method tagend (line 617) | def tagend(name)
        method reset (line 707) | def reset
      class AddInstanceGroupsParser (line 716) | class AddInstanceGroupsParser < RightAWSParser #:nodoc:
        method tagend (line 717) | def tagend(name)
        method reset (line 722) | def reset

FILE: lib/iam/right_iam_access_keys.rb
  type RightAws (line 1) | module RightAws
    class IamInterface (line 3) | class IamInterface < RightAwsBase
      method list_access_keys (line 18) | def list_access_keys(options={}, &block)
      method create_access_key (line 33) | def create_access_key(options={})
      method delete_access_key (line 46) | def delete_access_key(access_key_id, options={})
      class ListAccessKeysParser (line 57) | class ListAccessKeysParser < BasicIamListParser #:nodoc:
        method reset (line 58) | def reset
      class CreateAccessKeyParser (line 63) | class CreateAccessKeyParser < BasicIamParser #:nodoc:
        method reset (line 64) | def reset

FILE: lib/iam/right_iam_groups.rb
  type RightAws (line 1) | module RightAws
    class IamInterface (line 3) | class IamInterface < RightAwsBase
      method list_groups (line 19) | def list_groups(options={}, &block)
      method create_group (line 37) | def create_group(group_name, path=nil)
      method update_group (line 50) | def update_group(group_name, options={})
      method get_group (line 73) | def get_group(group_name, options={}, &block)
      method delete_group (line 82) | def delete_group(group_name)
      method list_group_policies (line 98) | def list_group_policies(group_name, options={}, &block)
      method put_group_policy (line 107) | def put_group_policy(group_name, policy_name, policy_document)
      method get_group_policy (line 124) | def get_group_policy(group_name, policy_name)
      method delete_group_policy (line 135) | def delete_group_policy(group_name, policy_name)
      class ListGroupsParser (line 146) | class ListGroupsParser < BasicIamListParser #:nodoc:
        method reset (line 147) | def reset
      class CreateGroupParser (line 152) | class CreateGroupParser < BasicIamParser #:nodoc:
        method reset (line 153) | def reset
      class GetGroupParser (line 158) | class GetGroupParser < RightAWSParser #:nodoc:
        method tagstart (line 159) | def tagstart(name, attributes)
        method tagend (line 162) | def tagend(name)
        method reset (line 181) | def reset
      class GetGroupPolicyParser (line 186) | class GetGroupPolicyParser < BasicIamParser #:nodoc:
        method reset (line 187) | def reset

FILE: lib/iam/right_iam_interface.rb
  type RightAws (line 24) | module RightAws
    class IamInterface (line 43) | class IamInterface < RightAwsBase
      method bench_xml (line 53) | def self.bench_xml
      method bench_service (line 56) | def self.bench_service
      method initialize (line 71) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 83) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 89) | def request_info(request, parser)  #:nodoc:
      method incrementally_list_iam_resources (line 95) | def incrementally_list_iam_resources(api_function, params={}, option...
      method list_server_certificates (line 132) | def list_server_certificates(options={}, &block)
      method upload_server_certificate (line 164) | def upload_server_certificate(server_certificate_name, certificate_b...
      method update_server_certificate (line 180) | def update_server_certificate(server_certificate_name, options={})
      method get_server_certificate (line 200) | def get_server_certificate(server_certificate_name)
      method delete_server_certificate (line 210) | def delete_server_certificate(server_certificate_name)
      method list_signing_certificates (line 230) | def list_signing_certificates(options={}, &block)
      method upload_signing_certificate (line 253) | def upload_signing_certificate(certificate_body, options={})
      method delete_signing_certificate (line 266) | def delete_signing_certificate(certificate_id, options={})
      class BasicIamParser (line 277) | class BasicIamParser < RightAWSParser #:nodoc:
        method tagstart (line 278) | def tagstart(name, attributes)
        method tagend (line 281) | def tagend(name)
      class BasicIamListParser (line 288) | class BasicIamListParser < RightAWSParser #:nodoc:
        method tagstart (line 289) | def tagstart(name, attributes)
        method tagend (line 293) | def tagend(name)
      class GetServerCertificateParser (line 311) | class GetServerCertificateParser < BasicIamParser #:nodoc:
        method reset (line 312) | def reset
      class ListServerCertificatesParser (line 317) | class ListServerCertificatesParser < BasicIamListParser #:nodoc:
        method reset (line 318) | def reset
      class ListSigningCertificatesParser (line 327) | class ListSigningCertificatesParser < BasicIamListParser #:nodoc:
        method reset (line 328) | def reset
      class GetSigningCertificateParser (line 333) | class GetSigningCertificateParser < BasicIamParser #:nodoc:
        method reset (line 334) | def reset

FILE: lib/iam/right_iam_mfa_devices.rb
  type RightAws (line 1) | module RightAws
    class IamInterface (line 3) | class IamInterface < RightAwsBase
      method list_mfa_devices (line 13) | def list_mfa_devices(options={}, &block)
      method enable_mfa_device (line 22) | def enable_mfa_device(user_name, serial_number, auth_code1, auth_code2)
      method resync_mfa_device (line 35) | def resync_mfa_device(user_name, serial_number, auth_code1, auth_code2)
      method deactivate_mfa_device (line 48) | def deactivate_mfa_device(user_name, serial_number)
      class ListMFADevicesParser (line 59) | class ListMFADevicesParser < BasicIamListParser #:nodoc:
        method reset (line 60) | def reset

FILE: lib/iam/right_iam_users.rb
  type RightAws (line 1) | module RightAws
    class IamInterface (line 3) | class IamInterface < RightAwsBase
      method list_users (line 19) | def list_users(options={}, &block)
      method create_user (line 33) | def create_user(user_name, options={})
      method update_user (line 44) | def update_user(user_name, options={})
      method get_user (line 60) | def get_user(user_name)
      method delete_user (line 70) | def delete_user(user_name)
      method list_user_policies (line 86) | def list_user_policies(user_name, options={}, &block)
      method put_user_policy (line 95) | def put_user_policy(user_name, policy_name, policy_document)
      method get_user_policy (line 110) | def get_user_policy(user_name, policy_name)
      method delete_user_policy (line 123) | def delete_user_policy(user_name, policy_name)
      method list_groups_for_user (line 145) | def list_groups_for_user(user_name, options={}, &block)
      method add_user_to_group (line 154) | def add_user_to_group(user_name, group_name)
      method remove_user_from_group (line 165) | def remove_user_from_group(user_name, group_name)
      method create_login_profile (line 181) | def create_login_profile(user_name, password)
      method update_login_profile (line 192) | def update_login_profile(user_name, options={})
      method get_login_profile (line 203) | def get_login_profile(user_name)
      method delete_login_profile (line 214) | def delete_login_profile(user_name)
      class ListUsersParser (line 224) | class ListUsersParser < BasicIamListParser #:nodoc:
        method reset (line 225) | def reset
      class GetUserParser (line 230) | class GetUserParser < BasicIamParser #:nodoc:
        method reset (line 231) | def reset
      class GetUserPolicyParser (line 236) | class GetUserPolicyParser < BasicIamParser #:nodoc:
        method reset (line 237) | def reset
      class GetLoginProfileParser (line 242) | class GetLoginProfileParser < BasicIamParser #:nodoc:
        method reset (line 243) | def reset

FILE: lib/rds/right_rds_interface.rb
  type RightAws (line 24) | module RightAws
    class RdsInterface (line 26) | class RdsInterface < RightAwsBase
      method bench_xml (line 48) | def self.bench_xml
      method bench_service (line 51) | def self.bench_service
      method initialize (line 67) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 84) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 90) | def request_info(request, parser, &block) # :nodoc:
      method incrementally_list_items (line 95) | def incrementally_list_items(action, parser_class, params={}, &block...
      method describe_db_instances (line 169) | def describe_db_instances(*params, &block)
      method create_db_instance (line 210) | def create_db_instance(aws_id, master_username, master_user_password...
      method modify_db_instance (line 282) | def modify_db_instance(aws_id, params={})
      method reboot_db_instance (line 325) | def reboot_db_instance(aws_id, params={})
      method delete_db_instance (line 341) | def delete_db_instance(aws_id, params={})
      method describe_db_security_groups (line 389) | def describe_db_security_groups(*db_security_group_name, &block)
      method create_db_security_group (line 412) | def create_db_security_group(db_security_group_name, db_security_gro...
      method modify_db_security_group_ingress (line 420) | def modify_db_security_group_ingress(action, db_security_group_name,...
      method authorize_db_security_group_ingress (line 459) | def authorize_db_security_group_ingress(db_security_group_name, para...
      method revoke_db_security_group_ingress (line 480) | def revoke_db_security_group_ingress(db_security_group_name, params={})
      method delete_db_security_group (line 489) | def delete_db_security_group(db_security_group_name)
      method describe_db_parameter_groups (line 511) | def describe_db_parameter_groups(*db_parameter_group_name, &block)
      method create_db_parameter_group (line 528) | def create_db_parameter_group(db_parameter_group_name, db_parameter_...
      method modify_db_parameter_group (line 542) | def modify_db_parameter_group(db_parameter_group_name, params={}) # ...
      method delete_db_parameter_group (line 565) | def delete_db_parameter_group(db_parameter_group_name)
      method reset_db_parameter_group (line 579) | def reset_db_parameter_group(db_parameter_group_name, *params)
      method describe_db_parameters (line 624) | def describe_db_parameters(*db_parameter_group_name, &block)
      method describe_engine_default_parameters (line 653) | def describe_engine_default_parameters(*db_parameter_group_family, &...
      method describe_orderable_db_instance_options (line 677) | def describe_orderable_db_instance_options(engine, params={}, &block)
      method describe_db_snapshots (line 737) | def describe_db_snapshots(params={}, &block)
      method create_db_snapshot (line 762) | def create_db_snapshot(aws_id, instance_aws_id)
      method restore_db_instance_from_db_snapshot (line 789) | def restore_db_instance_from_db_snapshot(snapshot_aws_id, instance_a...
      method restore_db_instance_to_point_in_time (line 816) | def restore_db_instance_to_point_in_time(instance_aws_id, new_instan...
      method delete_db_snapshot (line 850) | def delete_db_snapshot(aws_id)
      method describe_events (line 884) | def describe_events(params={}, &block)
      method fix_date (line 899) | def fix_date(date) # :nodoc:
      method describe_db_engine_versions (line 953) | def describe_db_engine_versions(params={}, &block)
      method create_db_instance_read_replica (line 999) | def create_db_instance_read_replica(aws_id, source_db_instance_ident...
      method describe_reserved_db_instances_offerings (line 1057) | def describe_reserved_db_instances_offerings(params={}, &block)
      method describe_reserved_db_instances (line 1084) | def describe_reserved_db_instances(params={}, &block)
      method purchase_reserved_db_instances_offering (line 1102) | def purchase_reserved_db_instances_offering(offering_aws_id, params={})
      method describe_db_subnet_groups (line 1147) | def describe_db_subnet_groups(params={}, &block)
      method get_db_subnet_group (line 1158) | def get_db_subnet_group(group_name, &block)
      method create_db_subnet_group (line 1181) | def create_db_subnet_group(subnet_group_name, subnets, subnet_group_...
      method modify_db_subnet_group (line 1208) | def modify_db_subnet_group(subnet_group_name, subnets, subnet_group_...
      method delete_db_subnet_group (line 1222) | def delete_db_subnet_group(name)
      class DescribeDbInstancesParser (line 1235) | class DescribeDbInstancesParser < RightAWSParser # :nodoc:
        method reset (line 1236) | def reset
        method tagstart (line 1239) | def tagstart(name, attributes)
        method tagend (line 1252) | def tagend(name)
      class DescribeOrderableDBInstanceOptionsParser (line 1316) | class DescribeOrderableDBInstanceOptionsParser < RightAWSParser # :n...
        method reset (line 1317) | def reset
        method tagstart (line 1320) | def tagstart(name, attributes)
        method tagend (line 1325) | def tagend(name)
      class DescribeDbSecurityGroupsParser (line 1346) | class DescribeDbSecurityGroupsParser < RightAWSParser # :nodoc:
        method reset (line 1347) | def reset
        method tagstart (line 1350) | def tagstart(name, attributes)
        method tagend (line 1357) | def tagend(name)
      class DescribeDbParameterGroupsParser (line 1389) | class DescribeDbParameterGroupsParser < RightAWSParser # :nodoc:
        method reset (line 1390) | def reset
        method tagstart (line 1393) | def tagstart(name, attributes)
        method tagend (line 1399) | def tagend(name)
      class DescribeDbParametersParser (line 1412) | class DescribeDbParametersParser < RightAWSParser # :nodoc:
        method reset (line 1413) | def reset
        method tagstart (line 1416) | def tagstart(name, attributes)
        method tagend (line 1421) | def tagend(name)
      class DescribeDbSnapshotsParser (line 1446) | class DescribeDbSnapshotsParser < RightAWSParser # :nodoc:
        method reset (line 1447) | def reset
        method tagstart (line 1450) | def tagstart(name, attributes)
        method tagend (line 1455) | def tagend(name)
      class DescribeEventsParser (line 1483) | class DescribeEventsParser < RightAWSParser # :nodoc:
        method reset (line 1484) | def reset
        method tagstart (line 1487) | def tagstart(name, attributes)
        method tagend (line 1492) | def tagend(name)
      class DescribeDBEngineVersionsParser (line 1509) | class DescribeDBEngineVersionsParser < RightAWSParser # :nodoc:
        method reset (line 1510) | def reset
        method tagstart (line 1513) | def tagstart(name, attributes)
        method tagend (line 1523) | def tagend(name)
      class DescribeReservedDBInstancesOfferingsParser (line 1549) | class DescribeReservedDBInstancesOfferingsParser < RightAWSParser # ...
        method reset (line 1550) | def reset
        method tagstart (line 1553) | def tagstart(name, attributes)
        method tagend (line 1559) | def tagend(name)
      class DescribeReservedDBInstancesParser (line 1583) | class DescribeReservedDBInstancesParser < RightAWSParser # :nodoc:
        method reset (line 1584) | def reset
        method tagstart (line 1587) | def tagstart(name, attributes)
        method tagend (line 1593) | def tagend(name)
      class DescribeDBSubnetGroupsParser (line 1625) | class DescribeDBSubnetGroupsParser < RightAWSParser # :nodoc:
        method reset (line 1626) | def reset
        method tagstart (line 1629) | def tagstart(name, attributes)
        method tagend (line 1635) | def tagend(name)

FILE: lib/right_aws.rb
  type Rightscale (line 83) | module Rightscale #:nodoc:

FILE: lib/route_53/right_route_53_interface.rb
  type RightAws (line 23) | module RightAws
    class Route53Interface (line 157) | class Route53Interface < RightAwsBase
      method bench_xml (line 168) | def self.bench_xml
      method bench_service (line 171) | def self.bench_service
      method initialize (line 185) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 202) | def generate_request(method, path, params={}, body=nil, headers={}) ...
      method request_info (line 230) | def request_info(request, parser, &block) # :nodoc:
      method incrementally_list_hosted_zones (line 234) | def incrementally_list_hosted_zones(path, parser, params={}, &block)...
      method incrementally_list_resource_records (line 248) | def incrementally_list_resource_records(path, parser, params={}, &bl...
      method expand_hosted_zone_id (line 263) | def expand_hosted_zone_id(aws_id) # :nodoc:
      method expand_change_id (line 267) | def expand_change_id(aws_id) # :nodoc:
      method hosted_zone_config_to_xml (line 271) | def hosted_zone_config_to_xml(config) # :nodoc:
      method resource_record_sets_to_xml (line 288) | def resource_record_sets_to_xml(resource_record_changes, comment) # ...
      method list_hosted_zones (line 349) | def list_hosted_zones
      method create_hosted_zone (line 383) | def create_hosted_zone(config)
      method get_hosted_zone (line 404) | def get_hosted_zone(hosted_zone_aws_id)
      method delete_hosted_zone (line 418) | def delete_hosted_zone(hosted_zone_aws_id)
      method list_resource_record_sets (line 451) | def list_resource_record_sets(hosted_zone_aws_id, options={})
      method change_resource_record_sets (line 481) | def change_resource_record_sets(hosted_zone_aws_id, resource_record_...
      method create_resource_record_sets (line 503) | def create_resource_record_sets(hosted_zone_aws_id, resource_record_...
      method delete_resource_record_sets (line 525) | def delete_resource_record_sets(hosted_zone_aws_id, resource_record_...
      method get_change (line 540) | def get_change(change_aws_id)
      class ListHostedZonesParser (line 549) | class ListHostedZonesParser < RightAWSParser # :nodoc:
        method reset (line 550) | def reset
        method tagstart (line 553) | def tagstart(name, attributes)
        method tagend (line 558) | def tagend(name)
      class GetHostedZoneParser (line 575) | class GetHostedZoneParser < RightAWSParser # :nodoc:
        method reset (line 576) | def reset
        method tagend (line 579) | def tagend(name)
      class ListResourceRecordSetsParser (line 597) | class ListResourceRecordSetsParser < RightAWSParser # :nodoc:
        method reset (line 598) | def reset
        method tagstart (line 601) | def tagstart(name, attributes)
        method tagend (line 606) | def tagend(name)
      class GetChangeParser (line 626) | class GetChangeParser < RightAWSParser # :nodoc:
        method reset (line 627) | def reset
        method tagend (line 630) | def tagend(name)

FILE: lib/s3/right_s3.rb
  type RightAws (line 24) | module RightAws
    class S3 (line 50) | class S3
      method initialize (line 63) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method buckets (line 73) | def buckets
      method bucket (line 99) | def bucket(name, create=false, perms=nil, headers={})
      class Bucket (line 121) | class Bucket
        method create (line 144) | def self.create(s3, name, create=false, perms=nil, headers={})
        method initialize (line 152) | def initialize(s3, name, creation_date=nil, owner=nil)
        method to_s (line 167) | def to_s
        method public_link (line 176) | def public_link
        method location (line 182) | def location
        method logging_info (line 191) | def logging_info
        method enable_logging (line 203) | def enable_logging(params)
        method disable_logging (line 211) | def disable_logging
        method keys (line 224) | def keys(options={}, head=false)
        method keys_and_service (line 235) | def keys_and_service(options={}, head=false)
        method key (line 262) | def key(key_name, head=false, &blck)
        method put (line 286) | def put(key, data=nil, meta_headers={}, perms=nil, headers={}, &blck)
        method get (line 298) | def get(key, headers={})
        method rename_key (line 309) | def rename_key(old_key_or_name, new_name)
        method copy_key (line 321) | def copy_key(old_key_or_name, new_key_or_name)
        method move_key (line 332) | def move_key(old_key_or_name, new_key_or_name)
        method clear (line 342) | def clear
        method delete_folder (line 353) | def delete_folder(folder, separator='/')
        method delete (line 363) | def delete(options={})
        method grantees (line 370) | def grantees
      class Key (line 377) | class Key
        method split_meta (line 383) | def self.split_meta(headers) #:nodoc:
        method add_meta_prefix (line 395) | def self.add_meta_prefix(meta_headers, prefix=S3Interface::AMAZON_...
        method create (line 417) | def self.create(bucket, name, data=nil, meta_headers={})
        method initialize (line 425) | def initialize(bucket, name, data=nil, headers={}, meta_headers={},
        method to_s (line 448) | def to_s
        method full_name (line 456) | def full_name(separator='/')
        method public_link (line 464) | def public_link
        method data (line 472) | def data
        method content_type (line 478) | def content_type
        method decoded_meta_headers (line 485) | def decoded_meta_headers(key = nil)
        method get (line 504) | def get(headers={})
        method put (line 522) | def put(data=nil, perms=nil, headers={}, &blck)
        method put_multipart (line 544) | def put_multipart(data=nil, perms=nil, headers={}, part_size=nil)
        method rename (line 558) | def rename(new_name)
        method copy (line 581) | def copy(new_key_or_name)
        method move (line 605) | def move(new_key_or_name)
        method refresh (line 622) | def refresh(head=true)
        method head (line 645) | def head
        method reload_meta (line 654) | def reload_meta
        method save_meta (line 664) | def save_meta(meta_headers)
        method exists? (line 678) | def exists?
        method delete (line 687) | def delete
        method grantees (line 694) | def grantees
      class Owner (line 701) | class Owner
        method initialize (line 704) | def initialize(id, name)
        method to_s (line 710) | def to_s
      class Grantee (line 743) | class Grantee
        method owner_and_grantees (line 760) | def self.owner_and_grantees(thing)
        method grantees (line 782) | def self.grantees(thing)
        method put_acl (line 786) | def self.put_acl(thing, owner, grantees) #:nodoc:
        method initialize (line 817) | def initialize(thing, id, perms=[], action=:refresh, name=nil)
        method exists? (line 830) | def exists?
        method type (line 838) | def type
        method to_s (line 847) | def to_s
        method grant (line 860) | def grant(*permissions)
        method revoke (line 879) | def revoke(*permissions)
        method drop (line 893) | def drop
        method refresh (line 907) | def refresh
        method apply (line 926) | def apply
        method to_xml (line 937) | def to_xml   # :nodoc:
    class S3Generator (line 995) | class S3Generator
      method initialize (line 998) | def initialize(aws_access_key_id, aws_secret_access_key, params={})
      method buckets (line 1006) | def buckets(expires=nil, headers={})
      method bucket (line 1014) | def bucket(name, expires=nil, headers={})
      class Bucket (line 1018) | class Bucket
        method to_s (line 1021) | def to_s
        method public_link (line 1030) | def public_link
        method create (line 1036) | def self.create(s3, name, expires=nil, headers={})
        method initialize (line 1041) | def initialize(s3, name)
        method create_link (line 1047) | def create_link(expires=nil, headers={})
        method keys (line 1056) | def keys(options=nil, expires=nil, headers={})
        method key (line 1065) | def key(name)
        method put (line 1073) | def put(key, meta_headers={}, expires=nil, headers={})
        method get (line 1082) | def get(key, expires=nil, headers={}, response_params={})
        method delete (line 1090) | def delete(expires=nil,  headers={})
      class Key (line 1096) | class Key
        method to_s (line 1099) | def to_s
        method full_name (line 1107) | def full_name(separator='/')
        method public_link (line 1115) | def public_link
        method initialize (line 1120) | def initialize(bucket, name, meta_headers={})
        method put (line 1131) | def put(expires=nil, headers={})
        method get (line 1139) | def get(expires=nil, headers={}, response_params={})
        method delete (line 1147) | def delete(expires=nil,  headers={})
        method head (line 1155) | def head(expires=nil,  headers={})

FILE: lib/s3/right_s3_interface.rb
  type RightAws (line 24) | module RightAws
    class S3Interface (line 26) | class S3Interface < RightAwsBase
      method bench_xml (line 61) | def self.bench_xml
      method bench_s3 (line 64) | def self.bench_s3
      method params (line 71) | def self.params
      method param (line 76) | def param(name)
      method initialize (line 94) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method canonical_string (line 110) | def canonical_string(method, path, headers={}, expires=nil) # :nodoc:
      method is_dns_bucket? (line 147) | def is_dns_bucket?(bucket_name)
      method fetch_request_params (line 156) | def fetch_request_params(headers) #:nodoc:
      method generate_rest_request (line 181) | def generate_rest_request(method, headers)  # :nodoc:
      method request_info (line 209) | def request_info(request, parser, &block) # :nodoc:
      method list_all_my_buckets (line 221) | def list_all_my_buckets(headers={})
      method create_bucket (line 235) | def create_bucket(bucket, headers={})
      method bucket_location (line 261) | def bucket_location(bucket, headers={})
      method get_logging_parse (line 275) | def get_logging_parse(params)
      method put_logging (line 289) | def put_logging(params)
      method delete_bucket (line 305) | def delete_bucket(bucket, headers={})
      method list_bucket (line 328) | def list_bucket(bucket, options={}, headers={})
      method incrementally_list_bucket (line 363) | def incrementally_list_bucket(bucket, options={}, headers={}, &block)
      method decide_marker (line 385) | def decide_marker(response)
      method under_max_keys (line 399) | def under_max_keys(internal_options)
      method put (line 438) | def put(bucket, key, data=nil, headers={}, &blck)
      method store_object (line 484) | def store_object(params)
      method store_object_and_verify (line 528) | def store_object_and_verify(params)
      method store_object_multipart (line 555) | def store_object_multipart(params)
      class S3MultipartUploadInitiateResponseParser (line 629) | class S3MultipartUploadInitiateResponseParser < RightAWSParser
        method reset (line 630) | def reset
        method headers_to_string (line 633) | def headers_to_string(headers)
        method tagend (line 641) | def tagend(name)
      class S3CompleteMultipartParser (line 648) | class S3CompleteMultipartParser < RightAWSParser  # :nodoc:
        method reset (line 649) | def reset
        method tagend (line 652) | def tagend(name)
      method get (line 689) | def get(bucket, key, headers={}, &block)
      method retrieve_object (line 737) | def retrieve_object(params, &block)
      method retrieve_object_and_verify (line 755) | def retrieve_object_and_verify(params, &block)
      method head (line 775) | def head(bucket, key, headers={})
      method delete (line 786) | def delete(bucket, key='', headers={})
      method delete_multiple (line 798) | def delete_multiple(bucket, keys=[], headers={})
      method copy (line 834) | def copy(src_bucket, src_key, dest_bucket, dest_key=nil, directive=:...
      method move (line 854) | def move(src_bucket, src_key, dest_bucket, dest_key=nil, directive=:...
      method rename (line 866) | def rename(src_bucket, src_key, dest_key, headers={})
      method get_acl (line 885) | def get_acl(bucket, key='', headers={})
      method get_acl_parse (line 915) | def get_acl_parse(bucket, key='', headers={})
      method put_acl (line 939) | def put_acl(bucket, key, acl_xml_doc, headers={})
      method get_bucket_acl (line 948) | def get_bucket_acl(bucket, headers={})
      method put_bucket_acl (line 955) | def put_bucket_acl(bucket, acl_xml_doc, headers={})
      method clear_bucket (line 966) | def clear_bucket(bucket)
      method force_delete_bucket (line 979) | def force_delete_bucket(bucket)
      method delete_folder (line 991) | def delete_folder(bucket, folder_key, separator='/')
      method get_object (line 1008) | def get_object(bucket, key, headers={})
      method s3_link_escape (line 1018) | def s3_link_escape(text)
      method generate_link (line 1024) | def generate_link(method, headers={}, expires=nil) #:nodoc:
      method list_all_my_buckets_link (line 1049) | def list_all_my_buckets_link(expires=nil, headers={})
      method create_bucket_link (line 1059) | def create_bucket_link(bucket, expires=nil, headers={})
      method delete_bucket_link (line 1069) | def delete_bucket_link(bucket, expires=nil,  headers={})
      method list_bucket_link (line 1079) | def list_bucket_link(bucket, options=nil, expires=nil, headers={})
      method put_link (line 1090) | def put_link(bucket, key, data=nil, expires=nil, headers={})
      method get_link (line 1115) | def get_link(bucket, key, expires=nil, headers={}, response_params={})
      method head_link (line 1130) | def head_link(bucket, key, expires=nil,  headers={})
      method delete_link (line 1140) | def delete_link(bucket, key, expires=nil, headers={})
      method get_acl_link (line 1151) | def get_acl_link(bucket, key='', headers={})
      method put_acl_link (line 1161) | def put_acl_link(bucket, key='', headers={})
      method get_bucket_acl_link (line 1171) | def get_bucket_acl_link(bucket, headers={})
      method put_bucket_acl_link (line 1181) | def put_bucket_acl_link(bucket, acl_xml_doc, headers={})
      class S3DeleteMultipleParser (line 1187) | class S3DeleteMultipleParser < RightAWSParser # :nodoc:
        method reset (line 1188) | def reset
        method tagstart (line 1191) | def tagstart(name, attributes)
        method tagend (line 1194) | def tagend(name)
      class S3ListAllMyBucketsParser (line 1208) | class S3ListAllMyBucketsParser < RightAWSParser # :nodoc:
        method reset (line 1209) | def reset
        method tagstart (line 1213) | def tagstart(name, attributes)
        method tagend (line 1216) | def tagend(name)
      class S3ListBucketParser (line 1227) | class S3ListBucketParser < RightAWSParser  # :nodoc:
        method reset (line 1228) | def reset
        method tagstart (line 1233) | def tagstart(name, attributes)
        method tagend (line 1236) | def tagend(name)
      class S3ImprovedListBucketParser (line 1260) | class S3ImprovedListBucketParser < RightAWSParser  # :nodoc:
        method reset (line 1261) | def reset
        method tagstart (line 1270) | def tagstart(name, attributes)
        method tagend (line 1274) | def tagend(name)
      class S3BucketLocationParser (line 1304) | class S3BucketLocationParser < RightAWSParser # :nodoc:
        method reset (line 1305) | def reset
        method tagend (line 1308) | def tagend(name)
      class S3AclParser (line 1313) | class S3AclParser < RightAWSParser  # :nodoc:
        method reset (line 1314) | def reset
        method tagstart (line 1318) | def tagstart(name, attributes)
        method tagend (line 1321) | def tagend(name)
      class S3LoggingParser (line 1346) | class S3LoggingParser < RightAWSParser  # :nodoc:
        method reset (line 1347) | def reset
        method tagend (line 1351) | def tagend(name)
      class S3CopyParser (line 1368) | class S3CopyParser < RightAWSParser  # :nodoc:
        method reset (line 1369) | def reset
        method tagend (line 1372) | def tagend(name)
      class S3HttpResponseParser (line 1384) | class S3HttpResponseParser   # :nodoc:
        method parse (line 1386) | def parse(response)
        method headers_to_string (line 1389) | def headers_to_string(headers)
      class S3HttpResponseBodyParser (line 1399) | class S3HttpResponseBodyParser < S3HttpResponseParser  # :nodoc:
        method parse (line 1400) | def parse(response)
      class S3HttpResponseHeadParser (line 1408) | class S3HttpResponseHeadParser < S3HttpResponseParser  # :nodoc:
        method parse (line 1409) | def parse(response)

FILE: lib/sdb/active_sdb.rb
  type RightAws (line 24) | module RightAws
    class ActiveSdb (line 138) | class ActiveSdb
      type ActiveSdbConnect (line 140) | module ActiveSdbConnect
        function connection (line 141) | def connection
        function establish_connection (line 155) | def establish_connection(aws_access_key_id=nil, aws_secret_access_...
      class ActiveSdbError (line 160) | class ActiveSdbError < RuntimeError ; end
      method domains (line 169) | def domains
      method create_domain (line 178) | def create_domain(domain_name)
      method delete_domain (line 187) | def delete_domain(domain_name)
      class Base (line 192) | class Base
        method connection (line 220) | def connection
        method domain (line 245) | def domain
        method set_domain_name (line 262) | def set_domain_name(domain)
        method create_domain (line 273) | def create_domain
        method delete_domain (line 284) | def delete_domain
        method columns (line 288) | def columns(&block)
        method column? (line 294) | def column?(col_name)
        method type_of (line 298) | def type_of(col_name)
        method serialize (line 302) | def serialize(attribute, value)
        method deserialize (line 307) | def deserialize(attribute, value)
        method find (line 365) | def find(*args)
        method select (line 423) | def select(*args)
        method generate_id (line 432) | def generate_id # :nodoc:
        method select_from_ids (line 440) | def select_from_ids(args, options) # :nodoc:
        method sql_select (line 471) | def sql_select(options) # :nodoc:
        method select_all_by_ (line 487) | def select_all_by_(format_str, args, options) # :nodoc:
        method select_by_ (line 494) | def select_by_(format_str, args, options) # :nodoc:
        method query_attributes (line 504) | def query_attributes(query_expression) # :nodoc:
        method sort_options (line 515) | def sort_options(sort_string)
        method query (line 528) | def query(options) # :nodoc:
        method reload_if_exists (line 560) | def reload_if_exists(record) # :nodoc:
        method reload_all_records (line 564) | def reload_all_records(*list) # :nodoc:
        method find_every (line 568) | def find_every(options) # :nodoc:
        method find_initial (line 576) | def find_initial(options) # :nodoc:
        method find_from_ids (line 582) | def find_from_ids(args, options) # :nodoc:
        method find_all_by_ (line 614) | def find_all_by_(format_str, args, options) # :nodoc:
        method find_by_ (line 621) | def find_by_(format_str, args, options) # :nodoc:
        method method_missing (line 628) | def method_missing(method, *args) # :nodoc:
        method build_select (line 637) | def build_select(options) # :nodoc:
        method build_conditions (line 651) | def build_conditions(conditions) # :nodoc:
        method serialization_for_type (line 659) | def serialization_for_type(type)
        method initialize (line 684) | def initialize(attrs={})
        method create (line 695) | def self.create(attributes={})
        method id (line 702) | def id
        method id= (line 707) | def id=(id)
        method attributes (line 715) | def attributes
        method attributes= (line 730) | def attributes=(attrs)
        method columns (line 737) | def columns
        method connection (line 741) | def connection
        method domain (line 746) | def domain
        method [] (line 754) | def [](attribute)
        method []= (line 765) | def []=(attribute, values)
        method reload (line 782) | def reload
        method reload_attributes (line 805) | def reload_attributes(*attrs_list)
        method put (line 838) | def put
        method put_attributes (line 854) | def put_attributes(attrs)
        method save (line 888) | def save
        method save_attributes (line 902) | def save_attributes(attrs)
        method delete_values (line 926) | def delete_values(attrs)
        method delete_attributes (line 955) | def delete_attributes(*attrs_list)
        method delete (line 975) | def delete
        method to_s (line 981) | def to_s
        method new_record? (line 986) | def new_record?
        method mark_as_old (line 990) | def mark_as_old  # :nodoc:
        method method_missing (line 995) | def method_missing(method_sym, *args)
        method raise_on_id_absence (line 1009) | def raise_on_id_absence
        method prepare_for_update (line 1013) | def prepare_for_update
        method uniq_values (line 1020) | def uniq_values(attributes=nil) # :nodoc:
      class ColumnSet (line 1038) | class ColumnSet
        method initialize (line 1040) | def initialize
        method all (line 1044) | def all
        method column (line 1048) | def column(col_name)
        method type_of (line 1053) | def type_of(col_name)
        method default (line 1057) | def default(col_name)
        method method_missing (line 1063) | def method_missing(method_sym, *args)
      class DateTimeSerialization (line 1070) | class DateTimeSerialization
        method serialize (line 1072) | def serialize(date)
        method deserialize (line 1076) | def deserialize(string)
      class BooleanSerialization (line 1082) | class BooleanSerialization
        method serialize (line 1084) | def serialize(boolean)
        method deserialize (line 1088) | def deserialize(string)
      class IntegerSerialization (line 1094) | class IntegerSerialization
        method serialize (line 1096) | def serialize(int)
        method deserialize (line 1100) | def deserialize(string)

FILE: lib/sdb/right_sdb_interface.rb
  type RightAws (line 26) | module RightAws
    class SdbInterface (line 28) | class SdbInterface < RightAwsBase
      method bench_xml (line 40) | def self.bench_xml; @@bench.xml;     end
      method bench_sdb (line 41) | def self.bench_sdb; @@bench.service; end
      method initialize (line 61) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 79) | def generate_request(action, params={}) #:nodoc:
      method request_info (line 85) | def request_info(request, parser)  #:nodoc:
      method pack_attributes (line 91) | def pack_attributes(items_or_attributes, replace = false, batch = fa...
      method pack_single_item_attributes (line 107) | def pack_single_item_attributes(attributes, replace, prefix = "")
      method escape (line 139) | def escape(value)
      method ruby_to_sdb (line 145) | def ruby_to_sdb(value)
      method sdb_to_ruby (line 151) | def sdb_to_ruby(value)
      method select_response_to_ruby (line 157) | def select_response_to_ruby(response) #:nodoc:
      method query_expression_from_array (line 171) | def query_expression_from_array(params) #:nodoc:
      method query_expression_from_hash (line 183) | def query_expression_from_hash(hash)
      method list_domains (line 217) | def list_domains(max_number_of_domains = nil, next_token = nil )
      method create_domain (line 249) | def create_domain(domain_name)
      method domain_metadata (line 273) | def domain_metadata(domain)
      method delete_domain (line 291) | def delete_domain(domain_name)
      method put_attributes (line 340) | def put_attributes(domain_name, item_name, attributes, replace = false)
      method batch_put_attributes (line 372) | def batch_put_attributes(domain_name, items, replace = false)
      method get_attributes (line 412) | def get_attributes(domain_name, item_name, attribute_name=nil, consi...
      method delete_attributes (line 442) | def delete_attributes(domain_name, item_name, attributes = nil)
      method query (line 488) | def query(domain_name, query_expression = nil, max_number_of_items =...
      method query_with_attributes (line 556) | def query_with_attributes(domain_name, attributes=[], query_expressi...
      method select (line 622) | def select(select_expression, next_token = nil)
      class QSdbGenericParser (line 647) | class QSdbGenericParser < RightAWSParser #:nodoc:
        method reset (line 648) | def reset
        method tagend (line 651) | def tagend(name)
      class QSdbListDomainParser (line 659) | class QSdbListDomainParser < RightAWSParser #:nodoc:
        method reset (line 660) | def reset
        method tagend (line 663) | def tagend(name)
      class QSdbSimpleParser (line 673) | class QSdbSimpleParser < RightAWSParser #:nodoc:
        method reset (line 674) | def reset
        method tagend (line 677) | def tagend(name)
      class QSdbGetAttributesParser (line 685) | class QSdbGetAttributesParser < RightAWSParser #:nodoc:
        method reset (line 686) | def reset
        method tagend (line 690) | def tagend(name)
      class QSdbQueryParser (line 700) | class QSdbQueryParser < RightAWSParser #:nodoc:
        method reset (line 701) | def reset
        method tagend (line 704) | def tagend(name)
      class QSdbQueryWithAttributesParser (line 714) | class QSdbQueryWithAttributesParser < RightAWSParser #:nodoc:
        method reset (line 715) | def reset
        method tagend (line 718) | def tagend(name)
      class QSdbSelectParser (line 737) | class QSdbSelectParser < RightAWSParser #:nodoc:
        method reset (line 738) | def reset
        method tagend (line 741) | def tagend(name)

FILE: lib/sns/right_sns_interface.rb
  type RightAws (line 24) | module RightAws
    class SnsInterface (line 25) | class SnsInterface < RightAwsBase
      method bench_xml (line 36) | def self.bench_xml
      method bench_service (line 39) | def self.bench_service
      method initialize (line 43) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 62) | def generate_request(action, params={})  # :nodoc:
      method generate_rest_request (line 84) | def generate_rest_request(method, param) # :nodoc:
      method request_info (line 113) | def request_info(request, parser) # :nodoc:
      method create_topic (line 117) | def create_topic(topic_name)
      method list_topics (line 122) | def list_topics()
      method delete_topic (line 127) | def delete_topic(topic_arn)
      method subscribe (line 132) | def subscribe(topic_arn, protocol, endpoint)
      method unsubscribe (line 137) | def unsubscribe(subscription_arn)
      method publish (line 142) | def publish(topic_arn, message, subject)
      method set_topic_attribute (line 147) | def set_topic_attribute(topic_arn, attribute_name, attribute_value)
      method get_topic_attributes (line 155) | def get_topic_attributes(topic_arn)
      method list_subscriptions (line 161) | def list_subscriptions(topic_arn = nil)
      method confirm_subscription (line 166) | def confirm_subscription(topic_arn, token, authenticate_on_unsubscri...
      method add_permission (line 171) | def add_permission(topic_arn, label, acct_action_hash_ary)
      method remove_permission (line 186) | def remove_permission(topic_arn, label)
      class SnsCreateTopicParser (line 191) | class SnsCreateTopicParser < RightAWSParser # :nodoc:
        method reset (line 192) | def reset
        method tagend (line 196) | def tagend(name)
      class SnsListTopicsParser (line 204) | class SnsListTopicsParser < RightAWSParser # :nodoc:
        method reset (line 205) | def reset
        method tagstart (line 209) | def tagstart(name, attributes)
        method tagend (line 212) | def tagend(name)
      class SnsSubscribeParser (line 221) | class SnsSubscribeParser < RightAWSParser # :nodoc:
        method reset (line 222) | def reset
        method tagend (line 225) | def tagend(name)
      class SnsPublishParser (line 232) | class SnsPublishParser < RightAWSParser # :nodoc:
        method reset (line 233) | def reset
        method tagend (line 236) | def tagend(name)
      class SnsGetTopicAttributesParser (line 243) | class SnsGetTopicAttributesParser < RightAWSParser # :nodoc:
        method reset (line 244) | def reset
        method tagend (line 247) | def tagend(name)
      class SnsListSubscriptionsParser (line 255) | class SnsListSubscriptionsParser < RightAWSParser # :nodoc:
        method reset (line 256) | def reset
        method tagstart (line 259) | def tagstart(name, attributes)
        method tagend (line 262) | def tagend(name)
      class SnsConfirmSubscriptionParser (line 274) | class SnsConfirmSubscriptionParser < RightAWSParser # :nodoc:
        method reset (line 275) | def reset
        method tagend (line 278) | def tagend(name)

FILE: lib/sqs/right_sqs.rb
  type RightAws (line 24) | module RightAws
    class Sqs (line 65) | class Sqs
      method initialize (line 68) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method queues (line 77) | def queues(prefix=nil)
      method queue (line 88) | def queue(queue_name, create=true, visibility=nil)
      class Queue (line 95) | class Queue
        method create (line 103) | def self.create(sqs, url_or_name, create=true, visibility=nil)
        method initialize (line 112) | def initialize(sqs, url_or_name)
        method size (line 122) | def size
        method clear (line 140) | def clear(force=false)
        method delete (line 154) | def delete(force=false)
        method send_message (line 160) | def send_message(message)
        method receive_messages (line 173) | def receive_messages(number_of_messages=1, visibility=nil)
        method receive (line 187) | def receive(visibility=nil)
        method peek (line 196) | def peek(message_id)
        method pop (line 208) | def pop
        method visibility (line 219) | def visibility
        method visibility= (line 230) | def visibility=(visibility_timeout)
        method set_attribute (line 242) | def set_attribute(attribute, value)
        method get_attribute (line 253) | def get_attribute(attribute='All')
        method grantees (line 266) | def grantees(grantee_email_address=nil, permission = nil)
      class Message (line 281) | class Message
        method initialize (line 285) | def initialize(queue, id=nil, body=nil, visibility=nil)
        method to_s (line 295) | def to_s
        method visibility= (line 301) | def visibility=(visibility_timeout)
        method delete (line 308) | def delete
      class Grantee (line 314) | class Grantee
        method initialize (line 323) | def initialize(queue, email=nil, id=nil, name=nil, perms=[])
        method retrieve (line 335) | def retrieve # :nodoc:
        method grant (line 353) | def grant(permission=nil)
        method revoke (line 364) | def revoke(permission='FULLCONTROL')
        method drop (line 376) | def drop

FILE: lib/sqs/right_sqs_gen2.rb
  type RightAws (line 24) | module RightAws
    class SqsGen2 (line 65) | class SqsGen2
      method initialize (line 68) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method queues (line 77) | def queues(prefix=nil)
      method queue (line 88) | def queue(queue_name, create=true, visibility=nil)
      class Queue (line 95) | class Queue
        method create (line 103) | def self.create(sqs, url_or_name, create=true, visibility=nil)
        method initialize (line 112) | def initialize(sqs, url_or_name)
        method size (line 122) | def size
        method clear (line 137) | def clear()
        method delete (line 148) | def delete(force=false)
        method send_message (line 154) | def send_message(message)
        method receive_messages (line 169) | def receive_messages(number_of_messages=1, visibility=nil, attribu...
        method receive (line 184) | def receive(visibility=nil, attributes=nil)
        method pop (line 198) | def pop(attributes=nil)
        method visibility (line 213) | def visibility
        method visibility= (line 224) | def visibility=(visibility_timeout)
        method set_attribute (line 239) | def set_attribute(attribute, value)
        method get_attribute (line 250) | def get_attribute(attribute='All')
        method get_attributes (line 268) | def get_attributes(*attributes)
        method add_permissions (line 277) | def add_permissions(label, grantees, actions)
        method remove_permissions (line 285) | def remove_permissions(label)
        method get_permissions (line 299) | def get_permissions
      class Message (line 305) | class Message
        method initialize (line 309) | def initialize(queue, id=nil, rh = nil, body=nil, visibility=nil, ...
        method to_s (line 323) | def to_s
        method visibility= (line 328) | def visibility=(visibility_timeout)
        method delete (line 335) | def delete

FILE: lib/sqs/right_sqs_gen2_interface.rb
  type RightAws (line 24) | module RightAws
    class SqsGen2Interface (line 38) | class SqsGen2Interface < RightAwsBase
      method bench_xml (line 50) | def self.bench_xml
      method bench_sqs (line 53) | def self.bench_sqs
      method api (line 58) | def self.api
      method initialize (line 77) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 93) | def generate_request(action, param={})  # :nodoc:
      method generate_post_request (line 116) | def generate_post_request(action, param={})  # :nodoc:
      method request_info (line 141) | def request_info(request, parser) # :nodoc:
      method create_queue (line 149) | def create_queue(queue_name, default_visibility_timeout=nil)
      method list_queues (line 165) | def list_queues(queue_name_prefix=nil)
      method delete_queue (line 180) | def delete_queue(queue_url)
      method get_queue_attributes (line 201) | def get_queue_attributes(queue_url, *attributes)
      method set_queue_attributes (line 225) | def set_queue_attributes(queue_url, attribute, value)
      method add_permissions (line 246) | def add_permissions(queue_url, label, grantees, actions)
      method remove_permissions (line 263) | def remove_permissions(queue_url, label)
      method receive_message (line 281) | def receive_message(queue_url, max_number_of_messages=1, visibility_...
      method change_message_visibility (line 299) | def change_message_visibility(queue_url, receipt_handle, visibility_...
      method send_message (line 320) | def send_message(queue_url, message)
      method delete_message (line 344) | def delete_message(queue_url, receipt_handle)
      method queue_url_by_name (line 354) | def queue_url_by_name(queue_name)
      method queue_name_by_url (line 369) | def self.queue_name_by_url(queue_url)
      method queue_name_by_url (line 379) | def queue_name_by_url(queue_url)
      method get_queue_length (line 389) | def get_queue_length(queue_url)
      method clear_queue (line 401) | def clear_queue(queue_url)
      method pop_messages (line 414) | def pop_messages(queue_url, number_of_messages=1, attributes=nil)
      method pop_message (line 429) | def pop_message(queue_url, attributes=nil)
      class SqsStatusParser (line 440) | class SqsStatusParser < RightAWSParser # :nodoc:
        method tagend (line 441) | def tagend(name)
      class SqsCreateQueueParser (line 452) | class SqsCreateQueueParser < RightAWSParser # :nodoc:
        method tagend (line 453) | def tagend(name)
      class SqsListQueuesParser (line 458) | class SqsListQueuesParser < RightAWSParser # :nodoc:
        method reset (line 459) | def reset
        method tagend (line 462) | def tagend(name)
      class SqsGetQueueAttributesParser (line 467) | class SqsGetQueueAttributesParser < RightAWSParser # :nodoc:
        method reset (line 468) | def reset
        method tagend (line 471) | def tagend(name)
      class SqsReceiveMessageParser (line 483) | class SqsReceiveMessageParser < RightAWSParser # :nodoc:
        method reset (line 484) | def reset
        method tagstart (line 487) | def tagstart(name, attributes)
        method tagend (line 496) | def tagend(name)
      class SqsSendMessagesParser (line 509) | class SqsSendMessagesParser < RightAWSParser # :nodoc:
        method reset (line 510) | def reset
        method tagend (line 513) | def tagend(name)

FILE: lib/sqs/right_sqs_interface.rb
  type RightAws (line 24) | module RightAws
    class SqsInterface (line 26) | class SqsInterface < RightAwsBase
      method bench_xml (line 38) | def self.bench_xml
      method bench_sqs (line 41) | def self.bench_sqs
      method api (line 46) | def self.api
      method initialize (line 61) | def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, par...
      method generate_request (line 77) | def generate_request(action, params={})  # :nodoc:
      method generate_rest_request (line 99) | def generate_rest_request(method, param) # :nodoc:
      method request_info (line 129) | def request_info(request, parser) # :nodoc:
      method create_queue (line 141) | def create_queue(queue_name, default_visibility_timeout=nil)
      method list_queues (line 154) | def list_queues(queue_name_prefix=nil)
      method delete_queue (line 165) | def delete_queue(queue_url, force_deletion = false)
      method get_queue_attributes (line 178) | def get_queue_attributes(queue_url, attribute='All')
      method set_queue_attributes (line 194) | def set_queue_attributes(queue_url, attribute, value)
      method set_visibility_timeout (line 210) | def set_visibility_timeout(queue_url, visibility_timeout=nil)
      method get_visibility_timeout (line 225) | def get_visibility_timeout(queue_url)
      method add_grant (line 236) | def add_grant(queue_url, grantee_email_address, permission = nil)
      method list_grants (line 252) | def list_grants(queue_url, grantee_email_address=nil, permission = nil)
      method remove_grant (line 276) | def remove_grant(queue_url, grantee_email_address_or_id, permission ...
      method receive_messages (line 294) | def receive_messages(queue_url, number_of_messages=1, visibility_tim...
      method peek_message (line 310) | def peek_message(queue_url, message_id)
      method send_message (line 322) | def send_message(queue_url, message)
      method delete_message (line 336) | def delete_message(queue_url, message_id)
      method change_message_visibility (line 349) | def change_message_visibility(queue_url, message_id, visibility_time...
      method queue_url_by_name (line 363) | def queue_url_by_name(queue_name)
      method queue_name_by_url (line 378) | def self.queue_name_by_url(queue_url)
      method queue_name_by_url (line 388) | def queue_name_by_url(queue_url)
      method get_queue_length (line 398) | def get_queue_length(queue_url)
      method clear_queue (line 408) | def clear_queue(queue_url)
      method force_clear_queue (line 422) | def force_clear_queue(queue_url)
      method force_delete_queue (line 441) | def force_delete_queue(queue_url)
      method receive_message (line 452) | def receive_message(queue_url, visibility_timeout=nil)
      method pop_messages (line 467) | def pop_messages(queue_url, number_of_messages=1)
      method pop_message (line 482) | def pop_message(queue_url)
      class SqsStatusParser (line 493) | class SqsStatusParser < RightAWSParser # :nodoc:
        method tagend (line 494) | def tagend(name)
      class SqsCreateQueueParser (line 505) | class SqsCreateQueueParser < RightAWSParser # :nodoc:
        method tagend (line 506) | def tagend(name)
      class SqsListQueuesParser (line 511) | class SqsListQueuesParser < RightAWSParser # :nodoc:
        method reset (line 512) | def reset
        method tagend (line 515) | def tagend(name)
      class SqsGetQueueAttributesParser (line 520) | class SqsGetQueueAttributesParser < RightAWSParser # :nodoc:
        method reset (line 521) | def reset
        method tagend (line 524) | def tagend(name)
      class SqsGetVisibilityTimeoutParser (line 538) | class SqsGetVisibilityTimeoutParser < RightAWSParser # :nodoc:
        method tagend (line 539) | def tagend(name)
      class SqsListGrantsParser (line 548) | class SqsListGrantsParser < RightAWSParser # :nodoc:
        method reset (line 549) | def reset
        method tagstart (line 552) | def tagstart(name, attributes)
        method tagend (line 555) | def tagend(name)
      class SqsReceiveMessagesParser (line 569) | class SqsReceiveMessagesParser < RightAWSParser # :nodoc:
        method reset (line 570) | def reset
        method tagstart (line 573) | def tagstart(name, attributes)
        method tagend (line 576) | def tagend(name)
      class SqsSendMessagesParser (line 585) | class SqsSendMessagesParser < RightAWSParser # :nodoc:
        method tagend (line 586) | def tagend(name)

FILE: test/acf/test_right_acf.rb
  class TestAcf (line 3) | class TestAcf < Test::Unit::TestCase
    method setup (line 9) | def setup
    method test_01_list_distributions_part1 (line 16) | def test_01_list_distributions_part1
    method test_02_try_to_create_for_bad_bucket (line 24) | def test_02_try_to_create_for_bad_bucket
    method test_02_x_delete_bad_bucket (line 37) | def test_02_x_delete_bad_bucket
    method test_03_create (line 42) | def test_03_create
    method test_04_list_distributions_part2 (line 53) | def test_04_list_distributions_part2
    method get_test_distribution (line 58) | def get_test_distribution
    method test_05_get_distribution (line 62) | def test_05_get_distribution
    method test_06_get_and_set_config (line 69) | def test_06_get_and_set_config
    method test_08_delete_distribution (line 100) | def test_08_delete_distribution
    method test_09_drop_bucket (line 134) | def test_09_drop_bucket

FILE: test/awsbase/test_right_awsbase.rb
  class TestAwsbase (line 3) | class TestAwsbase < Test::Unit::TestCase
    method setup (line 5) | def setup
    method test_01_create_describe_key_pairs (line 8) | def test_01_create_describe_key_pairs

FILE: test/ec2/test_right_ec2.rb
  class TestEc2 (line 3) | class TestEc2 < Test::Unit::TestCase
    method setup (line 8) | def setup
    method test_01_create_describe_key_pairs (line 15) | def test_01_create_describe_key_pairs
    method test_02_create_security_group (line 22) | def test_02_create_security_group
    method test_03_perms_add (line 28) | def test_03_perms_add
    method test_04_check_new_perms_exist (line 33) | def test_04_check_new_perms_exist
    method test_05_perms_remove (line 37) | def test_05_perms_remove
    method test_06_describe_images (line 43) | def test_06_describe_images
    method test_07_describe_instanses (line 50) | def test_07_describe_instanses
    method test_08_delete_security_group (line 56) | def test_08_delete_security_group
    method test_09_delete_key_pair (line 60) | def test_09_delete_key_pair
    method test_10_signature_version_0 (line 67) | def test_10_signature_version_0
    method test_11_regions (line 75) | def test_11_regions
    method test_12_endpoint_url (line 97) | def test_12_endpoint_url

FILE: test/elb/test_right_elb.rb
  class TestElb (line 3) | class TestElb < Test::Unit::TestCase
    method setup (line 8) | def setup
    method test_00_describe_load_balancers (line 26) | def test_00_describe_load_balancers
    method test_description (line 31) | def test_description
    method test_description_has_canonical_hosted_zone_name (line 35) | def test_description_has_canonical_hosted_zone_name
    method test_description_has_canonical_hosted_zone_name_id (line 39) | def test_description_has_canonical_hosted_zone_name_id

FILE: test/http_connection.rb
  type Net (line 29) | module Net
    class HTTPResponse (line 30) | class HTTPResponse
      method setmsg (line 32) | def setmsg(msg)
      method body (line 36) | def body
  type Rightscale (line 43) | module Rightscale
    class HttpConnection (line 45) | class HttpConnection
      method request (line 50) | def request(request_params, &block)
      method reset (line 68) | def self.reset
      method push (line 72) | def self.push(code, msg=nil)
      method pop (line 77) | def self.pop
      method length (line 81) | def self.length

FILE: test/rds/test_right_rds.rb
  class TestRds (line 3) | class TestRds < Test::Unit::TestCase
    method setup (line 9) | def setup
    method test_00_instances (line 13) | def test_00_instances
    method test_10_security_groups (line 27) | def test_10_security_groups
    method test_11_remove_security_group (line 41) | def test_11_remove_security_group
    method test_12_create_security_group (line 45) | def test_12_create_security_group
    method test_13_authorize (line 53) | def test_13_authorize
    method test_14_revoke (line 68) | def test_14_revoke
    method test_15_delete_security_group (line 85) | def test_15_delete_security_group
    method test_20_db_snapshots (line 92) | def test_20_db_snapshots
    method test_30_events (line 106) | def test_30_events

FILE: test/route_53/test_right_route_53.rb
  class TestRoute53 (line 3) | class TestRoute53 < Test::Unit::TestCase
    method setup (line 8) | def setup
    method teardown (line 15) | def teardown
    method test_00_list_hosted_zones (line 33) | def test_00_list_hosted_zones
    method test_create_and_delete_zone (line 38) | def test_create_and_delete_zone
    method test_add_and_remove_A_record (line 48) | def test_add_and_remove_A_record
    method test_add_and_remove_Alias_record (line 73) | def test_add_and_remove_Alias_record
    method find_or_create_load_balancer (line 107) | def find_or_create_load_balancer
    method test_rr_sets_to_xml (line 116) | def test_rr_sets_to_xml
    method load_fixture (line 128) | def load_fixture (name)
    method assert_same_lines (line 132) | def assert_same_lines (expected, actual)

FILE: test/s3/test_right_s3.rb
  class TestS3 (line 3) | class TestS3 < Test::Unit::TestCase
    method setup (line 9) | def setup
    method test_01_create_bucket (line 28) | def test_01_create_bucket
    method test_02_list_all_my_buckets (line 32) | def test_02_list_all_my_buckets
    method test_03_list_empty_bucket (line 36) | def test_03_list_empty_bucket
    method test_04_put (line 40) | def test_04_put
    method test_04_put_multipart_string (line 46) | def test_04_put_multipart_string
    method test_04b_store_object_multipart_stream (line 54) | def test_04b_store_object_multipart_stream
    method test_05_get_and_get_object (line 66) | def test_05_get_and_get_object
    method test_06_head (line 75) | def test_06_head
    method test_07_streaming_get (line 80) | def test_07_streaming_get
    method test_08_keys (line 97) | def test_08_keys
    method test_09_copy_key (line 107) | def test_09_copy_key
    method test_10_move_key (line 125) | def test_10_move_key
    method test_11_rename_key (line 138) | def test_11_rename_key
    method test_12_retrieve_object (line 150) | def test_12_retrieve_object
    method test_13_delete_folder (line 156) | def test_13_delete_folder
    method test_14_delete_bucket (line 160) | def test_14_delete_bucket
    method test_20_s3 (line 176) | def test_20_s3
    method test_21_bucket_create_put_get_key (line 187) | def test_21_bucket_create_put_get_key
    method test_22_keys (line 203) | def test_22_keys
    method test_23_rename_key (line 229) | def test_23_rename_key
    method test_24_copy_key (line 249) | def test_24_copy_key
    method test_25_move_key (line 270) | def test_25_move_key
    method test_26_save_meta (line 289) | def test_26_save_meta
    method test_27_clear_delete (line 302) | def test_27_clear_delete
    method test_30_create_bucket (line 315) | def test_30_create_bucket
    method test_31_list_grantees (line 320) | def test_31_list_grantees
    method test_32_grant_revoke_drop (line 328) | def test_32_grant_revoke_drop
    method test_33_key_grantees (line 364) | def test_33_key_grantees
    method test_34_bucket_create_put_with_perms (line 383) | def test_34_bucket_create_put_with_perms
    method test_35_key_put_with_perms (line 399) | def test_35_key_put_with_perms
    method test_36_set_amazon_problems (line 413) | def test_36_set_amazon_problems
    method test_37_access_logging (line 424) | def test_37_access_logging
    method test_40_delete_buckets (line 443) | def test_40_delete_buckets
    method test_41_add_cache_control_response_parameter (line 448) | def test_41_add_cache_control_response_parameter
    method test_42_add_cache_control_and_content_type_and_content_disposition (line 455) | def test_42_add_cache_control_and_content_type_and_content_disposition
    method test_43_add_expires_and_content_type_and_content_disposition (line 470) | def test_43_add_expires_and_content_type_and_content_disposition
    method test_44_delete_multiple (line 485) | def test_44_delete_multiple
    method test_45_delete_multiple_more_than_1000_objects (line 516) | def test_45_delete_multiple_more_than_1000_objects
    method request (line 536) | def request( uri )
    method perform_request (line 545) | def perform_request( headers, &block )

FILE: test/s3/test_right_s3_stubbed.rb
  class TestS3Stubbed (line 3) | class TestS3Stubbed < Test::Unit::TestCase
    method setup (line 7) | def setup
    method test_101_create_bucket (line 17) | def test_101_create_bucket
    method test_102_list_all_my_buckets_failure (line 26) | def test_102_list_all_my_buckets_failure
    method test_103_list_empty_bucket (line 33) | def test_103_list_empty_bucket
    method test_104_put (line 40) | def test_104_put
    method test_105_get_and_get_object (line 52) | def test_105_get_and_get_object
    method test_106_head (line 57) | def test_106_head
    method test_109_delete_bucket (line 65) | def test_109_delete_bucket
    method test_115_copy_key (line 70) | def test_115_copy_key
    method test_116_move_key (line 81) | def test_116_move_key
    method test_117_rename_key (line 89) | def test_117_rename_key

FILE: test/sdb/test_active_sdb.rb
  class TestSdb (line 3) | class TestSdb < Test::Unit::TestCase
    class Client (line 8) | class Client < RightAws::ActiveSdb::Base
    class Person (line 12) | class Person < RightAws::ActiveSdb::Base
    method setup (line 25) | def setup
    method wait (line 46) | def wait(delay, msg='')
    method test_00_delete_domain (line 60) | def test_00_delete_domain
    method test_01_create_domain (line 66) | def test_01_create_domain
    method test_02_create_items (line 77) | def test_02_create_items
    method test_03_create_and_save_new_item (line 91) | def test_03_create_and_save_new_item
    method test_04_find_all (line 106) | def test_04_find_all
    method test_05_find_first (line 139) | def test_05_find_first
    method test_06_find_all_by_helpers (line 150) | def test_06_find_all_by_helpers
    method test_07_find_by_helpers (line 164) | def test_07_find_by_helpers
    method test_08_reload (line 175) | def test_08_reload
    method test_09_select (line 194) | def test_09_select
    method test_10_select_by (line 224) | def test_10_select_by
    method test_11_save_and_put (line 230) | def test_11_save_and_put
    method test_12_save_and_put_attributes (line 259) | def test_12_save_and_put_attributes
    method test_13_delete (line 285) | def test_13_delete
    method test_14_dynamic_attribute_accessors (line 314) | def test_14_dynamic_attribute_accessors
    method test_15_column_emulation (line 325) | def test_15_column_emulation
    method test_999_delete_domain (line 348) | def test_999_delete_domain

FILE: test/sdb/test_batch_put_attributes.rb
  class TestSdb (line 4) | class TestSdb < Test::Unit::TestCase
    method setup (line 6) | def setup
    method wait (line 23) | def wait(delay, msg='')
    method test_batch_put_attributes (line 33) | def test_batch_put_attributes

FILE: test/sdb/test_right_sdb.rb
  class TestSdb (line 3) | class TestSdb < Test::Unit::TestCase
    method setup (line 5) | def setup
    method wait (line 16) | def wait(delay, msg='')
    method test_00_delete_domain (line 30) | def test_00_delete_domain
    method test_01_create_domain (line 36) | def test_01_create_domain
    method test_02_put_attributes (line 46) | def test_02_put_attributes
    method test_03_get_attributes (line 52) | def test_03_get_attributes
    method test_04_add_attributes (line 59) | def test_04_add_attributes
    method test_05_replace_attributes (line 69) | def test_05_replace_attributes
    method test_06_delete_attribute (line 78) | def test_06_delete_attribute
    method test_07_delete_item (line 99) | def test_07_delete_item
    method test_08_query (line 113) | def test_08_query
    method test_09_signature_version_0 (line 122) | def test_09_signature_version_0
    method test_10_signature_version_1 (line 139) | def test_10_signature_version_1
    method test_11_signature_version_1 (line 148) | def test_11_signature_version_1
    method test_12_array_of_attrs (line 157) | def test_12_array_of_attrs
    method test_13_zero_len_attrs (line 164) | def test_13_zero_len_attrs
    method test_14_nil_attrs (line 171) | def test_14_nil_attrs
    method test_15_url_escape (line 186) | def test_15_url_escape
    method test_16_put_attrs_by_post (line 198) | def test_16_put_attrs_by_post
    method test_20_query_with_atributes (line 210) | def test_20_query_with_atributes
    method test_21_delete_domain (line 246) | def test_21_delete_domain

FILE: test/sns/test_right_sns.rb
  class TestSns (line 3) | class TestSns < Test::Unit::TestCase
    method policy_text (line 46) | def policy_text
    method setup (line 50) | def setup
    method test_01_create_topic (line 55) | def test_01_create_topic
    method test_02_set_topic_attributes (line 61) | def test_02_set_topic_attributes
    method test_03_get_topic_attributes (line 73) | def test_03_get_topic_attributes
    method test_04_list_topics (line 80) | def test_04_list_topics
    method test_05_subscribe_email (line 85) | def test_05_subscribe_email
    method test_06_list_subscriptions (line 91) | def test_06_list_subscriptions
    method test_07_list_subscriptions_by_topic (line 103) | def test_07_list_subscriptions_by_topic
    method test_08_unsubscribe (line 113) | def test_08_unsubscribe
    method test_09_publish (line 122) | def test_09_publish
    method test_10_add_and_remove_permission (line 127) | def test_10_add_and_remove_permission
    method test_30_delete_topic (line 147) | def test_30_delete_topic

FILE: test/sqs/test_right_sqs.rb
  class TestSqs (line 3) | class TestSqs < Test::Unit::TestCase
    method setup (line 9) | def setup
    method wait_for_queue_url (line 20) | def wait_for_queue_url(queue_name)
    method assert_eventually_equal (line 36) | def assert_eventually_equal(value, timeout=30, failmsg="", &block)
    method test_01_create_queue (line 55) | def test_01_create_queue
    method test_02_list_queues (line 60) | def test_02_list_queues
    method test_03_set_and_get_queue_attributes (line 66) | def test_03_set_and_get_queue_attributes
    method test_04_set_and_get_visibility_timeout (line 74) | def test_04_set_and_get_visibility_timeout
    method test_05_add_test_remove_grant (line 84) | def test_05_add_test_remove_grant
    method test_06_send_message (line 92) | def test_06_send_message
    method test_07_get_queue_length (line 102) | def test_07_get_queue_length
    method test_08_receive_message (line 107) | def test_08_receive_message
    method test_09_delete_message (line 116) | def test_09_delete_message
    method test_10_clear_and_delete_queue (line 123) | def test_10_clear_and_delete_queue
    method test_20_sqs_create_delete_queue (line 137) | def test_20_sqs_create_delete_queue
    method test_21_queue_create (line 154) | def test_21_queue_create
    method test_22_queue_attributes (line 162) | def test_22_queue_attributes
    method test_23_grantees (line 183) | def test_23_grantees
    method test_24_send_size (line 209) | def test_24_send_size
    method test_25_message_receive_pop_peek_delete (line 227) | def test_25_message_receive_pop_peek_delete
    method test_26 (line 252) | def test_26
    method test_27_set_amazon_problems (line 265) | def test_27_set_amazon_problems
    method test_29_signature_version_0 (line 276) | def test_29_signature_version_0

FILE: test/sqs/test_right_sqs_gen2.rb
  class TestSqsGen2 (line 3) | class TestSqsGen2 < Test::Unit::TestCase
    method setup (line 9) | def setup
    method wait_for_queue_url (line 25) | def wait_for_queue_url(queue_name)
    method do_sleep (line 34) | def do_sleep(delay, &block)
    method test_01_create_queue (line 49) | def test_01_create_queue
    method test_02_list_queues (line 54) | def test_02_list_queues
    method test_03_set_and_get_queue_attributes (line 60) | def test_03_set_and_get_queue_attributes
    method test_04_get_queue_attributes_forms (line 68) | def test_04_get_queue_attributes_forms
    method test_05_add_permissions (line 87) | def test_05_add_permissions
    method test_06_test_permissions (line 94) | def test_06_test_permissions
    method test_07_revoke_permissions (line 100) | def test_07_revoke_permissions
    method test_14_send_message (line 106) | def test_14_send_message
    method test_15_get_queue_length (line 117) | def test_15_get_queue_length
    method test_16_receive_message (line 122) | def test_16_receive_message
    method test_17_delete_message (line 129) | def test_17_delete_message
    method test_18_clear_and_delete_queue (line 136) | def test_18_clear_and_delete_queue
    method test_20_sqs_create_queue (line 145) | def test_20_sqs_create_queue
    method test_21_sqs_delete_queue (line 159) | def test_21_sqs_delete_queue
    method test_22_queue_create (line 164) | def test_22_queue_create
    method test_23_queue_attributes (line 173) | def test_23_queue_attributes
    method test_24 (line 194) | def test_24
    method test_25_send_size (line 199) | def test_25_send_size
    method test_26_message_receive_pop_delete (line 219) | def test_26_message_receive_pop_delete
    method test_27 (line 241) | def test_27
    method test_28_set_amazon_problems (line 253) | def test_28_set_amazon_problems

FILE: test/test_credentials.rb
  class TestCredentials (line 1) | class TestCredentials
    method aws_access_key_id (line 7) | def self.aws_access_key_id
    method aws_access_key_id= (line 10) | def self.aws_access_key_id=(newval)
    method account_number (line 13) | def self.account_number
    method account_number= (line 16) | def self.account_number=(newval)
    method aws_secret_access_key (line 19) | def self.aws_secret_access_key
    method aws_secret_access_key= (line 22) | def self.aws_secret_access_key=(newval)
    method get_credentials (line 26) | def self.get_credentials
Condensed preview — 82 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,037K chars).
[
  {
    "path": ".gitignore",
    "chars": 12,
    "preview": "pkg/\n.rvmrc\n"
  },
  {
    "path": "Dockerfile",
    "chars": 229,
    "preview": "FROM ruby:2.1.10\nRUN apt-get update -qq && apt-get install -y \\\n    build-essential \\\n    libxml2 \\\n    libxml2-dev \\\n  "
  },
  {
    "path": "Gemfile",
    "chars": 211,
    "preview": "source \"http://rubygems.org\"\n\ngem \"right_http_connection\", \">= 1.5.0\", git: \"https://github.com/flexera-public/right_htt"
  },
  {
    "path": "History.txt",
    "chars": 13767,
    "preview": "== 1.1.0 2007-08-10\nInitial release.\n\n== 1.2.0 2007-09-12\n\n* r1718, todd, 2007-09-12 15:34:37\n  * # 458, Extensive docum"
  },
  {
    "path": "LICENSE",
    "chars": 1065,
    "preview": "Copyright (c) 2009-2012 RightScale, Inc.\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy o"
  },
  {
    "path": "Manifest.txt",
    "chars": 1695,
    "preview": "History.txt\nManifest.txt\nREADME.txt\nRakefile\nlib/awsbase/support.rb\nlib/awsbase/benchmark_fix.rb\nlib/awsbase/right_awsba"
  },
  {
    "path": "README.txt",
    "chars": 8531,
    "preview": "= RightScale Amazon Web Services Ruby Gems\n\nPublished by RightScale, Inc. under the MIT License.\nFor information about R"
  },
  {
    "path": "Rakefile",
    "chars": 2826,
    "preview": "# -*- ruby -*-\n\nrequire 'rubygems'\nrequire \"rake/testtask\"\nrequire 'rubygems/package_task'\nrequire 'rake/clean'\n$: << Fi"
  },
  {
    "path": "docker-compose.yml",
    "chars": 122,
    "preview": "version: \"3.8\"\nservices:\n  app:\n    build: .\n    command: bash -c \"bundle exec rake -T\"\n    volumes:\n      - .:/right_aw"
  },
  {
    "path": "lib/acf/right_acf_interface.rb",
    "chars": 26630,
    "preview": "#\n# Copyright (c) 2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/acf/right_acf_invalidations.rb",
    "chars": 6331,
    "preview": "#\n# Copyright (c) 2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/acf/right_acf_origin_access_identities.rb",
    "chars": 10422,
    "preview": "#\n# Copyright (c) 2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/acf/right_acf_streaming_interface.rb",
    "chars": 10335,
    "preview": "#\n# Copyright (c) 2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/acw/right_acw_interface.rb",
    "chars": 13615,
    "preview": "#\n# Copyright (c) 2007-2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/as/right_as_interface.rb",
    "chars": 35769,
    "preview": "#\n# Copyright (c) 2007-2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/awsbase/benchmark_fix.rb",
    "chars": 1458,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/awsbase/right_awsbase.rb",
    "chars": 57458,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/awsbase/support.rb",
    "chars": 1465,
    "preview": "  # These are ActiveSupport-;like extensions to do a few handy things in the gems\n  # Derived from ActiveSupport, so the"
  },
  {
    "path": "lib/awsbase/version.rb",
    "chars": 243,
    "preview": "module RightAws #:nodoc:\n  module VERSION #:nodoc:\n    MAJOR = 3  unless defined?(MAJOR)\n    MINOR = 1  unless defined?("
  },
  {
    "path": "lib/ec2/right_ec2.rb",
    "chars": 26456,
    "preview": "#\n# Copyright (c) 2007-2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/ec2/right_ec2_ebs.rb",
    "chars": 22505,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_images.rb",
    "chars": 22445,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_instances.rb",
    "chars": 39951,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_monitoring.rb",
    "chars": 2607,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_placement_groups.rb",
    "chars": 4384,
    "preview": "#\n# Copyright (c) 2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_reserved_instances.rb",
    "chars": 11837,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_security_groups.rb",
    "chars": 23569,
    "preview": "#\n# Copyright (c) 2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_spot_instances.rb",
    "chars": 20012,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_tags.rb",
    "chars": 5723,
    "preview": "#\n# Copyright (c) 2007-2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/ec2/right_ec2_vpc.rb",
    "chars": 23808,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_vpc2.rb",
    "chars": 16738,
    "preview": "#\n# Copyright (c) 2011 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/ec2/right_ec2_windows_mobility.rb",
    "chars": 3474,
    "preview": "#\n# Copyright (c) 2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/elb/right_elb_interface.rb",
    "chars": 27320,
    "preview": "#\n# Copyright (c) 2007-2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/emr/right_emr_interface.rb",
    "chars": 28524,
    "preview": "#\n# Copyright (c) 2011 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/iam/right_iam_access_keys.rb",
    "chars": 2448,
    "preview": "module RightAws\n\n  class IamInterface < RightAwsBase\n\n    #-------------------------------------------------------------"
  },
  {
    "path": "lib/iam/right_iam_groups.rb",
    "chars": 7183,
    "preview": "module RightAws\n\n  class IamInterface < RightAwsBase\n\n    #-------------------------------------------------------------"
  },
  {
    "path": "lib/iam/right_iam_interface.rb",
    "chars": 14581,
    "preview": "#\n# Copyright (c) 2007-2010 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/iam/right_iam_mfa_devices.rb",
    "chars": 2669,
    "preview": "module RightAws\n\n  class IamInterface < RightAwsBase\n\n    #-------------------------------------------------------------"
  },
  {
    "path": "lib/iam/right_iam_users.rb",
    "chars": 9408,
    "preview": "module RightAws\n\n  class IamInterface < RightAwsBase\n\n    #-------------------------------------------------------------"
  },
  {
    "path": "lib/rds/right_rds_interface.rb",
    "chars": 88894,
    "preview": "#\n# Copyright (c) 2009 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/right_aws.rb",
    "chars": 2883,
    "preview": "#\n# Copyright (c) 2007-2011 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/route_53/right_route_53_interface.rb",
    "chars": 28052,
    "preview": "# Copyright (c) 2007-2011 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a c"
  },
  {
    "path": "lib/s3/right_s3.rb",
    "chars": 46765,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/s3/right_s3_interface.rb",
    "chars": 61397,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/sdb/active_sdb.rb",
    "chars": 43311,
    "preview": "#\n# Copyright (c) 2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/sdb/right_sdb_interface.rb",
    "chars": 32799,
    "preview": "#\n# Copyright (c) 2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/sns/right_sns_interface.rb",
    "chars": 11090,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/sqs/right_sqs.rb",
    "chars": 13841,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/sqs/right_sqs_gen2.rb",
    "chars": 13204,
    "preview": "#\n# Copyright (c) 2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy"
  },
  {
    "path": "lib/sqs/right_sqs_gen2_interface.rb",
    "chars": 23342,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "lib/sqs/right_sqs_interface.rb",
    "chars": 25316,
    "preview": "#\n# Copyright (c) 2007-2008 RightScale Inc\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a"
  },
  {
    "path": "right_aws.gemspec",
    "chars": 4870,
    "preview": "#--  -*- mode: ruby; encoding: utf-8 -*-\n# Copyright: Copyright (c) 2010 RightScale, Inc.\n#\n# Permission is hereby grant"
  },
  {
    "path": "test/README.mdown",
    "chars": 1750,
    "preview": "# Notes and tips for developers\n\n## Setting up credentials for testing\n\nBefore you can run any tests, you need to set up"
  },
  {
    "path": "test/acf/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/acf/test_right_acf.rb",
    "chars": 4388,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestAcf < Test::Unit::TestCase\n\n  RIGHT_OBJECT_TEXT     = 'Rig"
  },
  {
    "path": "test/awsbase/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/awsbase/test_right_awsbase.rb",
    "chars": 168,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestAwsbase < Test::Unit::TestCase\n\n  def setup\n  end\n  \n  def"
  },
  {
    "path": "test/ec2/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/ec2/test_right_ec2.rb",
    "chars": 4218,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestEc2 < Test::Unit::TestCase\n\n    # Some of RightEc2 instanc"
  },
  {
    "path": "test/elb/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/elb/test_right_elb.rb",
    "chars": 1371,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestElb < Test::Unit::TestCase\n\n  STDOUT.sync = true\n  BALANCE"
  },
  {
    "path": "test/http_connection.rb",
    "chars": 2433,
    "preview": "=begin\nCopyright (c) 2007 RightScale, Inc. \n\nPermission is hereby granted, free of charge, to any person obtaining\na cop"
  },
  {
    "path": "test/rds/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/rds/test_right_rds.rb",
    "chars": 3271,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestRds < Test::Unit::TestCase\n\n  STDOUT.sync = true\n\n  TEST_S"
  },
  {
    "path": "test/route_53/fixtures/a_record.xml",
    "chars": 571,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2011-05"
  },
  {
    "path": "test/route_53/fixtures/alias_record.xml",
    "chars": 613,
    "preview": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2011-05"
  },
  {
    "path": "test/route_53/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/route_53/test_right_route_53.rb",
    "chars": 5719,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestRoute53 < Test::Unit::TestCase\n\n  STDOUT.sync = true\n  BAL"
  },
  {
    "path": "test/s3/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/s3/test_right_s3.rb",
    "chars": 19858,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestS3 < Test::Unit::TestCase\n\n  RIGHT_OBJECT_TEXT     = 'Righ"
  },
  {
    "path": "test/s3/test_right_s3_stubbed.rb",
    "chars": 3124,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestS3Stubbed < Test::Unit::TestCase\n\n  RIGHT_OBJECT_TEXT     "
  },
  {
    "path": "test/sdb/test_active_sdb.rb",
    "chars": 14230,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSdb < Test::Unit::TestCase\n  DOMAIN_PREFIX = 'right_sdb_aw"
  },
  {
    "path": "test/sdb/test_batch_put_attributes.rb",
    "chars": 1518,
    "preview": "# -*- coding: utf-8 -*-\nrequire File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSdb < Test::Unit::TestCase\n\n  def "
  },
  {
    "path": "test/sdb/test_helper.rb",
    "chars": 101,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\nrequire 'sdb/active_sdb'\n"
  },
  {
    "path": "test/sdb/test_right_sdb.rb",
    "chars": 9138,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSdb < Test::Unit::TestCase\n\n  def setup\n    STDOUT.sync  ="
  },
  {
    "path": "test/sns/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/sns/test_right_sns.rb",
    "chars": 4823,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSns < Test::Unit::TestCase\n\n  # You can change these thing"
  },
  {
    "path": "test/sqs/test_helper.rb",
    "chars": 76,
    "preview": "require 'test/unit'\nrequire File.dirname(__FILE__) + '/../../lib/right_aws'\n"
  },
  {
    "path": "test/sqs/test_right_sqs.rb",
    "chars": 10276,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSqs < Test::Unit::TestCase\n\n  GRANTEE_EMAIL_ADDRESS = 'mad"
  },
  {
    "path": "test/sqs/test_right_sqs_gen2.rb",
    "chars": 8696,
    "preview": "require File.dirname(__FILE__) + '/test_helper.rb'\n\nclass TestSqsGen2 < Test::Unit::TestCase\n\n  GRANTEE_EMAIL_ADDRESS = "
  },
  {
    "path": "test/test_credentials.rb",
    "chars": 784,
    "preview": "class TestCredentials\n\n  @@aws_access_key_id = nil \n  @@aws_secret_access_key = nil \n  @@account_number = nil\n\n  def sel"
  },
  {
    "path": "test/ts_right_aws.rb",
    "chars": 439,
    "preview": "require 'test/unit'\n$: << File.dirname(__FILE__)\nrequire 'test_credentials'\nTestCredentials.get_credentials\n\nrequire 'ht"
  }
]

About this extraction

This page contains the full source code of the rightscale/right_aws GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 82 files (978.3 KB), approximately 256.9k tokens, and a symbol index with 1621 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!