fog-aws 3.0.0 → 3.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +10 -0
- data/.github/workflows/ruby.yml +36 -0
- data/.github/workflows/stale.yml +23 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +354 -22
- data/Gemfile +1 -1
- data/LICENSE.md +1 -1
- data/README.md +60 -7
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/fog-aws.gemspec +5 -4
- data/lib/fog/aws.rb +27 -19
- data/lib/fog/aws/auto_scaling.rb +1 -0
- data/lib/fog/aws/cdn.rb +15 -2
- data/lib/fog/aws/compute.rb +36 -23
- data/lib/fog/aws/credential_fetcher.rb +62 -8
- data/lib/fog/aws/dns.rb +154 -5
- data/lib/fog/aws/efs.rb +1 -1
- data/lib/fog/aws/elasticache.rb +4 -2
- data/lib/fog/aws/elb.rb +3 -2
- data/lib/fog/aws/elbv2.rb +72 -0
- data/lib/fog/aws/glacier.rb +83 -21
- data/lib/fog/aws/kinesis.rb +23 -15
- data/lib/fog/aws/models/auto_scaling/group.rb +10 -0
- data/lib/fog/aws/models/cdn/distribution.rb +4 -4
- data/lib/fog/aws/models/cdn/distribution_helper.rb +2 -2
- data/lib/fog/aws/models/cdn/distributions.rb +4 -4
- data/lib/fog/aws/models/cdn/distributions_helper.rb +2 -2
- data/lib/fog/aws/models/cdn/invalidation.rb +2 -2
- data/lib/fog/aws/models/cdn/invalidations.rb +3 -3
- data/lib/fog/aws/models/cdn/streaming_distribution.rb +3 -3
- data/lib/fog/aws/models/cdn/streaming_distributions.rb +4 -4
- data/lib/fog/aws/models/compute/address.rb +3 -2
- data/lib/fog/aws/models/compute/addresses.rb +3 -3
- data/lib/fog/aws/models/compute/dhcp_option.rb +2 -2
- data/lib/fog/aws/models/compute/dhcp_options.rb +7 -7
- data/lib/fog/aws/models/compute/flavor.rb +2 -2
- data/lib/fog/aws/models/compute/flavors.rb +2719 -397
- data/lib/fog/aws/models/compute/image.rb +2 -2
- data/lib/fog/aws/models/compute/images.rb +3 -3
- data/lib/fog/aws/models/compute/internet_gateway.rb +2 -2
- data/lib/fog/aws/models/compute/internet_gateways.rb +7 -7
- data/lib/fog/aws/models/compute/key_pair.rb +2 -2
- data/lib/fog/aws/models/compute/key_pairs.rb +3 -3
- data/lib/fog/aws/models/compute/network_acl.rb +4 -4
- data/lib/fog/aws/models/compute/network_acls.rb +6 -6
- data/lib/fog/aws/models/compute/network_interface.rb +2 -2
- data/lib/fog/aws/models/compute/network_interfaces.rb +4 -4
- data/lib/fog/aws/models/compute/route_table.rb +2 -2
- data/lib/fog/aws/models/compute/route_tables.rb +7 -7
- data/lib/fog/aws/models/compute/security_group.rb +2 -2
- data/lib/fog/aws/models/compute/security_groups.rb +3 -3
- data/lib/fog/aws/models/compute/server.rb +6 -4
- data/lib/fog/aws/models/compute/servers.rb +13 -8
- data/lib/fog/aws/models/compute/snapshot.rb +9 -8
- data/lib/fog/aws/models/compute/snapshots.rb +3 -3
- data/lib/fog/aws/models/compute/spot_request.rb +2 -2
- data/lib/fog/aws/models/compute/spot_requests.rb +3 -3
- data/lib/fog/aws/models/compute/subnet.rb +2 -2
- data/lib/fog/aws/models/compute/subnets.rb +3 -3
- data/lib/fog/aws/models/compute/tag.rb +2 -2
- data/lib/fog/aws/models/compute/tags.rb +3 -3
- data/lib/fog/aws/models/compute/volume.rb +3 -3
- data/lib/fog/aws/models/compute/volumes.rb +3 -3
- data/lib/fog/aws/models/compute/vpc.rb +10 -4
- data/lib/fog/aws/models/compute/vpcs.rb +3 -3
- data/lib/fog/aws/models/dns/record.rb +2 -2
- data/lib/fog/aws/models/dns/records.rb +4 -4
- data/lib/fog/aws/models/dns/zone.rb +3 -3
- data/lib/fog/aws/models/dns/zones.rb +4 -4
- data/lib/fog/aws/models/efs/file_system.rb +4 -0
- data/lib/fog/aws/models/rds/cluster.rb +9 -1
- data/lib/fog/aws/models/rds/server.rb +66 -63
- data/lib/fog/aws/models/storage/directories.rb +3 -3
- data/lib/fog/aws/models/storage/directory.rb +40 -6
- data/lib/fog/aws/models/storage/file.rb +132 -7
- data/lib/fog/aws/models/storage/files.rb +36 -6
- data/lib/fog/aws/models/storage/version.rb +2 -2
- data/lib/fog/aws/models/storage/versions.rb +3 -3
- data/lib/fog/aws/parsers/cdn/distribution.rb +2 -2
- data/lib/fog/aws/parsers/cdn/get_distribution_list.rb +2 -2
- data/lib/fog/aws/parsers/cdn/get_invalidation.rb +2 -2
- data/lib/fog/aws/parsers/cdn/get_invalidation_list.rb +2 -2
- data/lib/fog/aws/parsers/cdn/get_streaming_distribution_list.rb +2 -2
- data/lib/fog/aws/parsers/cdn/post_invalidation.rb +2 -2
- data/lib/fog/aws/parsers/cdn/streaming_distribution.rb +1 -1
- data/lib/fog/aws/parsers/compute/allocate_address.rb +2 -2
- data/lib/fog/aws/parsers/compute/assign_private_ip_addresses.rb +2 -2
- data/lib/fog/aws/parsers/compute/associate_address.rb +2 -2
- data/lib/fog/aws/parsers/compute/associate_route_table.rb +2 -2
- data/lib/fog/aws/parsers/compute/attach_network_interface.rb +2 -2
- data/lib/fog/aws/parsers/compute/attach_volume.rb +2 -2
- data/lib/fog/aws/parsers/compute/basic.rb +2 -2
- data/lib/fog/aws/parsers/compute/cancel_spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/compute/copy_image.rb +2 -2
- data/lib/fog/aws/parsers/compute/copy_snapshot.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_dhcp_options.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_image.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_internet_gateway.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_key_pair.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_network_acl.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_network_interface.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_route_table.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_security_group.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_snapshot.rb +3 -3
- data/lib/fog/aws/parsers/compute/create_subnet.rb +35 -8
- data/lib/fog/aws/parsers/compute/create_volume.rb +2 -2
- data/lib/fog/aws/parsers/compute/create_vpc.rb +2 -2
- data/lib/fog/aws/parsers/compute/deregister_image.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_account_attributes.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_addresses.rb +32 -11
- data/lib/fog/aws/parsers/compute/describe_availability_zones.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_classic_link_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_dhcp_options.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_image_attribute.rb +122 -0
- data/lib/fog/aws/parsers/compute/describe_images.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_instance_attribute.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_instance_status.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_internet_gateways.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_key_pairs.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_network_acls.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_network_interface_attribute.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_network_interfaces.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_placement_groups.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_regions.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_reserved_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_reserved_instances_offerings.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_route_tables.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_security_groups.rb +3 -3
- data/lib/fog/aws/parsers/compute/describe_snapshots.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_spot_price_history.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_subnets.rb +35 -8
- data/lib/fog/aws/parsers/compute/describe_tags.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_volume_status.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_volumes.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_volumes_modifications.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_vpc_attribute.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_vpc_classic_link.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_vpc_classic_link_dns_support.rb +2 -2
- data/lib/fog/aws/parsers/compute/describe_vpcs.rb +2 -2
- data/lib/fog/aws/parsers/compute/detach_volume.rb +2 -2
- data/lib/fog/aws/parsers/compute/get_console_output.rb +2 -2
- data/lib/fog/aws/parsers/compute/get_password_data.rb +2 -2
- data/lib/fog/aws/parsers/compute/import_key_pair.rb +2 -2
- data/lib/fog/aws/parsers/compute/modify_subnet_attribute.rb +2 -2
- data/lib/fog/aws/parsers/compute/modify_volume.rb +2 -2
- data/lib/fog/aws/parsers/compute/monitor_unmonitor_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/move_address_to_vpc.rb +2 -2
- data/lib/fog/aws/parsers/compute/network_acl_parser.rb +2 -2
- data/lib/fog/aws/parsers/compute/network_interface_parser.rb +2 -2
- data/lib/fog/aws/parsers/compute/purchase_reserved_instances_offering.rb +2 -2
- data/lib/fog/aws/parsers/compute/register_image.rb +2 -2
- data/lib/fog/aws/parsers/compute/replace_network_acl_association.rb +2 -2
- data/lib/fog/aws/parsers/compute/restore_address_to_classic.rb +2 -2
- data/lib/fog/aws/parsers/compute/run_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/spot_datafeed_subscription.rb +2 -2
- data/lib/fog/aws/parsers/compute/spot_instance_requests.rb +2 -2
- data/lib/fog/aws/parsers/compute/start_stop_instances.rb +2 -2
- data/lib/fog/aws/parsers/compute/terminate_instances.rb +2 -2
- data/lib/fog/aws/parsers/dns/change_resource_record_sets.rb +2 -2
- data/lib/fog/aws/parsers/dns/create_hosted_zone.rb +3 -3
- data/lib/fog/aws/parsers/dns/delete_hosted_zone.rb +2 -2
- data/lib/fog/aws/parsers/dns/get_change.rb +2 -2
- data/lib/fog/aws/parsers/dns/get_hosted_zone.rb +5 -5
- data/lib/fog/aws/parsers/dns/health_check.rb +2 -2
- data/lib/fog/aws/parsers/dns/list_health_checks.rb +2 -2
- data/lib/fog/aws/parsers/dns/list_hosted_zones.rb +5 -3
- data/lib/fog/aws/parsers/dns/list_resource_record_sets.rb +2 -2
- data/lib/fog/aws/parsers/elb/describe_load_balancers.rb +3 -3
- 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/rds/db_parser.rb +41 -2
- data/lib/fog/aws/parsers/storage/access_control_list.rb +2 -2
- data/lib/fog/aws/parsers/storage/complete_multipart_upload.rb +2 -2
- data/lib/fog/aws/parsers/storage/copy_object.rb +2 -2
- data/lib/fog/aws/parsers/storage/cors_configuration.rb +2 -2
- data/lib/fog/aws/parsers/storage/delete_multiple_objects.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_lifecycle.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_location.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_logging.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_notification.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_object_versions.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_tagging.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_versioning.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_bucket_website.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_object_tagging.rb +33 -0
- data/lib/fog/aws/parsers/storage/get_request_payment.rb +2 -2
- data/lib/fog/aws/parsers/storage/get_service.rb +2 -2
- data/lib/fog/aws/parsers/storage/initiate_multipart_upload.rb +2 -2
- data/lib/fog/aws/parsers/storage/list_multipart_uploads.rb +2 -2
- data/lib/fog/aws/parsers/storage/list_parts.rb +2 -2
- 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/auto_scaling/set_instance_protection.rb +67 -0
- data/lib/fog/aws/requests/cdn/delete_distribution.rb +6 -6
- data/lib/fog/aws/requests/cdn/delete_streaming_distribution.rb +6 -6
- data/lib/fog/aws/requests/cdn/get_distribution.rb +5 -5
- data/lib/fog/aws/requests/cdn/get_distribution_list.rb +3 -3
- data/lib/fog/aws/requests/cdn/get_invalidation.rb +5 -5
- data/lib/fog/aws/requests/cdn/get_invalidation_list.rb +4 -4
- data/lib/fog/aws/requests/cdn/get_streaming_distribution.rb +5 -5
- data/lib/fog/aws/requests/cdn/get_streaming_distribution_list.rb +3 -3
- data/lib/fog/aws/requests/cdn/post_distribution.rb +6 -6
- data/lib/fog/aws/requests/cdn/post_invalidation.rb +5 -5
- data/lib/fog/aws/requests/cdn/post_streaming_distribution.rb +6 -6
- data/lib/fog/aws/requests/cdn/put_distribution_config.rb +7 -7
- data/lib/fog/aws/requests/cdn/put_streaming_distribution_config.rb +7 -7
- data/lib/fog/aws/requests/cloud_watch/put_metric_alarm.rb +2 -2
- data/lib/fog/aws/requests/compute/allocate_address.rb +4 -4
- data/lib/fog/aws/requests/compute/assign_private_ip_addresses.rb +5 -5
- data/lib/fog/aws/requests/compute/associate_address.rb +7 -7
- data/lib/fog/aws/requests/compute/associate_dhcp_options.rb +4 -4
- data/lib/fog/aws/requests/compute/associate_route_table.rb +5 -5
- data/lib/fog/aws/requests/compute/attach_classic_link_vpc.rb +7 -7
- data/lib/fog/aws/requests/compute/attach_internet_gateway.rb +4 -4
- data/lib/fog/aws/requests/compute/attach_network_interface.rb +6 -6
- data/lib/fog/aws/requests/compute/attach_volume.rb +7 -7
- data/lib/fog/aws/requests/compute/authorize_security_group_egress.rb +6 -6
- data/lib/fog/aws/requests/compute/authorize_security_group_ingress.rb +11 -11
- data/lib/fog/aws/requests/compute/cancel_spot_instance_requests.rb +4 -4
- data/lib/fog/aws/requests/compute/copy_image.rb +3 -3
- data/lib/fog/aws/requests/compute/copy_snapshot.rb +3 -3
- data/lib/fog/aws/requests/compute/create_dhcp_options.rb +3 -3
- data/lib/fog/aws/requests/compute/create_image.rb +3 -3
- data/lib/fog/aws/requests/compute/create_internet_gateway.rb +3 -3
- data/lib/fog/aws/requests/compute/create_key_pair.rb +4 -4
- data/lib/fog/aws/requests/compute/create_network_acl.rb +4 -4
- data/lib/fog/aws/requests/compute/create_network_acl_entry.rb +5 -5
- data/lib/fog/aws/requests/compute/create_network_interface.rb +6 -6
- data/lib/fog/aws/requests/compute/create_placement_group.rb +3 -3
- data/lib/fog/aws/requests/compute/create_route.rb +10 -10
- data/lib/fog/aws/requests/compute/create_route_table.rb +4 -4
- data/lib/fog/aws/requests/compute/create_security_group.rb +4 -4
- data/lib/fog/aws/requests/compute/create_snapshot.rb +3 -3
- data/lib/fog/aws/requests/compute/create_spot_datafeed_subscription.rb +3 -3
- data/lib/fog/aws/requests/compute/create_subnet.rb +6 -6
- data/lib/fog/aws/requests/compute/create_tags.rb +3 -3
- data/lib/fog/aws/requests/compute/create_volume.rb +11 -11
- data/lib/fog/aws/requests/compute/create_vpc.rb +7 -7
- data/lib/fog/aws/requests/compute/delete_dhcp_options.rb +4 -4
- data/lib/fog/aws/requests/compute/delete_internet_gateway.rb +4 -4
- data/lib/fog/aws/requests/compute/delete_key_pair.rb +3 -3
- data/lib/fog/aws/requests/compute/delete_network_acl.rb +5 -5
- data/lib/fog/aws/requests/compute/delete_network_acl_entry.rb +5 -5
- data/lib/fog/aws/requests/compute/delete_network_interface.rb +5 -5
- data/lib/fog/aws/requests/compute/delete_placement_group.rb +3 -3
- data/lib/fog/aws/requests/compute/delete_route.rb +6 -6
- data/lib/fog/aws/requests/compute/delete_route_table.rb +5 -5
- data/lib/fog/aws/requests/compute/delete_security_group.rb +9 -9
- data/lib/fog/aws/requests/compute/delete_snapshot.rb +4 -4
- data/lib/fog/aws/requests/compute/delete_spot_datafeed_subscription.rb +3 -3
- data/lib/fog/aws/requests/compute/delete_subnet.rb +4 -4
- data/lib/fog/aws/requests/compute/delete_tags.rb +3 -3
- data/lib/fog/aws/requests/compute/delete_volume.rb +5 -5
- data/lib/fog/aws/requests/compute/delete_vpc.rb +4 -4
- data/lib/fog/aws/requests/compute/deregister_image.rb +4 -4
- data/lib/fog/aws/requests/compute/describe_account_attributes.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_addresses.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_availability_zones.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_classic_link_instances.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_dhcp_options.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_image_attribute.rb +74 -0
- data/lib/fog/aws/requests/compute/describe_images.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_instance_attribute.rb +4 -4
- data/lib/fog/aws/requests/compute/describe_instance_status.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_instances.rb +4 -4
- data/lib/fog/aws/requests/compute/describe_internet_gateways.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_key_pairs.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_network_acls.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_network_interface_attribute.rb +5 -5
- data/lib/fog/aws/requests/compute/describe_network_interfaces.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_placement_groups.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_regions.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_reserved_instances.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_reserved_instances_offerings.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_route_tables.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_security_groups.rb +15 -4
- data/lib/fog/aws/requests/compute/describe_snapshots.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_spot_datafeed_subscription.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_spot_instance_requests.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_spot_price_history.rb +5 -5
- data/lib/fog/aws/requests/compute/describe_subnets.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_tags.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_volume_status.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_volumes.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_volumes_modifications.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_vpc_attribute.rb +5 -5
- data/lib/fog/aws/requests/compute/describe_vpc_classic_link.rb +4 -4
- data/lib/fog/aws/requests/compute/describe_vpc_classic_link_dns_support.rb +3 -3
- data/lib/fog/aws/requests/compute/describe_vpcs.rb +3 -3
- data/lib/fog/aws/requests/compute/detach_classic_link_vpc.rb +5 -5
- data/lib/fog/aws/requests/compute/detach_internet_gateway.rb +4 -4
- data/lib/fog/aws/requests/compute/detach_network_interface.rb +4 -4
- data/lib/fog/aws/requests/compute/detach_volume.rb +5 -5
- data/lib/fog/aws/requests/compute/disable_vpc_classic_link.rb +4 -4
- data/lib/fog/aws/requests/compute/disable_vpc_classic_link_dns_support.rb +4 -4
- data/lib/fog/aws/requests/compute/disassociate_address.rb +5 -5
- data/lib/fog/aws/requests/compute/disassociate_route_table.rb +5 -5
- data/lib/fog/aws/requests/compute/enable_vpc_classic_link.rb +4 -4
- data/lib/fog/aws/requests/compute/enable_vpc_classic_link_dns_support.rb +4 -4
- data/lib/fog/aws/requests/compute/get_console_output.rb +4 -4
- data/lib/fog/aws/requests/compute/get_password_data.rb +4 -4
- data/lib/fog/aws/requests/compute/import_key_pair.rb +4 -4
- data/lib/fog/aws/requests/compute/modify_image_attribute.rb +4 -4
- data/lib/fog/aws/requests/compute/modify_instance_attribute.rb +3 -3
- data/lib/fog/aws/requests/compute/modify_instance_placement.rb +33 -0
- data/lib/fog/aws/requests/compute/modify_network_interface_attribute.rb +8 -8
- data/lib/fog/aws/requests/compute/modify_snapshot_attribute.rb +3 -3
- data/lib/fog/aws/requests/compute/modify_subnet_attribute.rb +3 -3
- data/lib/fog/aws/requests/compute/modify_volume.rb +5 -5
- data/lib/fog/aws/requests/compute/modify_volume_attribute.rb +4 -4
- data/lib/fog/aws/requests/compute/modify_vpc_attribute.rb +7 -7
- data/lib/fog/aws/requests/compute/monitor_instances.rb +4 -4
- data/lib/fog/aws/requests/compute/move_address_to_vpc.rb +4 -4
- data/lib/fog/aws/requests/compute/purchase_reserved_instances_offering.rb +3 -3
- data/lib/fog/aws/requests/compute/reboot_instances.rb +4 -4
- data/lib/fog/aws/requests/compute/register_image.rb +4 -4
- data/lib/fog/aws/requests/compute/release_address.rb +5 -5
- data/lib/fog/aws/requests/compute/replace_network_acl_association.rb +5 -5
- data/lib/fog/aws/requests/compute/replace_network_acl_entry.rb +5 -5
- data/lib/fog/aws/requests/compute/replace_route.rb +10 -10
- data/lib/fog/aws/requests/compute/request_spot_instances.rb +8 -8
- data/lib/fog/aws/requests/compute/reset_network_interface_attribute.rb +6 -6
- data/lib/fog/aws/requests/compute/restore_address_to_classic.rb +5 -5
- data/lib/fog/aws/requests/compute/revoke_security_group_egress.rb +4 -4
- data/lib/fog/aws/requests/compute/revoke_security_group_ingress.rb +4 -4
- data/lib/fog/aws/requests/compute/run_instances.rb +24 -4
- data/lib/fog/aws/requests/compute/start_instances.rb +4 -4
- data/lib/fog/aws/requests/compute/stop_instances.rb +15 -7
- data/lib/fog/aws/requests/compute/terminate_instances.rb +4 -4
- data/lib/fog/aws/requests/compute/unmonitor_instances.rb +4 -4
- data/lib/fog/aws/requests/dns/change_resource_record_sets.rb +6 -139
- data/lib/fog/aws/requests/dns/create_health_check.rb +3 -3
- data/lib/fog/aws/requests/dns/create_hosted_zone.rb +4 -4
- data/lib/fog/aws/requests/dns/delete_health_check.rb +2 -2
- data/lib/fog/aws/requests/dns/delete_hosted_zone.rb +4 -4
- data/lib/fog/aws/requests/dns/get_change.rb +4 -4
- data/lib/fog/aws/requests/dns/get_health_check.rb +3 -3
- data/lib/fog/aws/requests/dns/get_hosted_zone.rb +4 -4
- data/lib/fog/aws/requests/dns/list_health_checks.rb +3 -3
- data/lib/fog/aws/requests/dns/list_hosted_zones.rb +3 -3
- data/lib/fog/aws/requests/dns/list_resource_record_sets.rb +5 -5
- data/lib/fog/aws/requests/dynamodb/update_item.rb +6 -5
- data/lib/fog/aws/requests/efs/create_file_system.rb +15 -3
- data/lib/fog/aws/requests/elb/create_load_balancer.rb +7 -7
- data/lib/fog/aws/requests/elb/deregister_instances_from_load_balancer.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_instance_health.rb +1 -1
- data/lib/fog/aws/requests/elb/describe_tags.rb +1 -1
- data/lib/fog/aws/requests/elb/register_instances_with_load_balancer.rb +1 -1
- 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/lambda/invoke.rb +7 -7
- data/lib/fog/aws/requests/rds/authorize_db_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/rds/create_db_instance.rb +1 -1
- data/lib/fog/aws/requests/rds/create_db_subnet_group.rb +2 -2
- data/lib/fog/aws/requests/rds/modify_db_instance.rb +1 -1
- data/lib/fog/aws/requests/rds/revoke_db_security_group_ingress.rb +1 -1
- data/lib/fog/aws/requests/storage/abort_multipart_upload.rb +3 -3
- data/lib/fog/aws/requests/storage/acl_utils.rb +3 -3
- data/lib/fog/aws/requests/storage/complete_multipart_upload.rb +4 -4
- data/lib/fog/aws/requests/storage/copy_object.rb +3 -3
- data/lib/fog/aws/requests/storage/cors_utils.rb +3 -3
- data/lib/fog/aws/requests/storage/delete_bucket.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket_cors.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket_lifecycle.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket_policy.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket_tagging.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_bucket_website.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_multiple_objects.rb +21 -11
- data/lib/fog/aws/requests/storage/delete_object.rb +2 -2
- data/lib/fog/aws/requests/storage/delete_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/get_bucket.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_acl.rb +4 -4
- data/lib/fog/aws/requests/storage/get_bucket_cors.rb +4 -4
- data/lib/fog/aws/requests/storage/get_bucket_lifecycle.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_location.rb +5 -6
- data/lib/fog/aws/requests/storage/get_bucket_logging.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_notification.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_object_versions.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_policy.rb +2 -2
- data/lib/fog/aws/requests/storage/get_bucket_tagging.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_versioning.rb +3 -3
- data/lib/fog/aws/requests/storage/get_bucket_website.rb +3 -3
- data/lib/fog/aws/requests/storage/get_object.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_acl.rb +4 -4
- data/lib/fog/aws/requests/storage/get_object_http_url.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_https_url.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_tagging.rb +41 -0
- data/lib/fog/aws/requests/storage/get_object_torrent.rb +2 -2
- data/lib/fog/aws/requests/storage/get_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/get_request_payment.rb +3 -3
- data/lib/fog/aws/requests/storage/get_service.rb +5 -5
- data/lib/fog/aws/requests/storage/head_bucket.rb +2 -2
- data/lib/fog/aws/requests/storage/head_object.rb +2 -2
- data/lib/fog/aws/requests/storage/head_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/initiate_multipart_upload.rb +4 -4
- data/lib/fog/aws/requests/storage/list_multipart_uploads.rb +3 -3
- data/lib/fog/aws/requests/storage/list_parts.rb +3 -3
- data/lib/fog/aws/requests/storage/post_object_hidden_fields.rb +2 -2
- data/lib/fog/aws/requests/storage/post_object_restore.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_acl.rb +4 -4
- data/lib/fog/aws/requests/storage/put_bucket_cors.rb +4 -4
- data/lib/fog/aws/requests/storage/put_bucket_lifecycle.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_logging.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_notification.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_policy.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_tagging.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_versioning.rb +2 -2
- data/lib/fog/aws/requests/storage/put_bucket_website.rb +2 -2
- data/lib/fog/aws/requests/storage/put_object.rb +9 -7
- data/lib/fog/aws/requests/storage/put_object_acl.rb +4 -4
- data/lib/fog/aws/requests/storage/put_object_tagging.rb +42 -0
- data/lib/fog/aws/requests/storage/put_object_url.rb +2 -2
- data/lib/fog/aws/requests/storage/put_request_payment.rb +2 -2
- data/lib/fog/aws/requests/storage/shared_mock_methods.rb +4 -3
- data/lib/fog/aws/requests/storage/sync_clock.rb +2 -2
- data/lib/fog/aws/requests/storage/upload_part.rb +3 -3
- 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/service_mapper.rb +5 -5
- data/lib/fog/aws/storage.rb +50 -19
- data/lib/fog/aws/version.rb +1 -1
- data/tests/credentials_tests.rb +102 -39
- data/tests/helper.rb +2 -2
- data/tests/helpers/collection_helper.rb +3 -4
- data/tests/helpers/compute/flavors_helper.rb +1 -5
- data/tests/helpers/compute/server_helper.rb +1 -3
- data/tests/helpers/compute/servers_helper.rb +0 -2
- data/tests/helpers/dns_helper.rb +32 -31
- data/tests/helpers/formats_helper.rb +58 -56
- data/tests/helpers/formats_helper_tests.rb +22 -25
- data/tests/helpers/mock_helper.rb +96 -96
- data/tests/helpers/model_helper.rb +4 -5
- data/tests/helpers/responds_to_helper.rb +1 -1
- data/tests/helpers/schema_validator_tests.rb +21 -24
- data/tests/helpers/succeeds_helper.rb +2 -2
- data/tests/models/compute/address_tests.rb +1 -1
- data/tests/models/compute/network_acl_tests.rb +4 -4
- data/tests/models/compute/security_group_tests.rb +1 -1
- data/tests/models/compute/volume_tests.rb +1 -1
- data/tests/models/elb/model_tests.rb +1 -1
- data/tests/models/storage/directory_tests.rb +113 -2
- data/tests/models/storage/files_tests.rb +32 -0
- data/tests/parsers/compute/describe_images_tests.rb +2 -2
- data/tests/parsers/elb/describe_load_balancers.rb +1 -1
- data/tests/parsers/elbv2/create_load_balancer_tests.rb +48 -0
- data/tests/parsers/elbv2/describe_listeners_tests.rb +76 -0
- data/tests/parsers/elbv2/describe_load_balancers_tests.rb +54 -0
- data/tests/parsers/elbv2/describe_tags_tests.rb +35 -0
- data/tests/requests/auto_scaling/auto_scaling_tests.rb +8 -0
- data/tests/requests/compute/address_tests.rb +9 -9
- data/tests/requests/compute/assign_private_ip_tests.rb +3 -3
- data/tests/requests/compute/image_tests.rb +11 -2
- data/tests/requests/compute/instance_attrib_tests.rb +1 -1
- data/tests/requests/compute/instance_tests.rb +5 -5
- data/tests/requests/compute/internet_gateway_tests.rb +1 -1
- data/tests/requests/compute/key_pair_tests.rb +1 -1
- data/tests/requests/compute/network_acl_tests.rb +2 -2
- data/tests/requests/compute/network_interface_tests.rb +6 -6
- data/tests/requests/compute/placement_group_tests.rb +2 -2
- data/tests/requests/compute/region_tests.rb +4 -4
- data/tests/requests/compute/route_tests.rb +24 -24
- data/tests/requests/compute/security_group_tests.rb +14 -14
- data/tests/requests/compute/snapshot_tests.rb +1 -1
- data/tests/requests/compute/spot_datafeed_subscription_tests.rb +1 -1
- data/tests/requests/compute/subnet_tests.rb +3 -3
- data/tests/requests/compute/tag_tests.rb +3 -3
- data/tests/requests/compute/volume_tests.rb +11 -11
- data/tests/requests/compute/vpc_tests.rb +9 -3
- data/tests/requests/dns/change_resource_record_sets_tests.rb +3 -3
- data/tests/requests/efs/helper.rb +2 -0
- data/tests/requests/elbv2/helper.rb +66 -0
- data/tests/requests/elbv2/load_balancer_tests.rb +50 -0
- data/tests/requests/glacier/tree_hash_tests.rb +29 -0
- data/tests/requests/storage/acl_utils_tests.rb +24 -24
- data/tests/requests/storage/bucket_tests.rb +1 -1
- data/tests/requests/storage/cors_utils_tests.rb +14 -14
- data/tests/requests/storage/multipart_copy_tests.rb +93 -0
- data/tests/requests/storage/object_tests.rb +7 -0
- data/tests/requests/storage/versioning_tests.rb +38 -0
- data/tests/requests/sts/assume_role_with_web_identity_tests.rb +2 -0
- data/tests/signaturev4_tests.rb +21 -22
- data/tests/signed_params_tests.rb +7 -7
- data/tests/storage_tests.rb +1 -1
- metadata +61 -17
- data/.travis.yml +0 -55
- data/gemfiles/Gemfile-ruby-2.0 +0 -7
@@ -6,12 +6,13 @@ module Fog
|
|
6
6
|
|
7
7
|
def assume_role_with_web_identity(role_arn, web_identity_token, role_session_name, options={})
|
8
8
|
request_unsigned(
|
9
|
-
'Action'
|
10
|
-
'RoleArn'
|
11
|
-
'RoleSessionName'
|
12
|
-
'
|
13
|
-
|
14
|
-
:
|
9
|
+
'Action' => 'AssumeRoleWithWebIdentity',
|
10
|
+
'RoleArn' => role_arn,
|
11
|
+
'RoleSessionName' => role_session_name,
|
12
|
+
'WebIdentityToken' => web_identity_token,
|
13
|
+
'DurationSeconds' => options[:duration] || 3600,
|
14
|
+
:idempotent => true,
|
15
|
+
:parser => Fog::Parsers::AWS::STS::AssumeRoleWithWebIdentity.new
|
15
16
|
)
|
16
17
|
end
|
17
18
|
end
|
@@ -14,19 +14,19 @@ module Fog
|
|
14
14
|
when :beanstalk
|
15
15
|
Fog::AWS::ElasticBeanstalk
|
16
16
|
when :cdn
|
17
|
-
Fog::CDN
|
17
|
+
Fog::AWS::CDN
|
18
18
|
when :cloud_formation
|
19
19
|
Fog::AWS::CloudFormation
|
20
20
|
when :cloud_watch
|
21
21
|
Fog::AWS::CloudWatch
|
22
22
|
when :compute
|
23
|
-
Fog::Compute
|
23
|
+
Fog::AWS::Compute
|
24
24
|
when :data_pipeline
|
25
25
|
Fog::AWS::DataPipeline
|
26
26
|
when :ddb, :dynamodb
|
27
27
|
Fog::AWS::DynamoDB
|
28
28
|
when :dns
|
29
|
-
Fog::DNS
|
29
|
+
Fog::AWS::DNS
|
30
30
|
when :elasticache
|
31
31
|
Fog::AWS::Elasticache
|
32
32
|
when :elb
|
@@ -46,7 +46,7 @@ module Fog
|
|
46
46
|
when :sqs
|
47
47
|
Fog::AWS::SQS
|
48
48
|
when :eu_storage, :storage
|
49
|
-
Fog::Storage
|
49
|
+
Fog::AWS::Storage
|
50
50
|
when :rds
|
51
51
|
Fog::AWS::RDS
|
52
52
|
when :sns
|
@@ -126,4 +126,4 @@ module Fog
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
end
|
129
|
-
end
|
129
|
+
end
|
data/lib/fog/aws/storage.rb
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
module Fog
|
2
|
-
module
|
3
|
-
class
|
2
|
+
module AWS
|
3
|
+
class Storage < Fog::Service
|
4
4
|
extend Fog::AWS::CredentialFetcher::ServiceMethods
|
5
5
|
|
6
6
|
COMPLIANT_BUCKET_NAMES = /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
7
7
|
|
8
8
|
DEFAULT_REGION = 'us-east-1'
|
9
|
+
ACCELERATION_HOST = 's3-accelerate.amazonaws.com'
|
9
10
|
|
10
11
|
DEFAULT_SCHEME = 'https'
|
11
12
|
DEFAULT_SCHEME_PORT = {
|
@@ -42,7 +43,7 @@ module Fog
|
|
42
43
|
]
|
43
44
|
|
44
45
|
requires :aws_access_key_id, :aws_secret_access_key
|
45
|
-
recognizes :endpoint, :region, :host, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :path_style, :instrumentor, :instrumentor_name, :aws_signature_version
|
46
|
+
recognizes :endpoint, :region, :host, :port, :scheme, :persistent, :use_iam_profile, :aws_session_token, :aws_credentials_expire_at, :path_style, :acceleration, :instrumentor, :instrumentor_name, :aws_signature_version, :enable_signature_v4_streaming, :virtual_host, :cname
|
46
47
|
|
47
48
|
secrets :aws_secret_access_key, :hmac
|
48
49
|
|
@@ -83,6 +84,7 @@ module Fog
|
|
83
84
|
request :get_object_http_url
|
84
85
|
request :get_object_https_url
|
85
86
|
request :get_object_url
|
87
|
+
request :get_object_tagging
|
86
88
|
request :get_request_payment
|
87
89
|
request :get_service
|
88
90
|
request :head_bucket
|
@@ -106,9 +108,11 @@ module Fog
|
|
106
108
|
request :put_object
|
107
109
|
request :put_object_acl
|
108
110
|
request :put_object_url
|
111
|
+
request :put_object_tagging
|
109
112
|
request :put_request_payment
|
110
113
|
request :sync_clock
|
111
114
|
request :upload_part
|
115
|
+
request :upload_part_copy
|
112
116
|
|
113
117
|
module Utils
|
114
118
|
attr_accessor :region
|
@@ -130,7 +134,7 @@ module Fog
|
|
130
134
|
end
|
131
135
|
|
132
136
|
def url(params, expires)
|
133
|
-
Fog::Logger.deprecation("Fog::Storage
|
137
|
+
Fog::Logger.deprecation("Fog::AWS::Storage => #url is deprecated, use #https_url instead [light_black](#{caller.first})[/]")
|
134
138
|
https_url(params, expires)
|
135
139
|
end
|
136
140
|
|
@@ -221,10 +225,10 @@ module Fog
|
|
221
225
|
case region.to_s
|
222
226
|
when DEFAULT_REGION, ''
|
223
227
|
's3.amazonaws.com'
|
224
|
-
when
|
225
|
-
|
228
|
+
when %r{\Acn-.*}
|
229
|
+
"s3.#{region}.amazonaws.com.cn"
|
226
230
|
else
|
227
|
-
"s3
|
231
|
+
"s3.#{region}.amazonaws.com"
|
228
232
|
end
|
229
233
|
end
|
230
234
|
|
@@ -280,16 +284,22 @@ module Fog
|
|
280
284
|
path_style = params.fetch(:path_style, @path_style)
|
281
285
|
if !path_style
|
282
286
|
if COMPLIANT_BUCKET_NAMES !~ bucket_name
|
283
|
-
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) is not a valid dns name, which will negatively impact performance. For details see:
|
287
|
+
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) is not a valid dns name, which will negatively impact performance. For details see: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html")
|
284
288
|
path_style = true
|
285
289
|
elsif scheme == 'https' && !path_style && bucket_name =~ /\./
|
286
|
-
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) contains a '.' so is not accessible over https as a virtual hosted bucket, which will negatively impact performance. For details see:
|
290
|
+
Fog::Logger.warning("fog: the specified s3 bucket name(#{bucket_name}) contains a '.' so is not accessible over https as a virtual hosted bucket, which will negatively impact performance. For details see: https://docs.aws.amazon.com/AmazonS3/latest/userguide/bucketnamingrules.html")
|
287
291
|
path_style = true
|
288
292
|
end
|
289
293
|
end
|
290
294
|
|
291
|
-
if
|
295
|
+
# uses the bucket name as host if `virtual_host: true`, you can also
|
296
|
+
# manually specify the cname if required.
|
297
|
+
if params[:virtual_host]
|
298
|
+
host = params.fetch(:cname, bucket_name)
|
299
|
+
elsif path_style
|
292
300
|
path = bucket_to_path bucket_name, path
|
301
|
+
elsif host.start_with?("#{bucket_name}.")
|
302
|
+
# no-op
|
293
303
|
else
|
294
304
|
host = [bucket_name, host].join('.')
|
295
305
|
end
|
@@ -316,7 +326,8 @@ module Fog
|
|
316
326
|
def params_to_url(params)
|
317
327
|
query = params[:query] && params[:query].map do |key, value|
|
318
328
|
if value
|
319
|
-
|
329
|
+
# URL parameters need / to be escaped
|
330
|
+
[key, Fog::AWS.escape(value.to_s)].join('=')
|
320
331
|
else
|
321
332
|
key
|
322
333
|
end
|
@@ -498,7 +509,9 @@ module Fog
|
|
498
509
|
@instrumentor_name = options[:instrumentor_name] || 'fog.aws.storage'
|
499
510
|
@connection_options = options[:connection_options] || {}
|
500
511
|
@persistent = options.fetch(:persistent, false)
|
512
|
+
@acceleration = options.fetch(:acceleration, false)
|
501
513
|
@signature_version = options.fetch(:aws_signature_version, 4)
|
514
|
+
@enable_signature_v4_streaming = options.fetch(:enable_signature_v4_streaming, true)
|
502
515
|
validate_signature_version!
|
503
516
|
@path_style = options[:path_style] || false
|
504
517
|
|
@@ -515,6 +528,7 @@ module Fog
|
|
515
528
|
@port = options[:port] || DEFAULT_SCHEME_PORT[@scheme]
|
516
529
|
end
|
517
530
|
|
531
|
+
@host = ACCELERATION_HOST if @acceleration
|
518
532
|
setup_credentials(options)
|
519
533
|
end
|
520
534
|
|
@@ -579,20 +593,24 @@ module Fog
|
|
579
593
|
if @signature_version == 4
|
580
594
|
params[:headers]['x-amz-date'] = date.to_iso8601_basic
|
581
595
|
if params[:body].respond_to?(:read)
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
596
|
+
if @enable_signature_v4_streaming
|
597
|
+
# See http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-streaming.html
|
598
|
+
# We ignore the bit about setting the content-encoding to aws-chunked because
|
599
|
+
# this can cause s3 to serve files with a blank content encoding which causes problems with some CDNs
|
600
|
+
# AWS have confirmed that s3 can infer that the content-encoding is aws-chunked from the x-amz-content-sha256 header
|
601
|
+
#
|
602
|
+
params[:headers]['x-amz-content-sha256'] = 'STREAMING-AWS4-HMAC-SHA256-PAYLOAD'
|
603
|
+
params[:headers]['x-amz-decoded-content-length'] = params[:headers].delete 'Content-Length'
|
604
|
+
else
|
605
|
+
params[:headers]['x-amz-content-sha256'] = 'UNSIGNED-PAYLOAD'
|
606
|
+
end
|
589
607
|
else
|
590
608
|
params[:headers]['x-amz-content-sha256'] ||= OpenSSL::Digest::SHA256.hexdigest(params[:body] || '')
|
591
609
|
end
|
592
610
|
signature_components = @signer.signature_components(params, date, params[:headers]['x-amz-content-sha256'])
|
593
611
|
params[:headers]['Authorization'] = @signer.components_to_header(signature_components)
|
594
612
|
|
595
|
-
if params[:body].respond_to?(:read)
|
613
|
+
if params[:body].respond_to?(:read) && @enable_signature_v4_streaming
|
596
614
|
body = params.delete :body
|
597
615
|
params[:request_block] = S3Streamer.new(body, signature_components['X-Amz-Signature'], @signer, date)
|
598
616
|
end
|
@@ -763,4 +781,17 @@ DATA
|
|
763
781
|
end
|
764
782
|
end
|
765
783
|
end
|
784
|
+
|
785
|
+
# @deprecated
|
786
|
+
module Storage
|
787
|
+
# @deprecated
|
788
|
+
class AWS < Fog::AWS::Storage
|
789
|
+
# @deprecated
|
790
|
+
# @overrides Fog::Service.new (from the fog-core gem)
|
791
|
+
def self.new(*)
|
792
|
+
Fog::Logger.deprecation 'Fog::Storage::AWS is deprecated, please use Fog::AWS::Storage.'
|
793
|
+
super
|
794
|
+
end
|
795
|
+
end
|
796
|
+
end
|
766
797
|
end
|
data/lib/fog/aws/version.rb
CHANGED
data/tests/credentials_tests.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
Shindo.tests('AWS | credentials', ['aws']) do
|
2
4
|
old_mock_value = Excon.defaults[:mock]
|
3
5
|
fog_was_mocked = Fog.mocking?
|
@@ -5,8 +7,10 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
5
7
|
Fog.unmock!
|
6
8
|
begin
|
7
9
|
Excon.defaults[:mock] = true
|
8
|
-
Excon.stub({:
|
9
|
-
|
10
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 200, body: 'token1234' })
|
11
|
+
|
12
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/' }, { status: 200, body: 'arole' })
|
13
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/placement/availability-zone/' }, { status: 200, body: 'us-west-1a' })
|
10
14
|
|
11
15
|
expires_at = Time.at(Time.now.to_i + 500)
|
12
16
|
credentials = {
|
@@ -16,69 +20,128 @@ Shindo.tests('AWS | credentials', ['aws']) do
|
|
16
20
|
'Expiration' => expires_at.xmlschema
|
17
21
|
}
|
18
22
|
|
19
|
-
Excon.stub({:
|
23
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/arole' }, { status: 200, body: Fog::JSON.encode(credentials) })
|
24
|
+
|
25
|
+
tests('#fetch_credentials') do
|
26
|
+
returns(aws_access_key_id: 'dummykey',
|
27
|
+
aws_secret_access_key: 'dummysecret',
|
28
|
+
aws_session_token: 'dummytoken',
|
29
|
+
region: 'us-west-1',
|
30
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
31
|
+
end
|
32
|
+
|
33
|
+
tests('#fetch_credentials when the v2 token 404s') do
|
34
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 404, body: 'not found' })
|
35
|
+
returns(aws_access_key_id: 'dummykey',
|
36
|
+
aws_secret_access_key: 'dummysecret',
|
37
|
+
aws_session_token: 'dummytoken',
|
38
|
+
region: 'us-west-1',
|
39
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
40
|
+
end
|
41
|
+
|
42
|
+
tests('#fetch_credentials when the v2 disabled') do
|
43
|
+
returns(aws_access_key_id: 'dummykey',
|
44
|
+
aws_secret_access_key: 'dummysecret',
|
45
|
+
aws_session_token: 'dummytoken',
|
46
|
+
region: 'us-west-1',
|
47
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true, disable_imds_v2: true) }
|
48
|
+
end
|
49
|
+
|
50
|
+
ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] = '/v1/credentials?id=task_id'
|
51
|
+
Excon.stub({ method: :get, path: '/v1/credentials?id=task_id' }, { status: 200, body: Fog::JSON.encode(credentials) })
|
20
52
|
|
21
|
-
tests(
|
22
|
-
returns(
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
53
|
+
tests('#fetch_credentials') do
|
54
|
+
returns(aws_access_key_id: 'dummykey',
|
55
|
+
aws_secret_access_key: 'dummysecret',
|
56
|
+
aws_session_token: 'dummytoken',
|
57
|
+
region: 'us-west-1',
|
58
|
+
aws_credentials_expire_at: expires_at) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
27
59
|
end
|
28
60
|
|
29
|
-
ENV[
|
30
|
-
Excon.stub({:method => :get, :path => '/v1/credentials?id=task_id'}, {:status => 200, :body => Fog::JSON.encode(credentials)})
|
61
|
+
ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] = nil
|
31
62
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
63
|
+
ENV['AWS_WEB_IDENTITY_TOKEN_FILE'] = File.dirname(__FILE__) + '/lorem.txt'
|
64
|
+
ENV['AWS_ROLE_ARN'] = "dummyrole"
|
65
|
+
ENV['AWS_ROLE_SESSION_NAME'] = "dummyrolesessionname"
|
66
|
+
document =
|
67
|
+
'<AssumeRoleWithWebIdentityResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">'\
|
68
|
+
'<AssumeRoleWithWebIdentityResult>'\
|
69
|
+
'<Credentials>'\
|
70
|
+
'<SessionToken>dummytoken</SessionToken>'\
|
71
|
+
'<SecretAccessKey>dummysecret</SecretAccessKey>'\
|
72
|
+
"<Expiration>#{expires_at.xmlschema}</Expiration>"\
|
73
|
+
'<AccessKeyId>dummykey</AccessKeyId>'\
|
74
|
+
'</Credentials>'\
|
75
|
+
'</AssumeRoleWithWebIdentityResult>'\
|
76
|
+
'</AssumeRoleWithWebIdentityResponse>'
|
77
|
+
|
78
|
+
Excon.stub({method: :get, path: "/", idempotent: true}, { status: 200, body: document})
|
79
|
+
|
80
|
+
tests('#fetch_credentials token based') do
|
81
|
+
returns(
|
82
|
+
aws_access_key_id: 'dummykey',
|
83
|
+
aws_secret_access_key: 'dummysecret',
|
84
|
+
aws_session_token: 'dummytoken',
|
85
|
+
region: 'us-west-1',
|
86
|
+
aws_credentials_expire_at: expires_at
|
87
|
+
) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
38
88
|
end
|
39
89
|
|
40
|
-
ENV[
|
90
|
+
ENV['AWS_ROLE_SESSION_NAME'] = nil
|
41
91
|
|
42
|
-
|
92
|
+
tests('#fetch_credentials token based without session name') do
|
93
|
+
returns(
|
94
|
+
aws_access_key_id: 'dummykey',
|
95
|
+
aws_secret_access_key: 'dummysecret',
|
96
|
+
aws_session_token: 'dummytoken',
|
97
|
+
region: 'us-west-1',
|
98
|
+
aws_credentials_expire_at: expires_at
|
99
|
+
) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
100
|
+
end
|
43
101
|
|
44
|
-
|
45
|
-
|
102
|
+
ENV['AWS_WEB_IDENTITY_TOKEN_FILE'] = nil
|
103
|
+
|
104
|
+
compute = Fog::AWS::Compute.new(use_iam_profile: true)
|
105
|
+
|
106
|
+
tests('#refresh_credentials_if_expired') do
|
107
|
+
returns(nil) { compute.refresh_credentials_if_expired }
|
46
108
|
end
|
47
109
|
|
48
110
|
credentials['AccessKeyId'] = 'newkey'
|
49
111
|
credentials['SecretAccessKey'] = 'newsecret'
|
50
112
|
credentials['Expiration'] = (expires_at + 10).xmlschema
|
51
113
|
|
52
|
-
Excon.stub({:
|
114
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/arole' }, { status: 200, body: Fog::JSON.encode(credentials) })
|
53
115
|
|
54
116
|
Fog::Time.now = expires_at + 1
|
55
|
-
tests(
|
56
|
-
returns(true){compute.refresh_credentials_if_expired}
|
57
|
-
returns(
|
117
|
+
tests('#refresh_credentials_if_expired') do
|
118
|
+
returns(true) { compute.refresh_credentials_if_expired }
|
119
|
+
returns('newkey') { compute.instance_variable_get(:@aws_access_key_id) }
|
58
120
|
end
|
59
121
|
Fog::Time.now = Time.now
|
60
122
|
|
61
|
-
default_credentials = Fog::Compute
|
62
|
-
tests(
|
63
|
-
Excon.stub({:
|
64
|
-
Excon.stub({:
|
65
|
-
|
123
|
+
default_credentials = Fog::AWS::Compute.fetch_credentials({})
|
124
|
+
tests('#fetch_credentials when the url 404s') do
|
125
|
+
Excon.stub({ method: :put, path: '/latest/api/token' }, { status: 404, body: 'not found' })
|
126
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/iam/security-credentials/' }, { status: 404, body: 'not bound' })
|
127
|
+
Excon.stub({ method: :get, path: '/latest/meta-data/placement/availability-zone/' }, { status: 400, body: 'not found' })
|
128
|
+
returns(default_credentials) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
66
129
|
end
|
67
130
|
|
68
131
|
mocked_credentials = {
|
69
|
-
:
|
70
|
-
:
|
71
|
-
:
|
72
|
-
:
|
132
|
+
aws_access_key_id: 'access-key-id',
|
133
|
+
aws_secret_access_key: 'secret-access-key',
|
134
|
+
aws_session_token: 'session-token',
|
135
|
+
aws_credentials_expire_at: Time.at(Time.now.to_i + 500).xmlschema
|
73
136
|
}
|
74
|
-
tests(
|
137
|
+
tests('#fetch_credentials when mocking') do
|
75
138
|
Fog.mock!
|
76
|
-
Fog::Compute::
|
77
|
-
returns(mocked_credentials) {Fog::Compute
|
139
|
+
Fog::AWS::Compute::Mock.data[:iam_role_based_creds] = mocked_credentials
|
140
|
+
returns(mocked_credentials) { Fog::AWS::Compute.fetch_credentials(use_iam_profile: true) }
|
78
141
|
end
|
79
|
-
|
80
142
|
ensure
|
81
|
-
ENV[
|
143
|
+
ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] = nil
|
144
|
+
ENV['AWS_WEB_IDENTITY_TOKEN_FILE'] = nil
|
82
145
|
Excon.stubs.clear
|
83
146
|
Excon.defaults[:mock] = old_mock_value
|
84
147
|
Fog.mock! if fog_was_mocked
|
data/tests/helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
begin
|
2
2
|
require 'simplecov'
|
3
3
|
SimpleCov.start
|
4
|
-
SimpleCov.command_name
|
4
|
+
SimpleCov.command_name 'Shindo'
|
5
5
|
rescue LoadError => e
|
6
6
|
$stderr.puts "not recording test coverage: #{e.inspect}"
|
7
7
|
end
|
@@ -10,7 +10,7 @@ require File.expand_path('../../lib/fog/aws', __FILE__)
|
|
10
10
|
|
11
11
|
Bundler.require(:test)
|
12
12
|
|
13
|
-
Excon.defaults.merge!(:
|
13
|
+
Excon.defaults.merge!(debug_request: true, debug_response: true)
|
14
14
|
|
15
15
|
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'mock_helper'))
|
16
16
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
def collection_tests(collection, params = {}, mocks_implemented = true)
|
2
2
|
tests('success') do
|
3
|
-
|
4
3
|
tests("#new(#{params.inspect})").succeeds do
|
5
4
|
pending if Fog.mocking? && !mocks_implemented
|
6
5
|
collection.new(params)
|
@@ -34,7 +33,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
34
33
|
pending if Fog.mocking? && !mocks_implemented
|
35
34
|
|
36
35
|
methods = [
|
37
|
-
'all?', 'any?', 'find',
|
36
|
+
'all?', 'any?', 'find', 'detect', 'collect', 'map',
|
38
37
|
'find_index', 'flat_map', 'collect_concat', 'group_by',
|
39
38
|
'none?', 'one?'
|
40
39
|
]
|
@@ -43,7 +42,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
43
42
|
if collection.respond_to?(enum_method)
|
44
43
|
tests("##{enum_method}").succeeds do
|
45
44
|
block_called = false
|
46
|
-
collection.send(enum_method) {
|
45
|
+
collection.send(enum_method) { block_called = true }
|
47
46
|
block_called
|
48
47
|
end
|
49
48
|
end
|
@@ -55,7 +54,7 @@ def collection_tests(collection, params = {}, mocks_implemented = true)
|
|
55
54
|
if collection.respond_to?(enum_method)
|
56
55
|
tests("##{enum_method}").succeeds do
|
57
56
|
block_called = false
|
58
|
-
collection.send(enum_method) {
|
57
|
+
collection.send(enum_method) { block_called = true; 0 }
|
59
58
|
block_called
|
60
59
|
end
|
61
60
|
end
|