lib/aws-sdk-ec2/resource.rb in aws-sdk-ec2-1.380.0 vs lib/aws-sdk-ec2/resource.rb in aws-sdk-ec2-1.381.0

- old
+ new

@@ -67,11 +67,13 @@ # without actually making the request, and provides an error response. # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [DhcpOptions] def create_dhcp_options(options = {}) - resp = @client.create_dhcp_options(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_dhcp_options(options) + end DhcpOptions.new( id: resp.data.dhcp_options.dhcp_options_id, data: resp.data.dhcp_options, client: @client ) @@ -599,11 +601,13 @@ # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection # @return [Instance::Collection] def create_instances(options = {}) batch = [] - resp = @client.run_instances(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.run_instances(options) + end resp.data.instances.each do |i| batch << Instance.new( id: i.instance_id, data: i, client: @client @@ -636,11 +640,13 @@ # without actually making the request, and provides an error response. # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [InternetGateway] def create_internet_gateway(options = {}) - resp = @client.create_internet_gateway(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_internet_gateway(options) + end InternetGateway.new( id: resp.data.internet_gateway.internet_gateway_id, data: resp.data.internet_gateway, client: @client ) @@ -686,11 +692,13 @@ # The format of the key pair. # # Default: `pem` # @return [KeyPair] def create_key_pair(options = {}) - resp = @client.create_key_pair(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_key_pair(options) + end KeyPair.new( name: resp.data.key_name, data: resp.data, client: @client ) @@ -778,11 +786,13 @@ # # # [1]: https://docs.aws.amazon.com/vpc/latest/userguide/vpc-nat-gateway.html#nat-gateway-creating # @return [NatGateway] def create_nat_gateway(options = {}) - resp = @client.create_nat_gateway(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_nat_gateway(options) + end NatGateway.new( id: resp.data.nat_gateway.nat_gateway_id, data: resp.data.nat_gateway, client: @client ) @@ -815,11 +825,13 @@ # The ID of the VPC. # @option options [Array<Types::TagSpecification>] :tag_specifications # The tags to assign to the network ACL. # @return [NetworkAcl] def create_network_acl(options = {}) - resp = @client.create_network_acl(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_network_acl(options) + end NetworkAcl.new( id: resp.data.network_acl.network_acl_id, data: resp.data.network_acl, client: @client ) @@ -963,11 +975,13 @@ # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html # @return [NetworkInterface] def create_network_interface(options = {}) - resp = @client.create_network_interface(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_network_interface(options) + end NetworkInterface.new( id: resp.data.network_interface.network_interface_id, data: resp.data.network_interface, client: @client ) @@ -1017,11 +1031,13 @@ # * Host – You can use `host` only with Outpost placement groups. # # * Rack – No usage restrictions. # @return [PlacementGroup] def create_placement_group(options = {}) - @client.create_placement_group(options) + Aws::Plugins::UserAgent.feature('resource') do + @client.create_placement_group(options) + end PlacementGroup.new( name: options[:group_name], client: @client ) end @@ -1053,11 +1069,13 @@ # The ID of the VPC. # @option options [Array<Types::TagSpecification>] :tag_specifications # The tags to assign to the route table. # @return [RouteTable] def create_route_table(options = {}) - resp = @client.create_route_table(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_route_table(options) + end RouteTable.new( id: resp.data.route_table.route_table_id, data: resp.data.route_table, client: @client ) @@ -1110,11 +1128,13 @@ # without actually making the request, and provides an error response. # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [SecurityGroup] def create_security_group(options = {}) - resp = @client.create_security_group(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_security_group(options) + end SecurityGroup.new( id: resp.data.group_id, client: @client ) end @@ -1171,11 +1191,13 @@ # without actually making the request, and provides an error response. # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Snapshot] def create_snapshot(options = {}) - resp = @client.create_snapshot(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_snapshot(options) + end Snapshot.new( id: resp.data.snapshot_id, data: resp.data, client: @client ) @@ -1252,11 +1274,13 @@ # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @option options [Boolean] :ipv_6_native # Indicates whether to create an IPv6 only subnet. # @return [Subnet] def create_subnet(options = {}) - resp = @client.create_subnet(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_subnet(options) + end Subnet.new( id: resp.data.subnet.subnet_id, data: resp.data.subnet, client: @client ) @@ -1289,11 +1313,13 @@ # The tags. The `value` parameter is required, but if you don't want # the tag to have a value, specify the parameter with no value, and we # set the value to an empty string. # @return [EmptyStructure] def create_tags(options = {}) - resp = @client.create_tags(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_tags(options) + end resp.data end # @example Request syntax with placeholder values # @@ -1330,11 +1356,13 @@ # tags (tags that have the `aws:` prefix). # # Constraints: Up to 1000 tags. # @return [EmptyStructure] def delete_tags(options = {}) - resp = @client.delete_tags(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.delete_tags(options) + end resp.data end # @example Request syntax with placeholder values # @@ -1507,11 +1535,13 @@ # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html # @return [Volume] def create_volume(options = {}) - resp = @client.create_volume(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_volume(options) + end Volume.new( id: resp.data.volume_id, data: resp.data, client: @client ) @@ -1624,11 +1654,13 @@ # parameter. # @option options [Array<Types::TagSpecification>] :tag_specifications # The tags to assign to the VPC. # @return [Vpc] def create_vpc(options = {}) - resp = @client.create_vpc(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_vpc(options) + end Vpc.new( id: resp.data.vpc.vpc_id, data: resp.data.vpc, client: @client ) @@ -1677,11 +1709,13 @@ # Default: The Region in which you make the request. # @option options [Array<Types::TagSpecification>] :tag_specifications # The tags to assign to the peering connection. # @return [VpcPeeringConnection] def create_vpc_peering_connection(options = {}) - resp = @client.create_vpc_peering_connection(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.create_vpc_peering_connection(options) + end VpcPeeringConnection.new( id: resp.data.vpc_peering_connection.vpc_peering_connection_id, data: resp.data.vpc_peering_connection, client: @client ) @@ -1702,11 +1736,13 @@ # without actually making the request, and provides an error response. # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [EmptyStructure] def disassociate_route_table(options = {}) - resp = @client.disassociate_route_table(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.disassociate_route_table(options) + end resp.data end # @example Request syntax with placeholder values # @@ -1739,11 +1775,13 @@ # command line tools, base64 encoding is performed for you. # @option options [Array<Types::TagSpecification>] :tag_specifications # The tags to apply to the imported key pair. # @return [KeyPairInfo] def import_key_pair(options = {}) - resp = @client.import_key_pair(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.import_key_pair(options) + end KeyPairInfo.new( name: resp.data.key_name, client: @client ) end @@ -1919,11 +1957,13 @@ # # # [1]: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/configuring-IMDS-new-instances.html#configure-IMDS-new-instances-ami-configuration # @return [Image] def register_image(options = {}) - resp = @client.register_image(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.register_image(options) + end Image.new( id: resp.data.image_id, client: @client ) end @@ -1998,11 +2038,13 @@ batch = [] options = Aws::Util.deep_merge(options, filters: [{ name: "domain", values: ["standard"] }]) - resp = @client.describe_addresses(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_addresses(options) + end resp.data.addresses.each do |a| batch << ClassicAddress.new( public_ip: a.public_ip, data: a, client: @client @@ -2066,11 +2108,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [DhcpOptions::Collection] def dhcp_options_sets(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_dhcp_options(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_dhcp_options(options) + end resp.each_page do |page| batch = [] page.data.dhcp_options.each do |d| batch << DhcpOptions.new( id: d.dhcp_options_id, @@ -2247,11 +2291,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Image::Collection] def images(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_images(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_images(options) + end resp.each_page do |page| batch = [] page.data.images.each do |i| batch << Image.new( id: i.image_id, @@ -2577,11 +2623,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Instance::Collection] def instances(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_instances(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_instances(options) + end resp.each_page do |page| batch = [] page.data.reservations.each do |r| r.instances.each do |i| batch << Instance.new( @@ -2652,11 +2700,13 @@ # # Default: Describes all your internet gateways. # @return [InternetGateway::Collection] def internet_gateways(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_internet_gateways(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_internet_gateways(options) + end resp.each_page do |page| batch = [] page.data.internet_gateways.each do |i| batch << InternetGateway.new( id: i.internet_gateway_id, @@ -2729,11 +2779,13 @@ # Default: `false` # @return [KeyPairInfo::Collection] def key_pairs(options = {}) batches = Enumerator.new do |y| batch = [] - resp = @client.describe_key_pairs(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_key_pairs(options) + end resp.data.key_pairs.each do |k| batch << KeyPairInfo.new( name: k.key_name, data: k, client: @client @@ -2795,11 +2847,13 @@ # @option options [Array<String>] :nat_gateway_ids # One or more NAT gateway IDs. # @return [NatGateway::Collection] def nat_gateways(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_nat_gateways(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_nat_gateways(options) + end resp.each_page do |page| batch = [] page.data.nat_gateways.each do |n| batch << NatGateway.new( id: n.nat_gateway_id, @@ -2902,11 +2956,13 @@ # # Default: Describes all your network ACLs. # @return [NetworkAcl::Collection] def network_acls(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_network_acls(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_network_acls(options) + end resp.each_page do |page| batch = [] page.data.network_acls.each do |n| batch << NetworkAcl.new( id: n.network_acl_id, @@ -3069,11 +3125,13 @@ # # Default: Describes all your network interfaces. # @return [NetworkInterface::Collection] def network_interfaces(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_network_interfaces(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_network_interfaces(options) + end resp.each_page do |page| batch = [] page.data.network_interfaces.each do |n| batch << NetworkInterface.new( id: n.network_interface_id, @@ -3149,11 +3207,13 @@ # The IDs of the placement groups. # @return [PlacementGroup::Collection] def placement_groups(options = {}) batches = Enumerator.new do |y| batch = [] - resp = @client.describe_placement_groups(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_placement_groups(options) + end resp.data.placement_groups.each do |p| batch << PlacementGroup.new( name: p.group_name, data: p, client: @client @@ -3275,11 +3335,13 @@ # # Default: Describes all your route tables. # @return [RouteTable::Collection] def route_tables(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_route_tables(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_route_tables(options) + end resp.each_page do |page| batch = [] page.data.route_tables.each do |r| batch << RouteTable.new( id: r.route_table_id, @@ -3416,11 +3478,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [SecurityGroup::Collection] def security_groups(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_security_groups(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_security_groups(options) + end resp.each_page do |page| batch = [] page.data.security_groups.each do |s| batch << SecurityGroup.new( id: s.group_id, @@ -3518,11 +3582,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Snapshot::Collection] def snapshots(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_snapshots(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_snapshots(options) + end resp.each_page do |page| batch = [] page.data.snapshots.each do |s| batch << Snapshot.new( id: s.snapshot_id, @@ -3657,11 +3723,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Subnet::Collection] def subnets(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_subnets(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_subnets(options) + end resp.each_page do |page| batch = [] page.data.subnets.each do |s| batch << Subnet.new( id: s.subnet_id, @@ -3759,11 +3827,13 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Volume::Collection] def volumes(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_volumes(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_volumes(options) + end resp.each_page do |page| batch = [] page.data.volumes.each do |v| batch << Volume.new( id: v.volume_id, @@ -3854,11 +3924,13 @@ batch = [] options = Aws::Util.deep_merge(options, filters: [{ name: "domain", values: ["vpc"] }]) - resp = @client.describe_addresses(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_addresses(options) + end resp.data.addresses.each do |a| batch << VpcAddress.new( allocation_id: a.allocation_id, data: a, client: @client @@ -3941,11 +4013,13 @@ # # Default: Describes all your VPC peering connections. # @return [VpcPeeringConnection::Collection] def vpc_peering_connections(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_vpc_peering_connections(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_vpc_peering_connections(options) + end resp.each_page do |page| batch = [] page.data.vpc_peering_connections.each do |v| batch << VpcPeeringConnection.new( id: v.vpc_peering_connection_id, @@ -4031,10 +4105,12 @@ # If you have the required permissions, the error response is # `DryRunOperation`. Otherwise, it is `UnauthorizedOperation`. # @return [Vpc::Collection] def vpcs(options = {}) batches = Enumerator.new do |y| - resp = @client.describe_vpcs(options) + resp = Aws::Plugins::UserAgent.feature('resource') do + @client.describe_vpcs(options) + end resp.each_page do |page| batch = [] page.data.vpcs.each do |v| batch << Vpc.new( id: v.vpc_id,