aws-sdk 1.8.5 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.yardopts +1 -0
- data/README.rdoc +8 -0
- data/lib/aws-sdk.rb +39 -35
- data/lib/aws/api_config/CloudFront-2012-07-01.yml +2398 -0
- data/lib/aws/api_config/DirectConnect-2012-10-25.yml +475 -0
- data/lib/aws/api_config/DynamoDB-2011-12-05.yml +8 -0
- data/lib/aws/api_config/DynamoDB-2012-08-10.yml +1516 -0
- data/lib/aws/api_config/OpsWorks-2013-02-18.yml +2 -2
- data/lib/aws/auto_scaling.rb +44 -44
- data/lib/aws/auto_scaling/activity.rb +1 -1
- data/lib/aws/auto_scaling/activity_collection.rb +14 -15
- data/lib/aws/auto_scaling/client.rb +277 -277
- data/lib/aws/auto_scaling/config.rb +1 -1
- data/lib/aws/auto_scaling/group.rb +35 -36
- data/lib/aws/auto_scaling/group_collection.rb +10 -10
- data/lib/aws/auto_scaling/group_options.rb +19 -19
- data/lib/aws/auto_scaling/instance.rb +27 -27
- data/lib/aws/auto_scaling/instance_collection.rb +10 -10
- data/lib/aws/auto_scaling/launch_configuration.rb +3 -3
- data/lib/aws/auto_scaling/launch_configuration_collection.rb +1 -1
- data/lib/aws/auto_scaling/notification_configuration.rb +2 -2
- data/lib/aws/auto_scaling/notification_configuration_collection.rb +37 -38
- data/lib/aws/auto_scaling/scaling_policy.rb +3 -3
- data/lib/aws/auto_scaling/scaling_policy_collection.rb +6 -6
- data/lib/aws/auto_scaling/scaling_policy_options.rb +8 -7
- data/lib/aws/auto_scaling/scheduled_action.rb +3 -3
- data/lib/aws/auto_scaling/scheduled_action_collection.rb +28 -28
- data/lib/aws/auto_scaling/tag_collection.rb +30 -28
- data/lib/aws/cloud_formation.rb +95 -94
- data/lib/aws/cloud_formation/client.rb +136 -133
- data/lib/aws/cloud_formation/config.rb +1 -1
- data/lib/aws/cloud_formation/stack.rb +37 -37
- data/lib/aws/cloud_formation/stack_collection.rb +28 -27
- data/lib/aws/cloud_formation/stack_event.rb +9 -11
- data/lib/aws/cloud_formation/stack_output.rb +1 -1
- data/lib/aws/cloud_formation/stack_resource.rb +6 -6
- data/lib/aws/cloud_formation/stack_resource_collection.rb +11 -12
- data/lib/aws/cloud_formation/stack_resource_summary_collection.rb +11 -11
- data/lib/aws/cloud_formation/stack_summary_collection.rb +39 -39
- data/lib/aws/cloud_front.rb +21 -21
- data/lib/aws/cloud_front/client.rb +853 -652
- data/lib/aws/cloud_front/request.rb +3 -0
- data/lib/aws/cloud_search.rb +22 -22
- data/lib/aws/cloud_search/client.rb +322 -315
- data/lib/aws/cloud_search/config.rb +1 -1
- data/lib/aws/cloud_watch.rb +39 -39
- data/lib/aws/cloud_watch/alarm.rb +55 -37
- data/lib/aws/cloud_watch/alarm_collection.rb +18 -18
- data/lib/aws/cloud_watch/alarm_history_item_collection.rb +2 -2
- data/lib/aws/cloud_watch/client.rb +360 -146
- data/lib/aws/cloud_watch/config.rb +1 -1
- data/lib/aws/cloud_watch/metric.rb +15 -15
- data/lib/aws/cloud_watch/metric_alarm_collection.rb +17 -17
- data/lib/aws/cloud_watch/metric_collection.rb +16 -16
- data/lib/aws/cloud_watch/metric_statistics.rb +11 -11
- data/lib/aws/core.rb +243 -225
- data/lib/aws/core/async_handle.rb +13 -13
- data/lib/aws/core/cacheable.rb +14 -15
- data/lib/aws/core/client.rb +40 -15
- data/lib/aws/core/collection.rb +42 -46
- data/lib/aws/core/collection/with_limit_and_next_token.rb +1 -1
- data/lib/aws/core/collection/with_next_token.rb +1 -1
- data/lib/aws/core/configuration.rb +97 -133
- data/lib/aws/core/credential_providers.rb +16 -16
- data/lib/aws/core/data.rb +23 -23
- data/lib/aws/core/http/connection_pool.rb +348 -0
- data/lib/aws/core/http/net_http_handler.rb +17 -26
- data/lib/aws/core/http/patch.rb +102 -0
- data/lib/aws/core/http/request.rb +13 -19
- data/lib/aws/core/http/response.rb +2 -2
- data/lib/aws/core/lazy_error_classes.rb +17 -17
- data/lib/aws/core/log_formatter.rb +70 -104
- data/lib/aws/core/options/json_serializer.rb +1 -1
- data/lib/aws/core/options/validator.rb +4 -4
- data/lib/aws/core/page_result.rb +8 -8
- data/lib/aws/core/policy.rb +49 -49
- data/lib/aws/core/region.rb +72 -0
- data/lib/aws/core/region_collection.rb +106 -0
- data/lib/aws/core/resource.rb +5 -5
- data/lib/aws/core/response.rb +20 -17
- data/lib/aws/core/rest_request_builder.rb +4 -4
- data/lib/aws/core/service_interface.rb +24 -2
- data/lib/aws/core/signature/version_3.rb +2 -2
- data/lib/aws/core/uri_escape.rb +1 -1
- data/lib/aws/core/xml/frame_stack.rb +1 -1
- data/lib/aws/core/xml/grammar.rb +3 -4
- data/lib/aws/core/xml/sax_handlers/libxml.rb +2 -2
- data/lib/aws/core/xml/sax_handlers/nokogiri.rb +3 -3
- data/lib/aws/core/xml/sax_handlers/rexml.rb +5 -5
- data/lib/aws/core/xml/stub.rb +9 -9
- data/lib/aws/data_pipeline.rb +21 -21
- data/lib/aws/data_pipeline/client.rb +189 -133
- data/lib/aws/data_pipeline/config.rb +1 -1
- data/lib/aws/direct_connect.rb +74 -0
- data/lib/aws/direct_connect/client.rb +253 -0
- data/lib/aws/direct_connect/config.rb +18 -0
- data/lib/aws/direct_connect/errors.rb +22 -0
- data/lib/aws/direct_connect/request.rb +27 -0
- data/lib/aws/dynamo_db.rb +71 -69
- data/lib/aws/dynamo_db/attribute_collection.rb +53 -58
- data/lib/aws/dynamo_db/batch_get.rb +23 -23
- data/lib/aws/dynamo_db/batch_write.rb +43 -43
- data/lib/aws/dynamo_db/binary.rb +9 -9
- data/lib/aws/dynamo_db/client.rb +494 -509
- data/lib/aws/dynamo_db/client_base.rb +91 -0
- data/lib/aws/dynamo_db/client_v2.rb +825 -0
- data/lib/aws/dynamo_db/config.rb +1 -1
- data/lib/aws/dynamo_db/item.rb +10 -10
- data/lib/aws/dynamo_db/item_collection.rb +75 -75
- data/lib/aws/dynamo_db/table.rb +85 -85
- data/lib/aws/dynamo_db/table_collection.rb +13 -13
- data/lib/aws/ec2.rb +132 -142
- data/lib/aws/ec2/attachment.rb +31 -36
- data/lib/aws/ec2/attachment_collection.rb +1 -1
- data/lib/aws/ec2/availability_zone.rb +4 -4
- data/lib/aws/ec2/client.rb +2272 -2125
- data/lib/aws/ec2/config.rb +1 -1
- data/lib/aws/ec2/customer_gateway.rb +6 -6
- data/lib/aws/ec2/customer_gateway_collection.rb +6 -6
- data/lib/aws/ec2/dhcp_options.rb +3 -3
- data/lib/aws/ec2/dhcp_options_collection.rb +10 -10
- data/lib/aws/ec2/elastic_ip.rb +15 -15
- data/lib/aws/ec2/elastic_ip_collection.rb +11 -15
- data/lib/aws/ec2/export_task.rb +4 -4
- data/lib/aws/ec2/export_task_collection.rb +11 -11
- data/lib/aws/ec2/filtered_collection.rb +6 -8
- data/lib/aws/ec2/image.rb +46 -40
- data/lib/aws/ec2/image_collection.rb +44 -52
- data/lib/aws/ec2/instance.rb +64 -62
- data/lib/aws/ec2/instance_collection.rb +47 -50
- data/lib/aws/ec2/internet_gateway.rb +6 -6
- data/lib/aws/ec2/internet_gateway/attachment.rb +13 -13
- data/lib/aws/ec2/internet_gateway_collection.rb +3 -3
- data/lib/aws/ec2/key_pair.rb +3 -3
- data/lib/aws/ec2/key_pair_collection.rb +12 -12
- data/lib/aws/ec2/network_acl.rb +39 -39
- data/lib/aws/ec2/network_acl/association.rb +2 -2
- data/lib/aws/ec2/network_acl/entry.rb +22 -22
- data/lib/aws/ec2/network_acl_collection.rb +2 -2
- data/lib/aws/ec2/network_interface.rb +13 -4
- data/lib/aws/ec2/network_interface/attachment.rb +3 -3
- data/lib/aws/ec2/network_interface_collection.rb +5 -5
- data/lib/aws/ec2/permission_collection.rb +1 -1
- data/lib/aws/ec2/region.rb +6 -6
- data/lib/aws/ec2/region_collection.rb +1 -1
- data/lib/aws/ec2/reserved_instances_collection.rb +2 -2
- data/lib/aws/ec2/reserved_instances_offering_collection.rb +2 -2
- data/lib/aws/ec2/resource_tag_collection.rb +5 -5
- data/lib/aws/ec2/route_table.rb +14 -14
- data/lib/aws/ec2/route_table/association.rb +22 -22
- data/lib/aws/ec2/route_table/route.rb +8 -8
- data/lib/aws/ec2/route_table_collection.rb +3 -3
- data/lib/aws/ec2/security_group.rb +39 -41
- data/lib/aws/ec2/security_group_collection.rb +19 -21
- data/lib/aws/ec2/snapshot.rb +3 -3
- data/lib/aws/ec2/snapshot_collection.rb +11 -12
- data/lib/aws/ec2/subnet.rb +2 -2
- data/lib/aws/ec2/subnet_collection.rb +17 -17
- data/lib/aws/ec2/tag_collection.rb +1 -1
- data/lib/aws/ec2/tagged_collection.rb +7 -7
- data/lib/aws/ec2/tagged_item.rb +10 -10
- data/lib/aws/ec2/volume.rb +16 -16
- data/lib/aws/ec2/volume_collection.rb +9 -12
- data/lib/aws/ec2/vpc.rb +6 -6
- data/lib/aws/ec2/vpc_collection.rb +10 -10
- data/lib/aws/ec2/vpn_connection.rb +4 -4
- data/lib/aws/ec2/vpn_connection/telemetry.rb +1 -1
- data/lib/aws/ec2/vpn_connection_collection.rb +6 -6
- data/lib/aws/ec2/vpn_gateway.rb +2 -2
- data/lib/aws/ec2/vpn_gateway_collection.rb +5 -5
- data/lib/aws/elastic_beanstalk.rb +12 -12
- data/lib/aws/elastic_beanstalk/client.rb +376 -368
- data/lib/aws/elastic_beanstalk/config.rb +1 -1
- data/lib/aws/elastic_transcoder.rb +5 -5
- data/lib/aws/elastic_transcoder/client.rb +283 -283
- data/lib/aws/elastic_transcoder/config.rb +1 -1
- data/lib/aws/elasticache.rb +12 -12
- data/lib/aws/elasticache/client.rb +484 -479
- data/lib/aws/elasticache/config.rb +1 -1
- data/lib/aws/elb.rb +23 -23
- data/lib/aws/elb/availability_zone_collection.rb +34 -34
- data/lib/aws/elb/backend_server_policy_collection.rb +24 -24
- data/lib/aws/elb/client.rb +153 -153
- data/lib/aws/elb/config.rb +1 -1
- data/lib/aws/elb/errors.rb +1 -1
- data/lib/aws/elb/instance_collection.rb +20 -25
- data/lib/aws/elb/listener.rb +3 -3
- data/lib/aws/elb/listener_collection.rb +8 -8
- data/lib/aws/elb/load_balancer.rb +15 -16
- data/lib/aws/elb/load_balancer_collection.rb +36 -24
- data/lib/aws/elb/load_balancer_policy.rb +1 -1
- data/lib/aws/elb/load_balancer_policy_collection.rb +5 -5
- data/lib/aws/emr.rb +28 -26
- data/lib/aws/emr/client.rb +165 -149
- data/lib/aws/emr/config.rb +1 -1
- data/lib/aws/emr/instance_group.rb +1 -1
- data/lib/aws/emr/instance_group_collection.rb +1 -1
- data/lib/aws/emr/job_flow.rb +27 -26
- data/lib/aws/emr/job_flow_collection.rb +34 -34
- data/lib/aws/errors.rb +7 -7
- data/lib/aws/glacier.rb +21 -21
- data/lib/aws/glacier/archive_collection.rb +2 -2
- data/lib/aws/glacier/client.rb +139 -140
- data/lib/aws/glacier/config.rb +1 -1
- data/lib/aws/glacier/vault.rb +2 -2
- data/lib/aws/glacier/vault_collection.rb +1 -1
- data/lib/aws/iam.rb +133 -144
- data/lib/aws/iam/access_key.rb +17 -17
- data/lib/aws/iam/access_key_collection.rb +22 -22
- data/lib/aws/iam/account_alias_collection.rb +2 -2
- data/lib/aws/iam/client.rb +429 -420
- data/lib/aws/iam/collection.rb +1 -1
- data/lib/aws/iam/config.rb +2 -2
- data/lib/aws/iam/group.rb +8 -8
- data/lib/aws/iam/group_collection.rb +16 -16
- data/lib/aws/iam/group_policy_collection.rb +6 -6
- data/lib/aws/iam/group_user_collection.rb +3 -3
- data/lib/aws/iam/mfa_device.rb +1 -1
- data/lib/aws/iam/mfa_device_collection.rb +9 -9
- data/lib/aws/iam/policy_collection.rb +4 -4
- data/lib/aws/iam/resource.rb +2 -2
- data/lib/aws/iam/server_certificate.rb +1 -1
- data/lib/aws/iam/server_certificate_collection.rb +15 -15
- data/lib/aws/iam/signing_certificate.rb +29 -29
- data/lib/aws/iam/signing_certificate_collection.rb +23 -23
- data/lib/aws/iam/user.rb +33 -38
- data/lib/aws/iam/user_collection.rb +27 -27
- data/lib/aws/iam/user_group_collection.rb +3 -3
- data/lib/aws/iam/user_policy_collection.rb +6 -6
- data/lib/aws/iam/virtual_mfa_device.rb +12 -12
- data/lib/aws/iam/virtual_mfa_device_collection.rb +4 -4
- data/lib/aws/import_export.rb +22 -21
- data/lib/aws/import_export/client.rb +47 -43
- data/lib/aws/ops_works.rb +5 -5
- data/lib/aws/ops_works/client.rb +484 -438
- data/lib/aws/ops_works/config.rb +1 -1
- data/lib/aws/rails.rb +34 -34
- data/lib/aws/rds.rb +18 -18
- data/lib/aws/rds/client.rb +1286 -1277
- data/lib/aws/rds/config.rb +1 -1
- data/lib/aws/rds/db_instance.rb +15 -4
- data/lib/aws/rds/db_snapshot.rb +1 -1
- data/lib/aws/record.rb +50 -24
- data/lib/aws/record/abstract_base.rb +52 -60
- data/lib/aws/record/attributes.rb +79 -79
- data/lib/aws/record/conversion.rb +1 -1
- data/lib/aws/record/dirty_tracking.rb +69 -67
- data/lib/aws/record/errors.rb +21 -21
- data/lib/aws/record/exceptions.rb +2 -2
- data/lib/aws/record/hash_model.rb +20 -21
- data/lib/aws/record/hash_model/attributes.rb +13 -15
- data/lib/aws/record/hash_model/finder_methods.rb +46 -46
- data/lib/aws/record/hash_model/scope.rb +31 -31
- data/lib/aws/record/model.rb +136 -136
- data/lib/aws/record/model/attributes.rb +57 -59
- data/lib/aws/record/model/finder_methods.rb +67 -67
- data/lib/aws/record/model/scope.rb +48 -49
- data/lib/aws/record/naming.rb +1 -1
- data/lib/aws/record/scope.rb +23 -19
- data/lib/aws/record/validations.rb +253 -271
- data/lib/aws/record/validator.rb +3 -3
- data/lib/aws/record/validators/acceptance.rb +1 -3
- data/lib/aws/record/validators/block.rb +1 -3
- data/lib/aws/record/validators/confirmation.rb +1 -3
- data/lib/aws/record/validators/count.rb +2 -4
- data/lib/aws/record/validators/exclusion.rb +2 -4
- data/lib/aws/record/validators/format.rb +2 -4
- data/lib/aws/record/validators/inclusion.rb +1 -3
- data/lib/aws/record/validators/length.rb +5 -7
- data/lib/aws/record/validators/method.rb +1 -3
- data/lib/aws/record/validators/numericality.rb +6 -8
- data/lib/aws/record/validators/presence.rb +1 -3
- data/lib/aws/redshift.rb +14 -14
- data/lib/aws/redshift/client.rb +596 -592
- data/lib/aws/redshift/config.rb +1 -1
- data/lib/aws/route_53.rb +30 -30
- data/lib/aws/route_53/change_batch.rb +7 -7
- data/lib/aws/route_53/client.rb +188 -152
- data/lib/aws/route_53/hosted_zone.rb +4 -4
- data/lib/aws/route_53/hosted_zone_collection.rb +7 -7
- data/lib/aws/route_53/resource_record_set.rb +10 -10
- data/lib/aws/route_53/resource_record_set_collection.rb +6 -6
- data/lib/aws/s3.rb +79 -79
- data/lib/aws/s3/access_control_list.rb +44 -36
- data/lib/aws/s3/acl_options.rb +51 -51
- data/lib/aws/s3/bucket.rb +146 -146
- data/lib/aws/s3/bucket_collection.rb +21 -21
- data/lib/aws/s3/bucket_lifecycle_configuration.rb +81 -82
- data/lib/aws/s3/bucket_tag_collection.rb +4 -2
- data/lib/aws/s3/cipher_io.rb +5 -4
- data/lib/aws/s3/client.rb +89 -84
- data/lib/aws/s3/client/xml.rb +1 -1
- data/lib/aws/s3/config.rb +7 -1
- data/lib/aws/s3/cors_rule.rb +2 -0
- data/lib/aws/s3/cors_rule_collection.rb +42 -40
- data/lib/aws/s3/data_options.rb +16 -11
- data/lib/aws/s3/encryption_utils.rb +2 -2
- data/lib/aws/s3/errors.rb +7 -7
- data/lib/aws/s3/multipart_upload.rb +30 -33
- data/lib/aws/s3/multipart_upload_collection.rb +8 -6
- data/lib/aws/s3/object_collection.rb +35 -35
- data/lib/aws/s3/object_metadata.rb +6 -6
- data/lib/aws/s3/object_version.rb +4 -4
- data/lib/aws/s3/object_version_collection.rb +15 -15
- data/lib/aws/s3/policy.rb +2 -2
- data/lib/aws/s3/prefixed_collection.rb +9 -5
- data/lib/aws/s3/presigned_post.rb +39 -37
- data/lib/aws/s3/request.rb +11 -11
- data/lib/aws/s3/s3_object.rb +210 -200
- data/lib/aws/s3/tree.rb +25 -27
- data/lib/aws/s3/tree/child_collection.rb +3 -3
- data/lib/aws/s3/tree/leaf_node.rb +2 -2
- data/lib/aws/s3/tree/parent.rb +1 -1
- data/lib/aws/s3/website_configuration.rb +13 -13
- data/lib/aws/simple_db.rb +83 -83
- data/lib/aws/simple_db/attribute.rb +9 -7
- data/lib/aws/simple_db/attribute_collection.rb +22 -13
- data/lib/aws/simple_db/client.rb +107 -107
- data/lib/aws/simple_db/config.rb +7 -1
- data/lib/aws/simple_db/consistent_read_option.rb +5 -5
- data/lib/aws/simple_db/domain.rb +4 -2
- data/lib/aws/simple_db/domain_collection.rb +4 -4
- data/lib/aws/simple_db/domain_metadata.rb +5 -5
- data/lib/aws/simple_db/errors.rb +9 -9
- data/lib/aws/simple_db/item.rb +5 -5
- data/lib/aws/simple_db/item_collection.rb +83 -81
- data/lib/aws/simple_db/item_data.rb +4 -4
- data/lib/aws/simple_db/put_attributes.rb +3 -3
- data/lib/aws/simple_email_service.rb +140 -140
- data/lib/aws/simple_email_service/client.rb +82 -76
- data/lib/aws/simple_email_service/config.rb +1 -2
- data/lib/aws/simple_email_service/email_address_collection.rb +3 -3
- data/lib/aws/simple_email_service/identity.rb +8 -8
- data/lib/aws/simple_email_service/quotas.rb +8 -6
- data/lib/aws/simple_workflow.rb +106 -106
- data/lib/aws/simple_workflow/activity_task.rb +15 -22
- data/lib/aws/simple_workflow/activity_task_collection.rb +15 -15
- data/lib/aws/simple_workflow/activity_type.rb +23 -23
- data/lib/aws/simple_workflow/activity_type_collection.rb +23 -23
- data/lib/aws/simple_workflow/client.rb +1004 -956
- data/lib/aws/simple_workflow/config.rb +1 -1
- data/lib/aws/simple_workflow/count.rb +5 -5
- data/lib/aws/simple_workflow/decision_task.rb +129 -129
- data/lib/aws/simple_workflow/decision_task_collection.rb +59 -59
- data/lib/aws/simple_workflow/domain.rb +11 -11
- data/lib/aws/simple_workflow/domain_collection.rb +26 -26
- data/lib/aws/simple_workflow/history_event.rb +32 -32
- data/lib/aws/simple_workflow/history_event_collection.rb +3 -3
- data/lib/aws/simple_workflow/option_formatters.rb +5 -5
- data/lib/aws/simple_workflow/request.rb +1 -1
- data/lib/aws/simple_workflow/resource.rb +1 -1
- data/lib/aws/simple_workflow/type.rb +8 -8
- data/lib/aws/simple_workflow/type_collection.rb +15 -15
- data/lib/aws/simple_workflow/workflow_execution.rb +70 -72
- data/lib/aws/simple_workflow/workflow_execution_collection.rb +130 -130
- data/lib/aws/simple_workflow/workflow_type.rb +27 -25
- data/lib/aws/simple_workflow/workflow_type_collection.rb +20 -20
- data/lib/aws/sns.rb +25 -25
- data/lib/aws/sns/client.rb +55 -55
- data/lib/aws/sns/config.rb +1 -1
- data/lib/aws/sns/policy.rb +1 -1
- data/lib/aws/sns/subscription.rb +7 -7
- data/lib/aws/sns/subscription_collection.rb +5 -5
- data/lib/aws/sns/topic.rb +49 -49
- data/lib/aws/sns/topic_collection.rb +2 -2
- data/lib/aws/sns/topic_subscription_collection.rb +5 -5
- data/lib/aws/sqs.rb +20 -20
- data/lib/aws/sqs/client.rb +78 -78
- data/lib/aws/sqs/config.rb +1 -1
- data/lib/aws/sqs/errors.rb +12 -12
- data/lib/aws/sqs/queue.rb +66 -67
- data/lib/aws/sqs/queue_collection.rb +16 -8
- data/lib/aws/sqs/received_message.rb +7 -6
- data/lib/aws/storage_gateway.rb +21 -21
- data/lib/aws/storage_gateway/client.rb +269 -202
- data/lib/aws/storage_gateway/config.rb +1 -1
- data/lib/aws/sts.rb +10 -8
- data/lib/aws/sts/client.rb +35 -35
- data/lib/aws/sts/session.rb +3 -3
- data/lib/aws/version.rb +1 -2
- metadata +23 -21
- data/lib/aws/core/autoloader.rb +0 -64
- data/lib/net/http/connection_pool.rb +0 -226
- data/lib/net/http/connection_pool/connection.rb +0 -189
- data/lib/net/http/connection_pool/session.rb +0 -126
data/lib/aws/dynamo_db/config.rb
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
|
|
14
14
|
AWS::Core::Configuration.module_eval do
|
|
15
15
|
|
|
16
|
-
add_service 'DynamoDB', 'dynamo_db', 'dynamodb.
|
|
16
|
+
add_service 'DynamoDB', 'dynamo_db', 'dynamodb.%s.amazonaws.com'
|
|
17
17
|
|
|
18
18
|
add_option :dynamo_db_retry_throughput_errors, true, :boolean => true
|
|
19
19
|
|
data/lib/aws/dynamo_db/item.rb
CHANGED
|
@@ -18,16 +18,16 @@ module AWS
|
|
|
18
18
|
# complex primary key (according to the table schema) and consists
|
|
19
19
|
# of a collection of attributes. Attributes are name/value pairs
|
|
20
20
|
# where the value may be a string, number, string set, or number
|
|
21
|
-
# set.
|
|
21
|
+
# set.
|
|
22
22
|
#
|
|
23
23
|
# Getting an item by hash key value:
|
|
24
24
|
#
|
|
25
|
-
#
|
|
25
|
+
# item = table.items['hash-key-value']
|
|
26
26
|
#
|
|
27
27
|
# Getting an item from a table with both hash and range keys:
|
|
28
28
|
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
29
|
+
# item = table.items['hash-key','range-key']
|
|
30
|
+
#
|
|
31
31
|
class Item < Core::Resource
|
|
32
32
|
|
|
33
33
|
extend Types
|
|
@@ -41,7 +41,7 @@ module AWS
|
|
|
41
41
|
attr_reader :hash_value
|
|
42
42
|
|
|
43
43
|
# @return [String, Numeric, nil] The range key value of the
|
|
44
|
-
# item, or
|
|
44
|
+
# item, or `nil` if the table has a simple primary key.
|
|
45
45
|
attr_reader :range_value
|
|
46
46
|
|
|
47
47
|
# @private
|
|
@@ -60,17 +60,17 @@ module AWS
|
|
|
60
60
|
# The operation will fail unless the item exists and has the
|
|
61
61
|
# attributes in the value for this option. For example:
|
|
62
62
|
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
63
|
+
# # throws DynamoDB::Errors::ConditionalCheckFailedException
|
|
64
|
+
# # unless the item has "color" set to "red"
|
|
65
|
+
# item.delete(:if => { :color => "red" })
|
|
66
66
|
#
|
|
67
67
|
# @option options [String, Symbol, Array] :unless_exists A name
|
|
68
68
|
# or collection of attribute names; if the item has a value
|
|
69
69
|
# for any of these attributes, this method will raise
|
|
70
|
-
#
|
|
70
|
+
# `DynamoDB::Errors::ConditionalCheckFailedException`. For
|
|
71
71
|
# example:
|
|
72
72
|
#
|
|
73
|
-
#
|
|
73
|
+
# item.delete(:unless_exists => "version")
|
|
74
74
|
def delete(options = {})
|
|
75
75
|
client_opts = item_key_options(self)
|
|
76
76
|
|
|
@@ -22,31 +22,31 @@ module AWS
|
|
|
22
22
|
# * Get an {Item}
|
|
23
23
|
# * Enumerate {Item} or {ItemData} objects
|
|
24
24
|
#
|
|
25
|
-
#
|
|
25
|
+
# ## Creating an Item
|
|
26
26
|
#
|
|
27
27
|
# To create an item, just call {#create} with a hash of attributes.
|
|
28
28
|
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
29
|
+
# table = dynamo_db.tables['my-table']
|
|
30
|
+
# table.hash_key = [:id, :string]
|
|
31
31
|
#
|
|
32
|
-
#
|
|
32
|
+
# table.items.create('id' => 'abc', 'count' => 5, 'colors' => %w(red blue))
|
|
33
33
|
#
|
|
34
34
|
# Attribute names can be symbols/strings and values can be strings or
|
|
35
35
|
# numbers or arrays/sets of strings/numbers. The attributes must contain
|
|
36
36
|
# the hash key name/value for the item and the value must be of the
|
|
37
37
|
# correct type (e.g. string or number).
|
|
38
38
|
#
|
|
39
|
-
#
|
|
39
|
+
# ## Getting an Item
|
|
40
40
|
#
|
|
41
41
|
# To get an item, you provide the hash key
|
|
42
42
|
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
43
|
+
# # gets a reference to the item, no request is made
|
|
44
|
+
# item = table.items['hash-key-value']
|
|
45
45
|
#
|
|
46
46
|
# You call methods against the item returned to get, add, update or delete
|
|
47
47
|
# attributes. See {Item} for more information.
|
|
48
48
|
#
|
|
49
|
-
#
|
|
49
|
+
# ## Enumerating Items
|
|
50
50
|
#
|
|
51
51
|
# You can enumerate items 2 ways:
|
|
52
52
|
#
|
|
@@ -61,26 +61,26 @@ module AWS
|
|
|
61
61
|
#
|
|
62
62
|
# To enumerate {Item} objects just call each on the item collection.
|
|
63
63
|
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
#
|
|
64
|
+
# table.items.each do |item|
|
|
65
|
+
# puts item.hash_value
|
|
66
|
+
# end
|
|
67
67
|
#
|
|
68
68
|
# To enumerate {ItemData} objects you need to specify what attributes
|
|
69
69
|
# you are interested in. This will cause #each to yield {ItemData}
|
|
70
70
|
# objects. Call {ItemData#attributes} to get the hash of attribute
|
|
71
71
|
# names/values.
|
|
72
72
|
#
|
|
73
|
-
#
|
|
74
|
-
#
|
|
75
|
-
#
|
|
73
|
+
# table.items.select('id', 'category').each do |item_data|
|
|
74
|
+
# item_data.attributes #=> { 'id' => 'abc', 'category' => 'foo' }
|
|
75
|
+
# end
|
|
76
76
|
#
|
|
77
77
|
# If you want item data objects with all attributes just call select
|
|
78
78
|
# without a list of attributes (#select still accepts options).
|
|
79
79
|
#
|
|
80
|
-
#
|
|
81
|
-
#
|
|
82
|
-
#
|
|
83
|
-
#
|
|
80
|
+
# # request a maximum of 10 items from Amazon DynamoDB
|
|
81
|
+
# table.items.select(:limit => 10).each do |item_data|
|
|
82
|
+
# item_data.attributes #=> { 'id' => 'abc', 'category' => 'foo', ... }
|
|
83
|
+
# end
|
|
84
84
|
#
|
|
85
85
|
# Please note that enumerating objects is done via the scan operation.
|
|
86
86
|
# Refer to the Amazon DynamoDB documentation for more information
|
|
@@ -114,7 +114,7 @@ module AWS
|
|
|
114
114
|
# primary key doesn't exist), or replace an existing item if it
|
|
115
115
|
# has certain attribute values.
|
|
116
116
|
#
|
|
117
|
-
#
|
|
117
|
+
# items.put(:id => "abc123", :colors => ["red", "white"])
|
|
118
118
|
#
|
|
119
119
|
# @param [Hash] attributes The attributes to store with the
|
|
120
120
|
# item. These must include the primary key attributes for the
|
|
@@ -122,10 +122,10 @@ module AWS
|
|
|
122
122
|
# Attribute names may be symbols or UTF-8 strings, and
|
|
123
123
|
# attribute values may be any of these types:
|
|
124
124
|
#
|
|
125
|
-
#
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
125
|
+
# * String
|
|
126
|
+
# * Array<String> or Set<String>
|
|
127
|
+
# * Numeric
|
|
128
|
+
# * Array<Numeric> or Set<Numeric>
|
|
129
129
|
#
|
|
130
130
|
# Empty sets, arrays, and strings are invalid.
|
|
131
131
|
#
|
|
@@ -136,33 +136,33 @@ module AWS
|
|
|
136
136
|
# operation will fail unless the item exists and has the
|
|
137
137
|
# attributes in the value for this option. For example:
|
|
138
138
|
#
|
|
139
|
-
#
|
|
140
|
-
#
|
|
141
|
-
#
|
|
142
|
-
#
|
|
143
|
-
#
|
|
144
|
-
#
|
|
139
|
+
# # throws DynamoDB::Errors::ConditionalCheckFailedException
|
|
140
|
+
# # unless the item has "color" set to "red"
|
|
141
|
+
# items.put(
|
|
142
|
+
# { :foo => "Bar" },
|
|
143
|
+
# :if => { :color => "red" }
|
|
144
|
+
# )
|
|
145
145
|
#
|
|
146
146
|
# @option options [String, Symbol, Array] :unless_exists A name
|
|
147
147
|
# or collection of attribute names; if the item already exists
|
|
148
148
|
# and has a value for any of these attributes, this method
|
|
149
149
|
# will raise
|
|
150
|
-
#
|
|
150
|
+
# `DynamoDB::Errors::ConditionalCheckFailedException`. For example:
|
|
151
151
|
#
|
|
152
|
-
#
|
|
152
|
+
# items.put({ :id => "abc123" }, :unless_exists => "id")
|
|
153
153
|
#
|
|
154
|
-
# @option options [Symbol] :return If set to
|
|
154
|
+
# @option options [Symbol] :return If set to `:all_old`, this
|
|
155
155
|
# method will return a hash containing the previous values of
|
|
156
156
|
# all attributes for the item that was overwritten. If this
|
|
157
|
-
# option is set to
|
|
157
|
+
# option is set to `:none`, or if it is set to `:all_old` and
|
|
158
158
|
# no item currently exists with the same primary key values,
|
|
159
|
-
# the method will return
|
|
159
|
+
# the method will return `nil`.
|
|
160
160
|
#
|
|
161
161
|
# @return [Item] An object representing the item that was
|
|
162
162
|
# stored. Note that the SDK retains only the item's primary
|
|
163
163
|
# key values in memory; if you access the attributes of the
|
|
164
164
|
# item using the returned object, the SDK will contact the
|
|
165
|
-
# service to retrieve those attributes. The
|
|
165
|
+
# service to retrieve those attributes. The `:return` option
|
|
166
166
|
# may be used to change the return value of this method.
|
|
167
167
|
def create attributes, options = {}
|
|
168
168
|
table.assert_schema!
|
|
@@ -200,8 +200,8 @@ module AWS
|
|
|
200
200
|
# exception unless the table has a schema loaded or configured,
|
|
201
201
|
# or if the table has a composite primary key.
|
|
202
202
|
#
|
|
203
|
-
#
|
|
204
|
-
#
|
|
203
|
+
# table.hash_key = [:id, :string]
|
|
204
|
+
# item = table.items["abc123"]
|
|
205
205
|
#
|
|
206
206
|
# @param [String, Numeric] hash_value The hash key value for the
|
|
207
207
|
# item. The type of this parameter must match the type in the
|
|
@@ -225,9 +225,9 @@ module AWS
|
|
|
225
225
|
# currently the SDK makes no attempt to validate the key
|
|
226
226
|
# elements.
|
|
227
227
|
#
|
|
228
|
-
#
|
|
229
|
-
#
|
|
230
|
-
#
|
|
228
|
+
# table.hash_key = [:id, :string]
|
|
229
|
+
# table.range_key = [:range, :number]
|
|
230
|
+
# item = table.items.at("abc123", 12)
|
|
231
231
|
#
|
|
232
232
|
# @param [String, Numeric] hash_value The hash key value for the
|
|
233
233
|
# item.
|
|
@@ -249,7 +249,7 @@ module AWS
|
|
|
249
249
|
|
|
250
250
|
# Provides a convenient syntax for expressing scan filters.
|
|
251
251
|
#
|
|
252
|
-
#
|
|
252
|
+
# table.items.where(:path).begins_with("users/")
|
|
253
253
|
#
|
|
254
254
|
class FilterBuilder
|
|
255
255
|
|
|
@@ -423,7 +423,7 @@ module AWS
|
|
|
423
423
|
|
|
424
424
|
# @overload where(attributes)
|
|
425
425
|
#
|
|
426
|
-
#
|
|
426
|
+
# table.items.where(:name => "Fred")
|
|
427
427
|
#
|
|
428
428
|
# @param [Hash] attributes The returned collection will be
|
|
429
429
|
# filtered such that each item contains the attributes and
|
|
@@ -434,7 +434,7 @@ module AWS
|
|
|
434
434
|
#
|
|
435
435
|
# @overload where(attribute_name)
|
|
436
436
|
#
|
|
437
|
-
#
|
|
437
|
+
# table.items.where(:name).equals("Fred")
|
|
438
438
|
#
|
|
439
439
|
# @return [FilterBuilder] An object that allows you to specify
|
|
440
440
|
# a filter on the provided attribute name.
|
|
@@ -505,16 +505,16 @@ module AWS
|
|
|
505
505
|
# method allows you to specify which attributes to retrieve from
|
|
506
506
|
# DynamoDB.
|
|
507
507
|
#
|
|
508
|
-
#
|
|
509
|
-
#
|
|
508
|
+
# # fetch all attributes for a collection of items
|
|
509
|
+
# items.select { |data| p data.attributes }
|
|
510
510
|
#
|
|
511
|
-
#
|
|
512
|
-
#
|
|
511
|
+
# # fetch only the "color" attribute of each item
|
|
512
|
+
# items.select(:color) { |data| p data.attributes["color"] }
|
|
513
513
|
#
|
|
514
|
-
#
|
|
515
|
-
#
|
|
516
|
-
#
|
|
517
|
-
#
|
|
514
|
+
# # use client-side filtering to delete a subset of the items
|
|
515
|
+
# items.select do |data|
|
|
516
|
+
# data.item.delete if data.attributes.size % 2 == 0
|
|
517
|
+
# end
|
|
518
518
|
#
|
|
519
519
|
# @overload select(*attributes, options = {})
|
|
520
520
|
#
|
|
@@ -566,8 +566,8 @@ module AWS
|
|
|
566
566
|
# count applies to the items that match all the filters on the
|
|
567
567
|
# collection. For example:
|
|
568
568
|
#
|
|
569
|
-
#
|
|
570
|
-
#
|
|
569
|
+
# # count the blue items
|
|
570
|
+
# items.where(:color => "blue").count
|
|
571
571
|
#
|
|
572
572
|
# @param [Hash] options Options for counting the items.
|
|
573
573
|
#
|
|
@@ -618,32 +618,32 @@ module AWS
|
|
|
618
618
|
# of key conditions and does not have the added step of
|
|
619
619
|
# filtering out results.
|
|
620
620
|
#
|
|
621
|
-
#
|
|
622
|
-
#
|
|
621
|
+
# # find all items with a given hash key value
|
|
622
|
+
# items.query(:hash_value => "abc123")
|
|
623
623
|
#
|
|
624
|
-
#
|
|
625
|
-
#
|
|
626
|
-
#
|
|
627
|
-
#
|
|
624
|
+
# # get only the colors attribute of each item
|
|
625
|
+
# items.query(
|
|
626
|
+
# :hash_value => "abc123",
|
|
627
|
+
# :select => [:colors])
|
|
628
628
|
#
|
|
629
|
-
#
|
|
630
|
-
#
|
|
631
|
-
#
|
|
632
|
-
#
|
|
633
|
-
#
|
|
629
|
+
# # find only the items where the range key is between two values
|
|
630
|
+
# items.query(
|
|
631
|
+
# :hash_value => "abc123",
|
|
632
|
+
# :range_value => 1..100
|
|
633
|
+
# )
|
|
634
634
|
#
|
|
635
635
|
# @note This method is only valid for tables with a composite
|
|
636
636
|
# primary key.
|
|
637
637
|
#
|
|
638
|
-
# @param [Hash] options Options for the query.
|
|
638
|
+
# @param [Hash] options Options for the query. `:hash_value` is
|
|
639
639
|
# required. Only one of the following options may be set:
|
|
640
640
|
#
|
|
641
|
-
#
|
|
642
|
-
#
|
|
643
|
-
#
|
|
644
|
-
#
|
|
645
|
-
#
|
|
646
|
-
#
|
|
641
|
+
# * `:range_value`
|
|
642
|
+
# * `:range_greater_than`
|
|
643
|
+
# * `:range_less_than`
|
|
644
|
+
# * `:range_gte`
|
|
645
|
+
# * `:range_lte`
|
|
646
|
+
# * `:range_begins_with`
|
|
647
647
|
#
|
|
648
648
|
# @option [Boolean] :scan_index_forward (true) Specifies which
|
|
649
649
|
# order records will be returned. Defaults to returning them
|
|
@@ -653,11 +653,11 @@ module AWS
|
|
|
653
653
|
# objects without any attribute data. If you want to select
|
|
654
654
|
# specific attributes, pass a list of them to :select.
|
|
655
655
|
#
|
|
656
|
-
#
|
|
656
|
+
# :select => [:id, :category, :size]
|
|
657
657
|
#
|
|
658
|
-
# If you want to select ALL attributes, pass the symbol
|
|
658
|
+
# If you want to select ALL attributes, pass the symbol `:all`
|
|
659
659
|
#
|
|
660
|
-
#
|
|
660
|
+
# :select => :all
|
|
661
661
|
#
|
|
662
662
|
# @option options [String, Numeric] :hash_value Attribute value
|
|
663
663
|
# of the hash component of the composite primary key.
|
|
@@ -665,7 +665,7 @@ module AWS
|
|
|
665
665
|
# @option options [Array<String, Symbol>, String, Symbol] :select
|
|
666
666
|
# Attribute name or names to retrieve. When this option is
|
|
667
667
|
# set, the returned or yielded items will be instances of
|
|
668
|
-
# {ItemData} instead of {Item}. The special value
|
|
668
|
+
# {ItemData} instead of {Item}. The special value `:all`
|
|
669
669
|
# indicates that all attributes should be retrieved and
|
|
670
670
|
# returned in ItemData instances.
|
|
671
671
|
#
|
data/lib/aws/dynamo_db/table.rb
CHANGED
|
@@ -16,7 +16,7 @@ module AWS
|
|
|
16
16
|
|
|
17
17
|
# Represents a DynamoDB table.
|
|
18
18
|
#
|
|
19
|
-
#
|
|
19
|
+
# ## Working with Tables
|
|
20
20
|
#
|
|
21
21
|
# Dynamo DB allows you to organize data into tables. Tables have a
|
|
22
22
|
# unique name and a key schema. A key schema is comprised of a
|
|
@@ -27,47 +27,47 @@ module AWS
|
|
|
27
27
|
# by the scale of a single box. You can reserve the required throughput
|
|
28
28
|
# by specifying a number of reads and writes per second to support.
|
|
29
29
|
#
|
|
30
|
-
#
|
|
30
|
+
# ## Creating a Table
|
|
31
31
|
#
|
|
32
32
|
# To get started you can create a table by supplying a name
|
|
33
33
|
# and the read/write capacity. A default schema with a hash_key
|
|
34
34
|
# of :id => :string will be provided.
|
|
35
35
|
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
36
|
+
# dynamo_db = AWS::DynamoDB.new
|
|
37
|
+
# dynamo_db.tables.create('mytable', 10, 5)
|
|
38
38
|
#
|
|
39
39
|
# You can provide your own hash key and optional range key.
|
|
40
40
|
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
41
|
+
# dynamo_db.tables.create('comments', 10, 5,
|
|
42
|
+
# :hash_key => { :blog_post_id => :number },
|
|
43
|
+
# :range_key => { :comment_id => :number }
|
|
44
|
+
# )
|
|
45
45
|
#
|
|
46
|
-
#
|
|
46
|
+
# ## Provisioning Throughput
|
|
47
47
|
#
|
|
48
48
|
# You must specify the desired read and write capacity when
|
|
49
49
|
# creating a table. After a table is created you can see what has
|
|
50
50
|
# been provisioned.
|
|
51
51
|
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
52
|
+
# table.read_capacity_units #=> 10
|
|
53
|
+
# table.write_capacity_units #=> 5
|
|
54
54
|
#
|
|
55
55
|
# To change these values, call {#provision_throughput}:
|
|
56
56
|
#
|
|
57
|
-
#
|
|
57
|
+
# table.provision_throughput :read_capacity_units => 100, :write_capacity_units => 100
|
|
58
58
|
#
|
|
59
59
|
# Please note that provisioned throughput can be decreased only once
|
|
60
60
|
# within a 24 hour period.
|
|
61
61
|
#
|
|
62
|
-
#
|
|
62
|
+
# ## Table Status
|
|
63
63
|
#
|
|
64
64
|
# When you create or update a table the changes can take some time to
|
|
65
65
|
# apply. You can query the status of your table at any time:
|
|
66
66
|
#
|
|
67
|
-
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
#
|
|
67
|
+
# # creating a table can be a *very* slow operation
|
|
68
|
+
# table = dynamo_db.tables.create('mytable')
|
|
69
|
+
# sleep 1 while table.status == :creating
|
|
70
|
+
# table.status #=> :active
|
|
71
71
|
#
|
|
72
72
|
# @attr_reader [Time] created_at When the table was first creatd.
|
|
73
73
|
#
|
|
@@ -156,7 +156,7 @@ module AWS
|
|
|
156
156
|
# @option options [Integer] :write_capacity_units
|
|
157
157
|
#
|
|
158
158
|
# @return [Hash] Returns a hash with the current throughput
|
|
159
|
-
# provisioning (
|
|
159
|
+
# provisioning (`:read_capacity_units` and `:write_capacity_units`).
|
|
160
160
|
#
|
|
161
161
|
def provision_throughput options = {}
|
|
162
162
|
|
|
@@ -236,9 +236,9 @@ module AWS
|
|
|
236
236
|
# This is the preferred way to load the table schema so that it
|
|
237
237
|
# can be used to work with DynamoDB items.
|
|
238
238
|
#
|
|
239
|
-
#
|
|
240
|
-
#
|
|
241
|
-
#
|
|
239
|
+
# # these are equivalent:
|
|
240
|
+
# table.hash_key = [:id, :string]
|
|
241
|
+
# table.hash_key = { :id => :string }
|
|
242
242
|
#
|
|
243
243
|
# @note For tables with composite primary keys, you must call
|
|
244
244
|
# this method first followed by {#range_key=} to configure the
|
|
@@ -247,7 +247,7 @@ module AWS
|
|
|
247
247
|
# @param description A description of the hash key element. If
|
|
248
248
|
# this is a hash, it may contain a single mapping; the key is
|
|
249
249
|
# the name of the hash key attribute and the value is the type
|
|
250
|
-
# (
|
|
250
|
+
# (`:string`, `:number` or `:binary`). If it is an array, the first
|
|
251
251
|
# element is the name and the second element is the type.
|
|
252
252
|
#
|
|
253
253
|
def hash_key= description
|
|
@@ -262,14 +262,14 @@ module AWS
|
|
|
262
262
|
# be called after {#hash_key=} has been used to configure the
|
|
263
263
|
# hash key element.
|
|
264
264
|
#
|
|
265
|
-
#
|
|
266
|
-
#
|
|
267
|
-
#
|
|
265
|
+
# # these are equivalent:
|
|
266
|
+
# table.range_key = [:id, :string]
|
|
267
|
+
# table.range_key = { :id => :string }
|
|
268
268
|
#
|
|
269
269
|
# @param description A description of the range key element. If
|
|
270
270
|
# this is a hash, it may contain a single mapping; the key is
|
|
271
271
|
# the name of the hash key attribute and the value is the type
|
|
272
|
-
# (
|
|
272
|
+
# (`:string`, `:number` or `:binary`). If it is an array, the first
|
|
273
273
|
# element is the name and the second element is the type.
|
|
274
274
|
#
|
|
275
275
|
def range_key= description
|
|
@@ -282,7 +282,7 @@ module AWS
|
|
|
282
282
|
end
|
|
283
283
|
|
|
284
284
|
# Deletes a table and all of its items. The table must be in an
|
|
285
|
-
#
|
|
285
|
+
# `:active` state (see {#status}).
|
|
286
286
|
#
|
|
287
287
|
# @return [nil]
|
|
288
288
|
#
|
|
@@ -298,7 +298,7 @@ module AWS
|
|
|
298
298
|
end
|
|
299
299
|
|
|
300
300
|
# @return [Boolean] Returns true if the table exists. Note that a table
|
|
301
|
-
# exists even when it is in a
|
|
301
|
+
# exists even when it is in a `:deleting` state; this method
|
|
302
302
|
# only returns false when DynamoDB no longer returns any
|
|
303
303
|
# information about the table.
|
|
304
304
|
def exists?
|
|
@@ -315,43 +315,43 @@ module AWS
|
|
|
315
315
|
#
|
|
316
316
|
# You can call this method in two forms:
|
|
317
317
|
#
|
|
318
|
-
#
|
|
319
|
-
#
|
|
320
|
-
#
|
|
321
|
-
#
|
|
322
|
-
#
|
|
318
|
+
# # block form
|
|
319
|
+
# table.batch_get(:all, items) do |attributes|
|
|
320
|
+
# # yeilds one hash of attribute names/values for each item
|
|
321
|
+
# puts attributes.to_yaml
|
|
322
|
+
# end
|
|
323
323
|
#
|
|
324
|
-
#
|
|
325
|
-
#
|
|
326
|
-
#
|
|
327
|
-
#
|
|
328
|
-
#
|
|
324
|
+
# # enumerable return value
|
|
325
|
+
# attribute_hashes = table.batch_get(:all, items)
|
|
326
|
+
# attribute_hashes.each do |attributes|
|
|
327
|
+
# # ...
|
|
328
|
+
# end
|
|
329
329
|
#
|
|
330
330
|
# @note This method does not require the table schema to be loaded.
|
|
331
331
|
#
|
|
332
|
-
#
|
|
332
|
+
# ## Attributes
|
|
333
333
|
#
|
|
334
334
|
# You can specify the list of attributes to request in 3 ways:
|
|
335
335
|
#
|
|
336
|
-
# * The symbol
|
|
336
|
+
# * The symbol `:all` (to recieve all attributes)
|
|
337
337
|
# * A single attribute name (e.g. 'size')
|
|
338
338
|
# * An array of attribute names (e.g. ['size', 'color'])
|
|
339
339
|
#
|
|
340
340
|
# A few exmaples:
|
|
341
341
|
#
|
|
342
|
-
#
|
|
343
|
-
#
|
|
342
|
+
# # get all attributes
|
|
343
|
+
# table.batch_get(:all, items)
|
|
344
344
|
#
|
|
345
|
-
#
|
|
346
|
-
#
|
|
345
|
+
# # only get the 'color' attribute
|
|
346
|
+
# table.batch_get('color', items)
|
|
347
347
|
#
|
|
348
|
-
#
|
|
349
|
-
#
|
|
348
|
+
# # get 'color' and 'size' attributes
|
|
349
|
+
# table.batch_get(['color', size'], items)
|
|
350
350
|
#
|
|
351
|
-
#
|
|
351
|
+
# ## Items
|
|
352
352
|
#
|
|
353
353
|
# You must specify an array of items to fetch attributes for.
|
|
354
|
-
# The
|
|
354
|
+
# The `items` param should always be an array with:
|
|
355
355
|
#
|
|
356
356
|
# * String hash key values
|
|
357
357
|
# * Arrays of string hash key and range key values
|
|
@@ -359,41 +359,41 @@ module AWS
|
|
|
359
359
|
#
|
|
360
360
|
# Here are a few examples:
|
|
361
361
|
#
|
|
362
|
-
#
|
|
363
|
-
#
|
|
364
|
-
#
|
|
362
|
+
# # items as a list of hash key values
|
|
363
|
+
# items = %w(hashkey1 hashkey2 hashkey3)
|
|
364
|
+
# table.batch_get(:all, items)
|
|
365
365
|
#
|
|
366
|
-
#
|
|
367
|
-
#
|
|
368
|
-
#
|
|
366
|
+
# # items as a list of hash and range key values
|
|
367
|
+
# items = [['hashkey1', 'rangekey2'], ['hashkey1', 'rangekey2']]
|
|
368
|
+
# table.batch_get(:all, items)
|
|
369
369
|
#
|
|
370
|
-
#
|
|
371
|
-
#
|
|
372
|
-
#
|
|
373
|
-
#
|
|
374
|
-
#
|
|
370
|
+
# # items as a list of Item objects
|
|
371
|
+
# items = []
|
|
372
|
+
# items << Item.new(table, 'hashkey1')
|
|
373
|
+
# items << Item.new(table, 'hashkey2')
|
|
374
|
+
# table.batch_get(:all, items)
|
|
375
375
|
#
|
|
376
376
|
# Please note that you must provide both hash and range keys for tables
|
|
377
377
|
# that include a range key in the schema.
|
|
378
378
|
#
|
|
379
379
|
# @param [:all, String, Array<String>] attributes The list of
|
|
380
|
-
# attributes you want to fetch for each item.
|
|
380
|
+
# attributes you want to fetch for each item. `attributes` may be:
|
|
381
381
|
#
|
|
382
|
-
#
|
|
383
|
-
#
|
|
384
|
-
#
|
|
382
|
+
# * the symbol `:all`
|
|
383
|
+
# * a single attribute name string
|
|
384
|
+
# * an array of attribute name strings
|
|
385
385
|
#
|
|
386
386
|
# @param [Mixed] items A list of 2 or more items to fetch attributes
|
|
387
|
-
# for. You may provide
|
|
387
|
+
# for. You may provide `items` as:
|
|
388
388
|
#
|
|
389
|
-
#
|
|
390
|
-
#
|
|
391
|
-
#
|
|
389
|
+
# * an array of hash key value strings
|
|
390
|
+
# * an array of hash and range key value pairs (nested arrays)
|
|
391
|
+
# * an array of {Item} objects
|
|
392
392
|
#
|
|
393
393
|
# @param [Hash] options
|
|
394
394
|
#
|
|
395
|
-
# @option options [Boolean] :consistent_read (false) When
|
|
396
|
-
# are read from this table with consistent reads. When
|
|
395
|
+
# @option options [Boolean] :consistent_read (false) When `true`, items
|
|
396
|
+
# are read from this table with consistent reads. When `false`, reads
|
|
397
397
|
# are eventually consistent.
|
|
398
398
|
#
|
|
399
399
|
# @yield [Hash] Yields a hash of attributes for each item.
|
|
@@ -410,11 +410,11 @@ module AWS
|
|
|
410
410
|
|
|
411
411
|
# Batch puts up to 25 items to this table.
|
|
412
412
|
#
|
|
413
|
-
#
|
|
414
|
-
#
|
|
415
|
-
#
|
|
416
|
-
#
|
|
417
|
-
#
|
|
413
|
+
# table.batch_put([
|
|
414
|
+
# { :id => 'id1', :color => 'red' },
|
|
415
|
+
# { :id => 'id2', :color => 'blue' },
|
|
416
|
+
# { :id => 'id3', :color => 'green' },
|
|
417
|
+
# ])
|
|
418
418
|
#
|
|
419
419
|
# @param [Array<Hash>] items A list of item attributes to put.
|
|
420
420
|
# The hash must contain the table hash key element and range key
|
|
@@ -431,14 +431,14 @@ module AWS
|
|
|
431
431
|
# Batch writes up to 25 items to this table. A batch may contain
|
|
432
432
|
# a mix of items to put and items to delete.
|
|
433
433
|
#
|
|
434
|
-
#
|
|
435
|
-
#
|
|
436
|
-
#
|
|
437
|
-
#
|
|
438
|
-
#
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
#
|
|
434
|
+
# table.batch_write(
|
|
435
|
+
# :put => [
|
|
436
|
+
# { :id => 'id1', :color => 'red' },
|
|
437
|
+
# { :id => 'id2', :color => 'blue' },
|
|
438
|
+
# { :id => 'id3', :color => 'green' },
|
|
439
|
+
# ],
|
|
440
|
+
# :delete => ['id4', 'id5']
|
|
441
|
+
# )
|
|
442
442
|
#
|
|
443
443
|
# @param [Hash] options
|
|
444
444
|
#
|
|
@@ -454,18 +454,18 @@ module AWS
|
|
|
454
454
|
|
|
455
455
|
# Delete up to 25 items in a single batch.
|
|
456
456
|
#
|
|
457
|
-
#
|
|
457
|
+
# table.batch_delete(%w(id1 id2 id3 id4 id5))
|
|
458
458
|
#
|
|
459
459
|
# @param [Array<String>,Array<Array>] items A list of item keys to
|
|
460
460
|
# delete. For tables without a range key, items should be an array
|
|
461
461
|
# of hash key strings.
|
|
462
462
|
#
|
|
463
|
-
#
|
|
463
|
+
# batch.delete('table-name', ['hk1', 'hk2', 'hk3'])
|
|
464
464
|
#
|
|
465
465
|
# For tables with a range key, items should be an array of
|
|
466
466
|
# hash key and range key pairs.
|
|
467
467
|
#
|
|
468
|
-
#
|
|
468
|
+
# batch.delete('table-name', [['hk1', 'rk1'], ['hk1', 'rk2']])
|
|
469
469
|
#
|
|
470
470
|
# @return (see BatchWrite#process!)
|
|
471
471
|
#
|