fog-aws 3.5.2 → 3.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +485 -22
- data/LICENSE.md +1 -1
- data/README.md +117 -7
- data/fog-aws.gemspec +8 -8
- data/lib/fog/aws/compute.rb +6 -3
- data/lib/fog/aws/credential_fetcher.rb +75 -7
- data/lib/fog/aws/elasticache.rb +4 -2
- data/lib/fog/aws/elb.rb +1 -1
- data/lib/fog/aws/elbv2.rb +72 -0
- data/lib/fog/aws/kinesis.rb +23 -15
- data/lib/fog/aws/models/compute/flavors.rb +2563 -521
- data/lib/fog/aws/models/compute/security_group.rb +13 -5
- data/lib/fog/aws/models/compute/server.rb +6 -2
- data/lib/fog/aws/models/compute/servers.rb +2 -0
- data/lib/fog/aws/models/compute/snapshot.rb +7 -6
- data/lib/fog/aws/models/compute/vpc.rb +8 -2
- data/lib/fog/aws/models/storage/directories.rb +1 -0
- data/lib/fog/aws/models/storage/directory.rb +0 -1
- data/lib/fog/aws/models/storage/file.rb +164 -20
- data/lib/fog/aws/models/storage/files.rb +32 -2
- data/lib/fog/aws/parsers/compute/create_snapshot.rb +1 -1
- data/lib/fog/aws/parsers/compute/create_subnet.rb +33 -6
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +18 -4
- data/lib/fog/aws/parsers/compute/describe_subnets.rb +33 -6
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +1 -1
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +3 -3
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +3 -1
- data/lib/fog/aws/parsers/elbv2/create_load_balancer.rb +88 -0
- data/lib/fog/aws/parsers/elbv2/describe_listeners.rb +110 -0
- data/lib/fog/aws/parsers/elbv2/describe_load_balancers.rb +88 -0
- data/lib/fog/aws/parsers/elbv2/describe_tags.rb +53 -0
- data/lib/fog/aws/parsers/elbv2/empty.rb +10 -0
- data/lib/fog/aws/parsers/iam/get_group_policy.rb +1 -1
- data/lib/fog/aws/parsers/iam/get_role_policy.rb +1 -1
- data/lib/fog/aws/parsers/iam/get_user_policy.rb +1 -1
- data/lib/fog/aws/parsers/iam/policy_version.rb +1 -1
- data/lib/fog/aws/parsers/storage/get_object_tagging.rb +33 -0
- data/lib/fog/aws/parsers/storage/upload_part_copy_object.rb +18 -0
- data/lib/fog/aws/parsers/sts/assume_role_with_web_identity.rb +1 -1
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +15 -0
- data/lib/fog/aws/requests/compute/create_network_interface.rb +7 -4
- data/lib/fog/aws/requests/compute/create_subnet.rb +3 -3
- data/lib/fog/aws/requests/compute/create_vpc.rb +2 -2
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +2 -0
- data/lib/fog/aws/requests/compute/request_spot_instances.rb +1 -1
- data/lib/fog/aws/requests/compute/run_instances.rb +64 -0
- data/lib/fog/aws/requests/compute/stop_instances.rb +11 -3
- data/lib/fog/aws/requests/elbv2/add_tags.rb +45 -0
- data/lib/fog/aws/requests/elbv2/create_load_balancer.rb +160 -0
- data/lib/fog/aws/requests/elbv2/describe_listeners.rb +38 -0
- data/lib/fog/aws/requests/elbv2/describe_load_balancers.rb +100 -0
- data/lib/fog/aws/requests/elbv2/describe_tags.rb +50 -0
- data/lib/fog/aws/requests/elbv2/remove_tags.rb +45 -0
- data/lib/fog/aws/requests/rds/add_tags_to_resource.rb +12 -10
- data/lib/fog/aws/requests/rds/list_tags_for_resource.rb +10 -7
- data/lib/fog/aws/requests/rds/remove_tags_from_resource.rb +9 -8
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +18 -8
- data/lib/fog/aws/requests/storage/get_object.rb +1 -1
- data/lib/fog/aws/requests/storage/get_object_tagging.rb +41 -0
- data/lib/fog/aws/requests/storage/get_service.rb +1 -1
- data/lib/fog/aws/requests/storage/put_object_tagging.rb +42 -0
- data/lib/fog/aws/requests/storage/shared_mock_methods.rb +1 -0
- data/lib/fog/aws/requests/storage/sync_clock.rb +9 -1
- data/lib/fog/aws/requests/storage/upload_part_copy.rb +119 -0
- data/lib/fog/aws/requests/sts/assume_role_with_web_identity.rb +7 -6
- data/lib/fog/aws/storage.rb +56 -5
- data/lib/fog/aws/version.rb +1 -1
- data/lib/fog/aws.rb +7 -2
- metadata +35 -295
- data/.gitignore +0 -16
- data/.travis.yml +0 -53
- data/Gemfile +0 -14
- data/Rakefile +0 -14
- data/gemfiles/Gemfile-edge +0 -14
- data/gemfiles/Gemfile-ruby-2.0 +0 -7
- data/stale.yml +0 -17
- data/tests/credentials_tests.rb +0 -87
- data/tests/helper.rb +0 -29
- data/tests/helpers/collection_helper.rb +0 -90
- data/tests/helpers/compute/flavors_helper.rb +0 -28
- data/tests/helpers/compute/server_helper.rb +0 -23
- data/tests/helpers/compute/servers_helper.rb +0 -8
- data/tests/helpers/dns_helper.rb +0 -56
- data/tests/helpers/formats_helper.rb +0 -100
- data/tests/helpers/formats_helper_tests.rb +0 -107
- data/tests/helpers/mock_helper.rb +0 -109
- data/tests/helpers/model_helper.rb +0 -30
- data/tests/helpers/responds_to_helper.rb +0 -11
- data/tests/helpers/schema_validator_tests.rb +0 -104
- data/tests/helpers/succeeds_helper.rb +0 -9
- data/tests/lorem.txt +0 -1
- data/tests/models/auto_scaling/activities_tests.rb +0 -6
- data/tests/models/auto_scaling/configuration_test.rb +0 -13
- data/tests/models/auto_scaling/configurations_tests.rb +0 -11
- data/tests/models/auto_scaling/groups_test.rb +0 -27
- data/tests/models/auto_scaling/helper.rb +0 -0
- data/tests/models/auto_scaling/instance_tests.rb +0 -15
- data/tests/models/auto_scaling/instances_tests.rb +0 -6
- data/tests/models/beanstalk/application_tests.rb +0 -69
- data/tests/models/beanstalk/applications_tests.rb +0 -7
- data/tests/models/beanstalk/environment_tests.rb +0 -131
- data/tests/models/beanstalk/environments_tests.rb +0 -34
- data/tests/models/beanstalk/template_tests.rb +0 -47
- data/tests/models/beanstalk/templates_tests.rb +0 -62
- data/tests/models/beanstalk/version_tests.rb +0 -66
- data/tests/models/beanstalk/versions_tests.rb +0 -60
- data/tests/models/cdn/distribution_tests.rb +0 -15
- data/tests/models/cdn/distributions_tests.rb +0 -15
- data/tests/models/cdn/invalidation_tests.rb +0 -31
- data/tests/models/cdn/invalidations_tests.rb +0 -14
- data/tests/models/cdn/streaming_distribution_tests.rb +0 -15
- data/tests/models/cdn/streaming_distributions_tests.rb +0 -15
- data/tests/models/cloud_watch/alarm_data_tests.rb +0 -42
- data/tests/models/cloud_watch/alarm_history_tests.rb +0 -22
- data/tests/models/cloud_watch/metric_statistics_tests.rb +0 -51
- data/tests/models/cloud_watch/metrics_tests.rb +0 -32
- data/tests/models/compute/address_tests.rb +0 -43
- data/tests/models/compute/addresses_tests.rb +0 -5
- data/tests/models/compute/dhcp_option_tests.rb +0 -3
- data/tests/models/compute/dhcp_options_tests.rb +0 -3
- data/tests/models/compute/internet_gateway_tests.rb +0 -3
- data/tests/models/compute/internet_gateways_tests.rb +0 -3
- data/tests/models/compute/key_pair_tests.rb +0 -26
- data/tests/models/compute/key_pairs_tests.rb +0 -5
- data/tests/models/compute/network_acl_tests.rb +0 -109
- data/tests/models/compute/network_acls_tests.rb +0 -20
- data/tests/models/compute/network_interfaces_test.rb +0 -12
- data/tests/models/compute/security_group_tests.rb +0 -98
- data/tests/models/compute/security_groups_tests.rb +0 -5
- data/tests/models/compute/server_tests.rb +0 -94
- data/tests/models/compute/snapshot_tests.rb +0 -10
- data/tests/models/compute/snapshots_tests.rb +0 -10
- data/tests/models/compute/subnet_tests.rb +0 -13
- data/tests/models/compute/subnets_tests.rb +0 -5
- data/tests/models/compute/volume_tests.rb +0 -65
- data/tests/models/compute/volumes_tests.rb +0 -5
- data/tests/models/compute/vpc_tests.rb +0 -26
- data/tests/models/compute/vpcs_tests.rb +0 -19
- data/tests/models/data_pipeline/pipeline_tests.rb +0 -8
- data/tests/models/data_pipeline/pipelines_tests.rb +0 -8
- data/tests/models/dns/record_tests.rb +0 -33
- data/tests/models/dns/records_tests.rb +0 -41
- data/tests/models/dns/zone_tests.rb +0 -4
- data/tests/models/dns/zones_tests.rb +0 -4
- data/tests/models/efs/file_system_tests.rb +0 -12
- data/tests/models/efs/mount_target_tests.rb +0 -45
- data/tests/models/efs/mount_targets_tests.rb +0 -30
- data/tests/models/elasticache/cluster_tests.rb +0 -30
- data/tests/models/elasticache/parameter_groups_tests.rb +0 -15
- data/tests/models/elasticache/security_groups_tests.rb +0 -52
- data/tests/models/elasticache/subnet_groups_tests.rb +0 -43
- data/tests/models/elb/model_tests.rb +0 -360
- data/tests/models/elb/tagging_tests.rb +0 -15
- data/tests/models/glacier/model_tests.rb +0 -47
- data/tests/models/iam/access_keys_tests.rb +0 -53
- data/tests/models/iam/groups_tests.rb +0 -59
- data/tests/models/iam/instance_profile_tests.rb +0 -18
- data/tests/models/iam/managed_policies_tests.rb +0 -89
- data/tests/models/iam/policies_tests.rb +0 -57
- data/tests/models/iam/roles_tests.rb +0 -71
- data/tests/models/iam/users_tests.rb +0 -119
- data/tests/models/rds/cluster_tests.rb +0 -54
- data/tests/models/rds/clusters_tests.rb +0 -5
- data/tests/models/rds/event_subscription_tests.rb +0 -9
- data/tests/models/rds/event_subscriptions_tests.rb +0 -6
- data/tests/models/rds/helper.rb +0 -25
- data/tests/models/rds/instance_option_tests.rb +0 -14
- data/tests/models/rds/parameter_group_tests.rb +0 -24
- data/tests/models/rds/parameter_groups_tests.rb +0 -8
- data/tests/models/rds/security_group_tests.rb +0 -77
- data/tests/models/rds/security_groups_tests.rb +0 -5
- data/tests/models/rds/server_tests.rb +0 -131
- data/tests/models/rds/servers_tests.rb +0 -24
- data/tests/models/rds/snapshot_tests.rb +0 -12
- data/tests/models/rds/snapshots_tests.rb +0 -12
- data/tests/models/rds/tagging_tests.rb +0 -20
- data/tests/models/sns/topic_tests.rb +0 -15
- data/tests/models/sns/topics_tests.rb +0 -6
- data/tests/models/storage/directory_tests.rb +0 -91
- data/tests/models/storage/file_tests.rb +0 -129
- data/tests/models/storage/files_tests.rb +0 -58
- data/tests/models/storage/url_tests.rb +0 -25
- data/tests/models/storage/version_tests.rb +0 -52
- data/tests/models/storage/versions_tests.rb +0 -51
- data/tests/models/support/trusted_advisor_tests.rb +0 -25
- data/tests/parsers/compute/describe_images_tests.rb +0 -33
- data/tests/parsers/elb/describe_load_balancers.rb +0 -65
- data/tests/requests/auto_scaling/auto_scaling_tests.rb +0 -111
- data/tests/requests/auto_scaling/describe_types_tests.rb +0 -102
- data/tests/requests/auto_scaling/helper.rb +0 -229
- data/tests/requests/auto_scaling/model_tests.rb +0 -235
- data/tests/requests/auto_scaling/notification_configuration_tests.rb +0 -124
- data/tests/requests/auto_scaling/tag_tests.rb +0 -63
- data/tests/requests/beanstalk/application_tests.rb +0 -140
- data/tests/requests/beanstalk/solution_stack_tests.rb +0 -22
- data/tests/requests/cdn/cdn_tests.rb +0 -252
- data/tests/requests/cloud_formation/stack_tests.rb +0 -167
- data/tests/requests/cloud_watch/get_metric_statistics_tests.rb +0 -28
- data/tests/requests/cloud_watch/list_metrics_test.rb +0 -64
- data/tests/requests/cloud_watch/put_metric_data_tests.rb +0 -36
- data/tests/requests/compute/address_tests.rb +0 -144
- data/tests/requests/compute/assign_private_ip_tests.rb +0 -55
- data/tests/requests/compute/availability_zone_tests.rb +0 -25
- data/tests/requests/compute/client_tests.rb +0 -25
- data/tests/requests/compute/dhcp_options_tests.rb +0 -39
- data/tests/requests/compute/helper.rb +0 -27
- data/tests/requests/compute/image_tests.rb +0 -169
- data/tests/requests/compute/instance_attrib_tests.rb +0 -168
- data/tests/requests/compute/instance_tests.rb +0 -338
- data/tests/requests/compute/internet_gateway_tests.rb +0 -49
- data/tests/requests/compute/key_pair_tests.rb +0 -67
- data/tests/requests/compute/network_acl_tests.rb +0 -112
- data/tests/requests/compute/network_interface_tests.rb +0 -239
- data/tests/requests/compute/placement_group_tests.rb +0 -48
- data/tests/requests/compute/region_tests.rb +0 -52
- data/tests/requests/compute/route_tests.rb +0 -341
- data/tests/requests/compute/security_group_tests.rb +0 -446
- data/tests/requests/compute/snapshot_tests.rb +0 -77
- data/tests/requests/compute/spot_datafeed_subscription_tests.rb +0 -47
- data/tests/requests/compute/spot_instance_tests.rb +0 -55
- data/tests/requests/compute/spot_price_history_tests.rb +0 -23
- data/tests/requests/compute/subnet_tests.rb +0 -87
- data/tests/requests/compute/tag_tests.rb +0 -101
- data/tests/requests/compute/volume_tests.rb +0 -263
- data/tests/requests/compute/vpc_tests.rb +0 -216
- data/tests/requests/data_pipeline/helper.rb +0 -78
- data/tests/requests/data_pipeline/pipeline_tests.rb +0 -80
- data/tests/requests/dns/change_resource_record_sets_tests.rb +0 -34
- data/tests/requests/dns/dns_tests.rb +0 -240
- data/tests/requests/dns/health_check_tests.rb +0 -159
- data/tests/requests/dns/helper.rb +0 -21
- data/tests/requests/dynamodb/item_tests.rb +0 -137
- data/tests/requests/dynamodb/table_tests.rb +0 -99
- data/tests/requests/ecs/cluster_tests.rb +0 -112
- data/tests/requests/ecs/container_instance_tests.rb +0 -119
- data/tests/requests/ecs/helper.rb +0 -276
- data/tests/requests/ecs/sample_task_definition1.json +0 -56
- data/tests/requests/ecs/service_tests.rb +0 -132
- data/tests/requests/ecs/task_definitions_tests.rb +0 -97
- data/tests/requests/ecs/task_tests.rb +0 -145
- data/tests/requests/efs/file_system_tests.rb +0 -152
- data/tests/requests/efs/helper.rb +0 -44
- data/tests/requests/elasticache/cache_cluster_tests.rb +0 -137
- data/tests/requests/elasticache/describe_events.rb +0 -17
- data/tests/requests/elasticache/describe_reserved_cache_nodes.rb +0 -17
- data/tests/requests/elasticache/helper.rb +0 -103
- data/tests/requests/elasticache/parameter_group_tests.rb +0 -105
- data/tests/requests/elasticache/security_group_tests.rb +0 -108
- data/tests/requests/elasticache/subnet_group_tests.rb +0 -52
- data/tests/requests/elb/helper.rb +0 -91
- data/tests/requests/elb/listener_tests.rb +0 -68
- data/tests/requests/elb/load_balancer_tests.rb +0 -89
- data/tests/requests/elb/policy_tests.rb +0 -132
- data/tests/requests/emr/helper.rb +0 -167
- data/tests/requests/emr/instance_group_tests.rb +0 -106
- data/tests/requests/emr/job_flow_tests.rb +0 -88
- data/tests/requests/federation/get_signin_token_tests.rb +0 -11
- data/tests/requests/glacier/archive_tests.rb +0 -13
- data/tests/requests/glacier/multipart_upload_tests.rb +0 -29
- data/tests/requests/glacier/tree_hash_tests.rb +0 -91
- data/tests/requests/glacier/vault_tests.rb +0 -35
- data/tests/requests/iam/access_key_tests.rb +0 -53
- data/tests/requests/iam/account_policy_tests.rb +0 -20
- data/tests/requests/iam/account_tests.rb +0 -34
- data/tests/requests/iam/group_policy_tests.rb +0 -48
- data/tests/requests/iam/group_tests.rb +0 -44
- data/tests/requests/iam/helper.rb +0 -154
- data/tests/requests/iam/instance_profile_tests.rb +0 -44
- data/tests/requests/iam/login_profile_tests.rb +0 -62
- data/tests/requests/iam/managed_policy_tests.rb +0 -110
- data/tests/requests/iam/mfa_tests.rb +0 -23
- data/tests/requests/iam/role_tests.rb +0 -156
- data/tests/requests/iam/server_certificate_tests.rb +0 -130
- data/tests/requests/iam/user_policy_tests.rb +0 -45
- data/tests/requests/iam/user_tests.rb +0 -78
- data/tests/requests/iam/versioned_managed_policy_tests.rb +0 -105
- data/tests/requests/kinesis/helper.rb +0 -111
- data/tests/requests/kinesis/stream_tests.rb +0 -169
- data/tests/requests/kms/helper.rb +0 -27
- data/tests/requests/kms/key_tests.rb +0 -23
- data/tests/requests/lambda/function_sample_1.js +0 -9
- data/tests/requests/lambda/function_sample_2.js +0 -9
- data/tests/requests/lambda/function_tests.rb +0 -460
- data/tests/requests/lambda/helper.rb +0 -81
- data/tests/requests/rds/cluster_snapshot_tests.rb +0 -43
- data/tests/requests/rds/cluster_tests.rb +0 -37
- data/tests/requests/rds/db_engine_versions.rb +0 -7
- data/tests/requests/rds/db_snapshot_tests.rb +0 -62
- data/tests/requests/rds/describe_events.rb +0 -16
- data/tests/requests/rds/event_subscription_tests.rb +0 -30
- data/tests/requests/rds/helper.rb +0 -406
- data/tests/requests/rds/instance_option_tests.rb +0 -27
- data/tests/requests/rds/instance_tests.rb +0 -149
- data/tests/requests/rds/log_file_tests.rb +0 -19
- data/tests/requests/rds/parameter_group_tests.rb +0 -62
- data/tests/requests/rds/parameter_request_tests.rb +0 -32
- data/tests/requests/rds/security_group_tests.rb +0 -101
- data/tests/requests/rds/subnet_groups_tests.rb +0 -52
- data/tests/requests/rds/tagging_tests.rb +0 -78
- data/tests/requests/redshift/cluster_parameter_group_tests.rb +0 -76
- data/tests/requests/redshift/cluster_security_group_tests.rb +0 -42
- data/tests/requests/redshift/cluster_snapshot_tests.rb +0 -73
- data/tests/requests/redshift/cluster_tests.rb +0 -80
- data/tests/requests/ses/helper.rb +0 -9
- data/tests/requests/ses/verified_domain_identity_tests.rb +0 -16
- data/tests/requests/ses/verified_email_address_tests.rb +0 -27
- data/tests/requests/simpledb/attributes_tests.rb +0 -86
- data/tests/requests/simpledb/domain_tests.rb +0 -51
- data/tests/requests/simpledb/helper.rb +0 -10
- data/tests/requests/sns/helper.rb +0 -9
- data/tests/requests/sns/subscription_tests.rb +0 -86
- data/tests/requests/sns/topic_tests.rb +0 -53
- data/tests/requests/sqs/helper.rb +0 -9
- data/tests/requests/sqs/message_tests.rb +0 -51
- data/tests/requests/sqs/queue_tests.rb +0 -50
- data/tests/requests/storage/acl_utils_tests.rb +0 -209
- data/tests/requests/storage/bucket_tests.rb +0 -416
- data/tests/requests/storage/cors_utils_tests.rb +0 -108
- data/tests/requests/storage/delete_multiple_objects_tests.rb +0 -12
- data/tests/requests/storage/multipart_upload_tests.rb +0 -121
- data/tests/requests/storage/object_tests.rb +0 -262
- data/tests/requests/storage/versioning_tests.rb +0 -262
- data/tests/requests/sts/assume_role_tests.rb +0 -19
- data/tests/requests/sts/assume_role_with_saml_tests.rb +0 -18
- data/tests/requests/sts/assume_role_with_web_identity_tests.rb +0 -28
- data/tests/requests/sts/get_federation_token_tests.rb +0 -20
- data/tests/requests/sts/session_token_tests.rb +0 -16
- data/tests/requests/support/helper.rb +0 -43
- data/tests/requests/support/trusted_advisor_check_tests.rb +0 -16
- data/tests/signaturev4_tests.rb +0 -106
- data/tests/signed_params_tests.rb +0 -17
- data/tests/storage_tests.rb +0 -7
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014-
|
3
|
+
Copyright (c) 2014-2019 [CONTRIBUTORS.md](https://github.com/fog/fog-aws/blob/master/CONTRIBUTORS.md)
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
data/README.md
CHANGED
@@ -1,12 +1,10 @@
|
|
1
1
|
# Fog::Aws
|
2
2
|
|
3
3
|
![Gem Version](https://badge.fury.io/rb/fog-aws.svg)
|
4
|
-
[![Build Status](https://
|
5
|
-
[![Dependency Status](https://gemnasium.com/fog/fog-aws.svg)](https://gemnasium.com/fog/fog-aws)
|
4
|
+
[![Build Status](https://github.com/fog/fog-aws/actions/workflows/ruby.yml/badge.svg)](https://github.com/fog/fog-aws/actions/workflows/ruby.yml)
|
6
5
|
[![Test Coverage](https://codeclimate.com/github/fog/fog-aws/badges/coverage.svg)](https://codeclimate.com/github/fog/fog-aws)
|
7
6
|
[![Code Climate](https://codeclimate.com/github/fog/fog-aws.svg)](https://codeclimate.com/github/fog/fog-aws)
|
8
7
|
|
9
|
-
|
10
8
|
## Installation
|
11
9
|
|
12
10
|
Add this line to your application's Gemfile:
|
@@ -39,7 +37,10 @@ default:
|
|
39
37
|
aws_secret_access_key: <YOUR_SECRET_ACCESS_KEY>
|
40
38
|
```
|
41
39
|
|
42
|
-
###
|
40
|
+
### EC2
|
41
|
+
|
42
|
+
#### Connecting to the EC2 Service:
|
43
|
+
|
43
44
|
```ruby
|
44
45
|
ec2 = Fog::Compute.new :provider => 'AWS', :region => 'us-west-2'
|
45
46
|
```
|
@@ -50,7 +51,7 @@ You can review all the requests available with this service using ```#requests``
|
|
50
51
|
ec2.requests # => [:allocate_address, :assign_private_ip_addresses, :associate_address, ...]
|
51
52
|
```
|
52
53
|
|
53
|
-
|
54
|
+
#### Launch an EC2 on-demand instance:
|
54
55
|
|
55
56
|
```ruby
|
56
57
|
response = ec2.run_instances(
|
@@ -67,19 +68,128 @@ instance.wait_for { ready? }
|
|
67
68
|
puts instance.public_ip_address # => "356.300.501.20"
|
68
69
|
```
|
69
70
|
|
70
|
-
|
71
|
+
#### Terminate an EC2 instance:
|
71
72
|
|
72
73
|
```ruby
|
73
74
|
instance = ec2.servers.get("i-02db5af4")
|
74
75
|
instance.destroy
|
75
76
|
```
|
76
77
|
|
77
|
-
Fog::AWS is more than EC2 since it supports many services provided by AWS. The best way to learn and to know about how many services are supported is to take a look at the source code. To review the tests directory and to play with the library in ```
|
78
|
+
`Fog::AWS` is more than EC2 since it supports many services provided by AWS. The best way to learn and to know about how many services are supported is to take a look at the source code. To review the tests directory and to play with the library in ```bin/console``` can be very helpful resources as well.
|
79
|
+
|
80
|
+
### S3
|
81
|
+
|
82
|
+
#### Connecting to the S3 Service:
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
s3 = Fog::Storage.new(provider: 'AWS', region: 'eu-central-1')
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Creating a file:
|
89
|
+
|
90
|
+
```ruby
|
91
|
+
directory = s3.directories.new(key: 'gaudi-portal-dev')
|
92
|
+
file = directory.files.create(key: 'user/1/Gemfile', body: File.open('Gemfile'), tags: 'Org-Id=1&Service-Name=My-Service')
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Listing files:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
directory = s3.directories.get('gaudi-portal-dev', prefix: 'user/1/')
|
99
|
+
directory.files
|
100
|
+
```
|
101
|
+
**Warning!** `s3.directories.get` retrieves and caches meta data for the first 10,000 objects in the bucket, which can be very expensive. When possible use `s3.directories.new`.
|
102
|
+
|
103
|
+
#### Generating a URL for a file:
|
104
|
+
|
105
|
+
```ruby
|
106
|
+
directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60)
|
107
|
+
```
|
108
|
+
|
109
|
+
##### Generate download URL
|
110
|
+
You should pass an option argument that contains the `query` key with `response-content-disposition` inside indicating that is an attachment and the filename to be used when downloaded.
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
options = {
|
114
|
+
query: {
|
115
|
+
'response-content-disposition' => "attachment; filename=#{key}"
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60, options)
|
120
|
+
```
|
121
|
+
|
122
|
+
|
123
|
+
##### Controlling credential refresh time with IAM authentication
|
124
|
+
|
125
|
+
When using IAM authentication with
|
126
|
+
[temporary security credentials](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRoleWithWebIdentity.html),
|
127
|
+
generated S3 pre-signed URLs
|
128
|
+
[only last as long as the temporary credential](https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html).
|
129
|
+
|
130
|
+
Generating the URLs in the following manner will return a URL
|
131
|
+
that will not last as long as its requested expiration time if
|
132
|
+
the remainder of the authentication token lifetime was shorter.
|
133
|
+
|
134
|
+
```ruby
|
135
|
+
s3 = Fog::Storage.new(provider: 'AWS', use_iam_profile: true)
|
136
|
+
directory = s3.directories.get('gaudi-portal-dev', prefix: 'user/1/')
|
137
|
+
|
138
|
+
directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60)
|
139
|
+
```
|
140
|
+
|
141
|
+
By default the temporary credentials in use are refreshed only within the last
|
142
|
+
15 seconds of its expiration time. The URL requested with 60 seconds lifetime
|
143
|
+
using the above example will only remain valid for 15 seconds in the worst case.
|
144
|
+
|
145
|
+
The problem can be avoided by refreshing the token early and often,
|
146
|
+
by setting configuration `aws_credentials_refresh_threshold_seconds` (default: 15)
|
147
|
+
which controls the time when the refresh must occur. It is expressed in seconds
|
148
|
+
before the temporary credential's expiration time.
|
149
|
+
|
150
|
+
The following example can ensure pre-signed URLs last as long as 60 seconds
|
151
|
+
by automatically refreshing the credentials when its remainder lifetime
|
152
|
+
is lower than 60 seconds:
|
153
|
+
|
154
|
+
```ruby
|
155
|
+
s3 = Fog::Storage.new(
|
156
|
+
provider: 'AWS',
|
157
|
+
use_iam_profile: true,
|
158
|
+
aws_credentials_refresh_threshold_seconds: 60
|
159
|
+
)
|
160
|
+
directory = s3.directories.get('gaudi-portal-dev', prefix: 'user/1/')
|
161
|
+
|
162
|
+
directory.files.new(key: 'user/1/Gemfile').url(Time.now + 60)
|
163
|
+
```
|
164
|
+
|
165
|
+
#### Copying a file
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
directory = s3.directories.new(key: 'gaudi-portal-dev')
|
169
|
+
file = directory.files.get('user/1/Gemfile')
|
170
|
+
file.copy("target-bucket", "user/2/Gemfile.copy")
|
171
|
+
```
|
172
|
+
|
173
|
+
To speed transfers of large files, the `concurrency` option can be used
|
174
|
+
to spawn multiple threads. Note that the file must be at least 5 MB for
|
175
|
+
multipart uploads to work. For example:
|
176
|
+
|
177
|
+
```ruby
|
178
|
+
directory = s3.directories.new(key: 'gaudi-portal-dev')
|
179
|
+
file = directory.files.get('user/1/Gemfile')
|
180
|
+
file.multipart_chunk_size = 10 * 1024 * 1024
|
181
|
+
file.concurrency = 10
|
182
|
+
file.copy("target-bucket", "user/2/Gemfile.copy")
|
183
|
+
```
|
78
184
|
|
79
185
|
## Documentation
|
80
186
|
|
81
187
|
See the [online documentation](http://www.rubydoc.info/github/fog/fog-aws) for a complete API reference.
|
82
188
|
|
189
|
+
## Development
|
190
|
+
|
191
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
192
|
+
|
83
193
|
## Contributing
|
84
194
|
|
85
195
|
1. Fork it ( https://github.com/fog/fog-aws/fork )
|
data/fog-aws.gemspec
CHANGED
@@ -14,21 +14,21 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/fog/fog-aws"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
-
spec.files =
|
18
|
-
|
19
|
-
|
17
|
+
spec.files = Dir['lib/**/*.{rb,json}',
|
18
|
+
'CHANGELOG.md', 'CONTRIBUTING.md', 'CONTRIBUTORS.md',
|
19
|
+
'LICENSE.md', 'README.md', 'fog-aws.gemspec',]
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
21
|
spec.require_paths = ["lib"]
|
21
22
|
|
22
23
|
spec.required_ruby_version = '>= 2.0.0'
|
23
24
|
|
24
|
-
spec.add_development_dependency 'bundler'
|
25
|
-
spec.add_development_dependency 'github_changelog_generator', '~> 1.
|
26
|
-
spec.add_development_dependency 'rake', '
|
27
|
-
spec.add_development_dependency 'rubyzip', '~>
|
25
|
+
spec.add_development_dependency 'bundler'
|
26
|
+
spec.add_development_dependency 'github_changelog_generator', '~> 1.16'
|
27
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
28
|
+
spec.add_development_dependency 'rubyzip', '~> 2.3.0'
|
28
29
|
spec.add_development_dependency 'shindo', '~> 0.3'
|
29
30
|
|
30
31
|
spec.add_dependency 'fog-core', '~> 2.1'
|
31
32
|
spec.add_dependency 'fog-json', '~> 1.1'
|
32
33
|
spec.add_dependency 'fog-xml', '~> 0.1'
|
33
|
-
spec.add_dependency 'ipaddress', '~> 0.8'
|
34
34
|
end
|
data/lib/fog/aws/compute.rb
CHANGED
@@ -233,21 +233,24 @@ module Fog
|
|
233
233
|
'fromPort' => -1,
|
234
234
|
'toPort' => -1,
|
235
235
|
'ipProtocol' => 'icmp',
|
236
|
-
'ipRanges' => []
|
236
|
+
'ipRanges' => [],
|
237
|
+
'ipv6Ranges' => []
|
237
238
|
},
|
238
239
|
{
|
239
240
|
'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
|
240
241
|
'fromPort' => 0,
|
241
242
|
'toPort' => 65535,
|
242
243
|
'ipProtocol' => 'tcp',
|
243
|
-
'ipRanges' => []
|
244
|
+
'ipRanges' => [],
|
245
|
+
'ipv6Ranges' => []
|
244
246
|
},
|
245
247
|
{
|
246
248
|
'groups' => [{'groupName' => 'default', 'userId' => owner_id, 'groupId' => security_group_id}],
|
247
249
|
'fromPort' => 0,
|
248
250
|
'toPort' => 65535,
|
249
251
|
'ipProtocol' => 'udp',
|
250
|
-
'ipRanges' => []
|
252
|
+
'ipRanges' => [],
|
253
|
+
'ipv6Ranges' => []
|
251
254
|
}
|
252
255
|
],
|
253
256
|
'ownerId' => owner_id
|
@@ -1,8 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'securerandom'
|
4
|
+
|
1
5
|
module Fog
|
2
6
|
module AWS
|
3
7
|
module CredentialFetcher
|
4
8
|
|
5
9
|
INSTANCE_METADATA_HOST = "http://169.254.169.254"
|
10
|
+
INSTANCE_METADATA_TOKEN = "/latest/api/token"
|
6
11
|
INSTANCE_METADATA_PATH = "/latest/meta-data/iam/security-credentials/"
|
7
12
|
INSTANCE_METADATA_AZ = "/latest/meta-data/placement/availability-zone/"
|
8
13
|
|
@@ -16,25 +21,60 @@ module Fog
|
|
16
21
|
if options[:use_iam_profile]
|
17
22
|
begin
|
18
23
|
role_data = nil
|
19
|
-
region = options[:region]
|
24
|
+
region = options[:region] || ENV["AWS_DEFAULT_REGION"]
|
20
25
|
|
21
26
|
if ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
|
22
27
|
connection = options[:connection] || Excon.new(CONTAINER_CREDENTIALS_HOST)
|
23
28
|
credential_path = options[:credential_path] || ENV["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]
|
24
29
|
role_data = connection.get(:path => credential_path, :idempotent => true, :expects => 200).body
|
30
|
+
session = Fog::JSON.decode(role_data)
|
31
|
+
|
32
|
+
if region.nil?
|
33
|
+
connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
|
34
|
+
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
|
35
|
+
region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
|
36
|
+
end
|
37
|
+
elsif ENV["AWS_WEB_IDENTITY_TOKEN_FILE"]
|
38
|
+
params = {
|
39
|
+
:Action => "AssumeRoleWithWebIdentity",
|
40
|
+
:RoleArn => options[:role_arn] || ENV.fetch("AWS_ROLE_ARN"),
|
41
|
+
:RoleSessionName => options[:role_session_name] || ENV["AWS_ROLE_SESSION_NAME"] || "fog-aws-#{SecureRandom.hex}",
|
42
|
+
:WebIdentityToken => File.read(options[:aws_web_identity_token_file] || ENV.fetch("AWS_WEB_IDENTITY_TOKEN_FILE")),
|
43
|
+
:Version => "2011-06-15",
|
44
|
+
}
|
45
|
+
|
46
|
+
sts_endpoint =
|
47
|
+
if ENV["AWS_STS_REGIONAL_ENDPOINTS"] == "regional" && region
|
48
|
+
"https://sts.#{region}.amazonaws.com"
|
49
|
+
else
|
50
|
+
"https://sts.amazonaws.com"
|
51
|
+
end
|
52
|
+
|
53
|
+
connection = options[:connection] || Excon.new(sts_endpoint, :query => params)
|
54
|
+
document = Nokogiri::XML(connection.get(:idempotent => true, :expects => 200).body)
|
55
|
+
|
56
|
+
session = {
|
57
|
+
"AccessKeyId" => document.css("AccessKeyId").children.text,
|
58
|
+
"SecretAccessKey" => document.css("SecretAccessKey").children.text,
|
59
|
+
"Token" => document.css("SessionToken").children.text,
|
60
|
+
"Expiration" => document.css("Expiration").children.text,
|
61
|
+
}
|
25
62
|
|
26
63
|
if region.nil?
|
27
64
|
connection = options[:metadata_connection] || Excon.new(INSTANCE_METADATA_HOST)
|
28
|
-
|
65
|
+
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
|
66
|
+
region = connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
|
29
67
|
end
|
30
68
|
else
|
31
69
|
connection = options[:connection] || Excon.new(INSTANCE_METADATA_HOST)
|
32
|
-
|
33
|
-
|
34
|
-
|
70
|
+
token_header = fetch_credentials_token_header(connection, options[:disable_imds_v2])
|
71
|
+
role_name = connection.get(:path => INSTANCE_METADATA_PATH, :idempotent => true, :expects => 200, :headers => token_header).body
|
72
|
+
role_data = connection.get(:path => INSTANCE_METADATA_PATH+role_name, :idempotent => true, :expects => 200, :headers => token_header).body
|
73
|
+
session = Fog::JSON.decode(role_data)
|
74
|
+
|
75
|
+
region ||= connection.get(:path => INSTANCE_METADATA_AZ, :idempotent => true, :expects => 200, :headers => token_header).body[0..-2]
|
35
76
|
end
|
36
77
|
|
37
|
-
session = Fog::JSON.decode(role_data)
|
38
78
|
credentials = {}
|
39
79
|
credentials[:aws_access_key_id] = session['AccessKeyId']
|
40
80
|
credentials[:aws_secret_access_key] = session['SecretAccessKey']
|
@@ -43,6 +83,7 @@ module Fog
|
|
43
83
|
|
44
84
|
# set region by default to the one the instance is in.
|
45
85
|
credentials[:region] = region
|
86
|
+
credentials[:sts_endpoint] = sts_endpoint if sts_endpoint
|
46
87
|
#these indicate the metadata service is unavailable or has no profile setup
|
47
88
|
credentials
|
48
89
|
rescue Excon::Error => e
|
@@ -53,6 +94,26 @@ module Fog
|
|
53
94
|
super
|
54
95
|
end
|
55
96
|
end
|
97
|
+
|
98
|
+
def fetch_credentials_token_header(connection, disable_imds_v2)
|
99
|
+
return nil if disable_imds_v2
|
100
|
+
|
101
|
+
token = connection.put(
|
102
|
+
:path => INSTANCE_METADATA_TOKEN,
|
103
|
+
:idempotent => true,
|
104
|
+
:expects => 200,
|
105
|
+
:retry_interval => 1,
|
106
|
+
:retry_limit => 3,
|
107
|
+
:read_timeout => 1,
|
108
|
+
:write_timeout => 1,
|
109
|
+
:connect_timeout => 1,
|
110
|
+
:headers => { "X-aws-ec2-metadata-token-ttl-seconds" => "300" }
|
111
|
+
).body
|
112
|
+
|
113
|
+
{ "X-aws-ec2-metadata-token" => token }
|
114
|
+
rescue Excon::Error
|
115
|
+
nil
|
116
|
+
end
|
56
117
|
end
|
57
118
|
|
58
119
|
module ConnectionMethods
|
@@ -62,10 +123,17 @@ module Fog
|
|
62
123
|
|
63
124
|
private
|
64
125
|
|
126
|
+
# When defined, 'aws_credentials_refresh_threshold_seconds' controls
|
127
|
+
# when the credential needs to be refreshed, expressed in seconds before
|
128
|
+
# the current credential's expiration time
|
129
|
+
def credentials_refresh_threshold
|
130
|
+
@aws_credentials_refresh_threshold_seconds || 15
|
131
|
+
end
|
132
|
+
|
65
133
|
def credentials_expired?
|
66
134
|
@use_iam_profile &&
|
67
135
|
(!@aws_credentials_expire_at ||
|
68
|
-
(@aws_credentials_expire_at && Fog::Time.now > @aws_credentials_expire_at -
|
136
|
+
(@aws_credentials_expire_at && Fog::Time.now > @aws_credentials_expire_at - credentials_refresh_threshold)) #new credentials become available from around 5 minutes before expiration time
|
69
137
|
end
|
70
138
|
|
71
139
|
def refresh_credentials
|
data/lib/fog/aws/elasticache.rb
CHANGED
@@ -171,8 +171,10 @@ module Fog
|
|
171
171
|
@aws_credentials_expire_at = Time::now + 20
|
172
172
|
setup_credentials(options)
|
173
173
|
@region = options[:region] || 'us-east-1'
|
174
|
-
unless ['ap-
|
175
|
-
'
|
174
|
+
unless ['ap-south-1', 'ap-northeast-1', 'ap-northeast-2', 'ap-northeast-3', 'ap-southeast-1', 'ap-southeast-2',
|
175
|
+
'eu-west-1', 'eu-west-2', 'eu-west-3', 'eu-central-1',
|
176
|
+
'us-east-1', 'us-east-2', 'us-west-1', 'us-west-2', 'ca-central-1',
|
177
|
+
'sa-east-1', 'cn-north-1', 'cn-northwest-1', 'ap-east-1', 'us-gov-west-1'].include?(@region)
|
176
178
|
raise ArgumentError, "Unknown region: #{@region.inspect}"
|
177
179
|
end
|
178
180
|
end
|
data/lib/fog/aws/elb.rb
CHANGED
@@ -142,7 +142,7 @@ module Fog
|
|
142
142
|
@port = options[:port] || 443
|
143
143
|
@scheme = options[:scheme] || 'https'
|
144
144
|
@connection = Fog::XML::Connection.new("#{@scheme}://#{@host}:#{@port}#{@path}", @persistent, @connection_options)
|
145
|
-
@version
|
145
|
+
@version ||= options[:version] || '2012-06-01'
|
146
146
|
|
147
147
|
setup_credentials(options)
|
148
148
|
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module Fog
|
2
|
+
module AWS
|
3
|
+
class ELBV2 < ELB
|
4
|
+
requires :aws_access_key_id, :aws_secret_access_key
|
5
|
+
recognizes :region, :host, :path, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :version, :instrumentor, :instrumentor_name
|
6
|
+
|
7
|
+
request_path 'fog/aws/requests/elbv2'
|
8
|
+
request :add_tags
|
9
|
+
request :create_load_balancer
|
10
|
+
request :describe_tags
|
11
|
+
request :remove_tags
|
12
|
+
request :describe_load_balancers
|
13
|
+
request :describe_listeners
|
14
|
+
|
15
|
+
class Real < ELB::Real
|
16
|
+
def initialize(options={})
|
17
|
+
@version = '2015-12-01'
|
18
|
+
|
19
|
+
super(options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Mock
|
24
|
+
def self.data
|
25
|
+
@data ||= Hash.new do |hash, region|
|
26
|
+
owner_id = Fog::AWS::Mock.owner_id
|
27
|
+
hash[region] = Hash.new do |region_hash, key|
|
28
|
+
region_hash[key] = {
|
29
|
+
:owner_id => owner_id,
|
30
|
+
:load_balancers_v2 => {}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.dns_name(name, region)
|
37
|
+
"#{name}-#{Fog::Mock.random_hex(8)}.#{region}.elb.amazonaws.com"
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.reset
|
41
|
+
@data = nil
|
42
|
+
end
|
43
|
+
|
44
|
+
attr_reader :region
|
45
|
+
|
46
|
+
def initialize(options={})
|
47
|
+
@use_iam_profile = options[:use_iam_profile]
|
48
|
+
|
49
|
+
@region = options[:region] || 'us-east-1'
|
50
|
+
setup_credentials(options)
|
51
|
+
|
52
|
+
Fog::AWS.validate_region!(@region)
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_credentials(options)
|
56
|
+
@aws_access_key_id = options[:aws_access_key_id]
|
57
|
+
@aws_secret_access_key = options[:aws_secret_access_key]
|
58
|
+
|
59
|
+
@signer = Fog::AWS::SignatureV4.new(@aws_access_key_id, @aws_secret_access_key,@region,'elasticloadbalancing')
|
60
|
+
end
|
61
|
+
|
62
|
+
def data
|
63
|
+
self.class.data[@region][@aws_access_key_id]
|
64
|
+
end
|
65
|
+
|
66
|
+
def reset_data
|
67
|
+
self.class.data[@region].delete(@aws_access_key_id)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
data/lib/fog/aws/kinesis.rb
CHANGED
@@ -125,23 +125,26 @@ module Fog
|
|
125
125
|
end
|
126
126
|
|
127
127
|
class Mock
|
128
|
-
|
129
|
-
@mutex ||= Mutex.new
|
130
|
-
end
|
131
|
-
def mutex; self.class.mutex; end
|
128
|
+
@mutex = Mutex.new
|
132
129
|
|
133
130
|
def self.data
|
134
|
-
@
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
131
|
+
@mutex.synchronize do
|
132
|
+
@data ||= Hash.new do |hash, region|
|
133
|
+
hash[region] = Hash.new do |region_hash, key|
|
134
|
+
region_hash[key] = {
|
135
|
+
:kinesis_streams => {}
|
136
|
+
}
|
137
|
+
end
|
139
138
|
end
|
139
|
+
|
140
|
+
yield @data if block_given?
|
140
141
|
end
|
141
142
|
end
|
142
143
|
|
143
144
|
def self.reset
|
144
|
-
@
|
145
|
+
@mutex.synchronize do
|
146
|
+
@data = nil
|
147
|
+
end
|
145
148
|
end
|
146
149
|
|
147
150
|
def initialize(options={})
|
@@ -153,31 +156,36 @@ module Fog
|
|
153
156
|
end
|
154
157
|
|
155
158
|
def data
|
156
|
-
self.class.data
|
159
|
+
self.class.data do |data|
|
160
|
+
data[@region][@aws_access_key_id]
|
161
|
+
end
|
157
162
|
end
|
158
163
|
|
159
164
|
def reset_data
|
160
|
-
self.class.data
|
165
|
+
self.class.data do |data|
|
166
|
+
data[@region].delete(@aws_access_key_id)
|
167
|
+
end
|
161
168
|
end
|
162
169
|
|
163
170
|
def self.next_sequence_number
|
164
|
-
mutex.synchronize do
|
171
|
+
@mutex.synchronize do
|
165
172
|
@sequence_number ||= -1
|
166
173
|
@sequence_number += 1
|
167
174
|
@sequence_number.to_s
|
168
175
|
end
|
169
176
|
end
|
177
|
+
|
170
178
|
def next_sequence_number; self.class.next_sequence_number; end
|
171
179
|
|
172
180
|
def self.next_shard_id
|
173
|
-
mutex.synchronize do
|
181
|
+
@mutex.synchronize do
|
174
182
|
@shard_id ||= -1
|
175
183
|
@shard_id += 1
|
176
184
|
"shardId-#{@shard_id.to_s.rjust(12, "0")}"
|
177
185
|
end
|
178
186
|
end
|
187
|
+
|
179
188
|
def next_shard_id; self.class.next_shard_id; end
|
180
|
-
|
181
189
|
end
|
182
190
|
|
183
191
|
end
|