Class: Aws::EC2::Resource
- Inherits:
-
Object
- Object
- Aws::EC2::Resource
- Defined in:
- gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb,
gems/aws-sdk-ec2/lib/aws-sdk-ec2/customizations/resource.rb
Overview
This class provides a resource oriented interface for EC2. To create a resource object:
resource = Aws::EC2::Resource.new(region: 'us-west-2')
You can supply a client object with custom configuration that will be used for all resource operations.
If you do not pass :client
, a default client will be constructed.
client = Aws::EC2::Client.new(region: 'us-west-2')
resource = Aws::EC2::Resource.new(client: client)
Actions collapse
-
#create_dhcp_options(options = {}) ⇒ DhcpOptions
-
#create_instances(options = {}) ⇒ Instance::Collection
-
#create_internet_gateway(options = {}) ⇒ InternetGateway
-
#create_key_pair(options = {}) ⇒ KeyPair
-
#create_nat_gateway(options = {}) ⇒ NatGateway
-
#create_network_acl(options = {}) ⇒ NetworkAcl
-
#create_network_interface(options = {}) ⇒ NetworkInterface
-
#create_placement_group(options = {}) ⇒ PlacementGroup
-
#create_route_table(options = {}) ⇒ RouteTable
-
#create_security_group(options = {}) ⇒ SecurityGroup
-
#create_snapshot(options = {}) ⇒ Snapshot
-
#create_subnet(options = {}) ⇒ Subnet
-
#create_tags(options) ⇒ EmptyStructure
-
#create_volume(options = {}) ⇒ Volume
-
#create_vpc(options = {}) ⇒ Vpc
-
#create_vpc_peering_connection(options = {}) ⇒ VpcPeeringConnection
-
#delete_tags(options = {}) ⇒ EmptyStructure
-
#disassociate_route_table(options = {}) ⇒ EmptyStructure
-
#import_key_pair(options = {}) ⇒ KeyPairInfo
-
#register_image(options = {}) ⇒ Image
Associations collapse
-
#classic_addresses(options = {}) ⇒ ClassicAddress::Collection
-
#dhcp_options(id) ⇒ DhcpOptions
-
#dhcp_options_sets(options = {}) ⇒ DhcpOptions::Collection
-
#image(id) ⇒ Image
-
#images(options = {}) ⇒ Image::Collection
-
#instance(id) ⇒ Instance
-
#instances(options = {}) ⇒ Instance::Collection
-
#internet_gateway(id) ⇒ InternetGateway
-
#internet_gateways(options = {}) ⇒ InternetGateway::Collection
-
#key_pair(name) ⇒ KeyPairInfo
-
#key_pairs(options = {}) ⇒ KeyPairInfo::Collection
-
#nat_gateway(id) ⇒ NatGateway
-
#nat_gateways(options = {}) ⇒ NatGateway::Collection
-
#network_acl(id) ⇒ NetworkAcl
-
#network_acls(options = {}) ⇒ NetworkAcl::Collection
-
#network_interface(id) ⇒ NetworkInterface
-
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
-
#placement_group(name) ⇒ PlacementGroup
-
#placement_groups(options = {}) ⇒ PlacementGroup::Collection
-
#route_table(id) ⇒ RouteTable
-
#route_table_association(id) ⇒ RouteTableAssociation
-
#route_tables(options = {}) ⇒ RouteTable::Collection
-
#security_group(id) ⇒ SecurityGroup
-
#security_groups(options = {}) ⇒ SecurityGroup::Collection
-
#snapshot(id) ⇒ Snapshot
-
#snapshots(options = {}) ⇒ Snapshot::Collection
-
#subnet(id) ⇒ Subnet
-
#subnets(options = {}) ⇒ Subnet::Collection
-
#volume(id) ⇒ Volume
-
#volumes(options = {}) ⇒ Volume::Collection
-
#vpc(id) ⇒ Vpc
-
#vpc_addresses(options = {}) ⇒ VpcAddress::Collection
-
#vpc_peering_connection(id) ⇒ VpcPeeringConnection
-
#vpc_peering_connections(options = {}) ⇒ VpcPeeringConnection::Collection
-
#vpcs(options = {}) ⇒ Vpc::Collection
Instance Method Summary collapse
-
#client ⇒ Client
-
#initialize(options = {}) ⇒ Resource
constructor
A new instance of Resource.
Constructor Details
Instance Method Details
#classic_addresses(options = {}) ⇒ ClassicAddress::Collection
1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1946 def classic_addresses( = {}) batches = Enumerator.new do |y| batch = [] = Aws::Util.deep_merge(, filters: [{ name: "domain", values: ["standard"] }]) resp = @client.describe_addresses() resp.data.addresses.each do |a| batch << ClassicAddress.new( public_ip: a.public_ip, data: a, client: @client ) end y.yield(batch) end ClassicAddress::Collection.new(batches) end |
#client ⇒ Client
32 33 34 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 32 def client @client end |
#create_dhcp_options(options = {}) ⇒ DhcpOptions
71 72 73 74 75 76 77 78 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 71 def ( = {}) resp = @client.() DhcpOptions.new( id: resp.data.., data: resp.data., client: @client ) end |
#create_instances(options = {}) ⇒ Instance::Collection
591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 591 def create_instances( = {}) batch = [] resp = @client.run_instances() resp.data.instances.each do |i| batch << Instance.new( id: i.instance_id, data: i, client: @client ) end Instance::Collection.new([batch], size: batch.size) end |
#create_internet_gateway(options = {}) ⇒ InternetGateway
629 630 631 632 633 634 635 636 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 629 def create_internet_gateway( = {}) resp = @client.create_internet_gateway() InternetGateway.new( id: resp.data.internet_gateway.internet_gateway_id, data: resp.data.internet_gateway, client: @client ) end |
#create_key_pair(options = {}) ⇒ KeyPair
679 680 681 682 683 684 685 686 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 679 def create_key_pair( = {}) resp = @client.create_key_pair() KeyPair.new( name: resp.data.key_name, data: resp.data, client: @client ) end |
#create_nat_gateway(options = {}) ⇒ NatGateway
743 744 745 746 747 748 749 750 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 743 def create_nat_gateway( = {}) resp = @client.create_nat_gateway() NatGateway.new( id: resp.data.nat_gateway.nat_gateway_id, data: resp.data.nat_gateway, client: @client ) end |
#create_network_acl(options = {}) ⇒ NetworkAcl
780 781 782 783 784 785 786 787 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 780 def create_network_acl( = {}) resp = @client.create_network_acl() NetworkAcl.new( id: resp.data.network_acl.network_acl_id, data: resp.data.network_acl, client: @client ) end |
#create_network_interface(options = {}) ⇒ NetworkInterface
928 929 930 931 932 933 934 935 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 928 def create_network_interface( = {}) resp = @client.create_network_interface() NetworkInterface.new( id: resp.data.network_interface.network_interface_id, data: resp.data.network_interface, client: @client ) end |
#create_placement_group(options = {}) ⇒ PlacementGroup
982 983 984 985 986 987 988 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 982 def create_placement_group( = {}) @client.create_placement_group() PlacementGroup.new( name: [:group_name], client: @client ) end |
#create_route_table(options = {}) ⇒ RouteTable
1018 1019 1020 1021 1022 1023 1024 1025 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1018 def create_route_table( = {}) resp = @client.create_route_table() RouteTable.new( id: resp.data.route_table.route_table_id, data: resp.data.route_table, client: @client ) end |
#create_security_group(options = {}) ⇒ SecurityGroup
1075 1076 1077 1078 1079 1080 1081 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1075 def create_security_group( = {}) resp = @client.create_security_group() SecurityGroup.new( id: resp.data.group_id, client: @client ) end |
#create_snapshot(options = {}) ⇒ Snapshot
1136 1137 1138 1139 1140 1141 1142 1143 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1136 def create_snapshot( = {}) resp = @client.create_snapshot() Snapshot.new( id: resp.data.snapshot_id, data: resp.data, client: @client ) end |
#create_subnet(options = {}) ⇒ Subnet
1217 1218 1219 1220 1221 1222 1223 1224 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1217 def create_subnet( = {}) resp = @client.create_subnet() Subnet.new( id: resp.data.subnet.subnet_id, data: resp.data.subnet, client: @client ) end |
#create_tags(options) ⇒ EmptyStructure
1254 1255 1256 1257 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1254 def ( = {}) resp = @client.() resp.data end |
#create_volume(options = {}) ⇒ Volume
1469 1470 1471 1472 1473 1474 1475 1476 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1469 def create_volume( = {}) resp = @client.create_volume() Volume.new( id: resp.data.volume_id, data: resp.data, client: @client ) end |
#create_vpc(options = {}) ⇒ Vpc
1586 1587 1588 1589 1590 1591 1592 1593 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1586 def create_vpc( = {}) resp = @client.create_vpc() Vpc.new( id: resp.data.vpc.vpc_id, data: resp.data.vpc, client: @client ) end |
#create_vpc_peering_connection(options = {}) ⇒ VpcPeeringConnection
1639 1640 1641 1642 1643 1644 1645 1646 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1639 def create_vpc_peering_connection( = {}) resp = @client.create_vpc_peering_connection() VpcPeeringConnection.new( id: resp.data.vpc_peering_connection.vpc_peering_connection_id, data: resp.data.vpc_peering_connection, client: @client ) end |
#delete_tags(options = {}) ⇒ EmptyStructure
1295 1296 1297 1298 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1295 def ( = {}) resp = @client.() resp.data end |
#dhcp_options(id) ⇒ DhcpOptions
1968 1969 1970 1971 1972 1973 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1968 def (id) DhcpOptions.new( id: id, client: @client ) end |
#dhcp_options_sets(options = {}) ⇒ DhcpOptions::Collection
2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2019 def ( = {}) batches = Enumerator.new do |y| resp = @client.() resp.each_page do |page| batch = [] page.data..each do |d| batch << DhcpOptions.new( id: d., data: d, client: @client ) end y.yield(batch) end end DhcpOptions::Collection.new(batches) end |
#disassociate_route_table(options = {}) ⇒ EmptyStructure
1664 1665 1666 1667 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1664 def disassociate_route_table( = {}) resp = @client.disassociate_route_table() resp.data end |
#image(id) ⇒ Image
2039 2040 2041 2042 2043 2044 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2039 def image(id) Image.new( id: id, client: @client ) end |
#images(options = {}) ⇒ Image::Collection
2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2200 def images( = {}) batches = Enumerator.new do |y| resp = @client.describe_images() resp.each_page do |page| batch = [] page.data.images.each do |i| batch << Image.new( id: i.image_id, data: i, client: @client ) end y.yield(batch) end end Image::Collection.new(batches) end |
#import_key_pair(options = {}) ⇒ KeyPairInfo
1701 1702 1703 1704 1705 1706 1707 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1701 def import_key_pair( = {}) resp = @client.import_key_pair() KeyPairInfo.new( name: resp.data.key_name, client: @client ) end |
#instance(id) ⇒ Instance
2220 2221 2222 2223 2224 2225 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2220 def instance(id) Instance.new( id: id, client: @client ) end |
#instances(options = {}) ⇒ Instance::Collection
2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2536 def instances( = {}) batches = Enumerator.new do |y| resp = @client.describe_instances() resp.each_page do |page| batch = [] page.data.reservations.each do |r| r.instances.each do |i| batch << Instance.new( id: i.instance_id, data: i, client: @client ) end end y.yield(batch) end end Instance::Collection.new(batches) end |
#internet_gateway(id) ⇒ InternetGateway
2558 2559 2560 2561 2562 2563 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2558 def internet_gateway(id) InternetGateway.new( id: id, client: @client ) end |
#internet_gateways(options = {}) ⇒ InternetGateway::Collection
2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2611 def internet_gateways( = {}) batches = Enumerator.new do |y| resp = @client.describe_internet_gateways() resp.each_page do |page| batch = [] page.data.internet_gateways.each do |i| batch << InternetGateway.new( id: i.internet_gateway_id, data: i, client: @client ) end y.yield(batch) end end InternetGateway::Collection.new(batches) end |
#key_pair(name) ⇒ KeyPairInfo
2631 2632 2633 2634 2635 2636 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2631 def key_pair(name) KeyPairInfo.new( name: name, client: @client ) end |
#key_pairs(options = {}) ⇒ KeyPairInfo::Collection
2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2687 def key_pairs( = {}) batches = Enumerator.new do |y| batch = [] resp = @client.describe_key_pairs() resp.data.key_pairs.each do |k| batch << KeyPairInfo.new( name: k.key_name, data: k, client: @client ) end y.yield(batch) end KeyPairInfo::Collection.new(batches) end |
#nat_gateway(id) ⇒ NatGateway
2705 2706 2707 2708 2709 2710 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2705 def nat_gateway(id) NatGateway.new( id: id, client: @client ) end |
#nat_gateways(options = {}) ⇒ NatGateway::Collection
2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2754 def nat_gateways( = {}) batches = Enumerator.new do |y| resp = @client.describe_nat_gateways() resp.each_page do |page| batch = [] page.data.nat_gateways.each do |n| batch << NatGateway.new( id: n.nat_gateway_id, data: n, client: @client ) end y.yield(batch) end end NatGateway::Collection.new(batches) end |
#network_acl(id) ⇒ NetworkAcl
2774 2775 2776 2777 2778 2779 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2774 def network_acl(id) NetworkAcl.new( id: id, client: @client ) end |
#network_acls(options = {}) ⇒ NetworkAcl::Collection
2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2861 def network_acls( = {}) batches = Enumerator.new do |y| resp = @client.describe_network_acls() resp.each_page do |page| batch = [] page.data.network_acls.each do |n| batch << NetworkAcl.new( id: n.network_acl_id, data: n, client: @client ) end y.yield(batch) end end NetworkAcl::Collection.new(batches) end |
#network_interface(id) ⇒ NetworkInterface
2881 2882 2883 2884 2885 2886 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2881 def network_interface(id) NetworkInterface.new( id: id, client: @client ) end |
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3028 def network_interfaces( = {}) batches = Enumerator.new do |y| resp = @client.describe_network_interfaces() resp.each_page do |page| batch = [] page.data.network_interfaces.each do |n| batch << NetworkInterface.new( id: n.network_interface_id, data: n, client: @client ) end y.yield(batch) end end NetworkInterface::Collection.new(batches) end |
#placement_group(name) ⇒ PlacementGroup
3048 3049 3050 3051 3052 3053 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3048 def placement_group(name) PlacementGroup.new( name: name, client: @client ) end |
#placement_groups(options = {}) ⇒ PlacementGroup::Collection
3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3107 def placement_groups( = {}) batches = Enumerator.new do |y| batch = [] resp = @client.describe_placement_groups() resp.data.placement_groups.each do |p| batch << PlacementGroup.new( name: p.group_name, data: p, client: @client ) end y.yield(batch) end PlacementGroup::Collection.new(batches) end |
#register_image(options = {}) ⇒ Image
1873 1874 1875 1876 1877 1878 1879 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1873 def register_image( = {}) resp = @client.register_image() Image.new( id: resp.data.image_id, client: @client ) end |
#route_table(id) ⇒ RouteTable
3125 3126 3127 3128 3129 3130 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3125 def route_table(id) RouteTable.new( id: id, client: @client ) end |
#route_table_association(id) ⇒ RouteTableAssociation
3134 3135 3136 3137 3138 3139 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3134 def route_table_association(id) RouteTableAssociation.new( id: id, client: @client ) end |
#route_tables(options = {}) ⇒ RouteTable::Collection
3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3234 def route_tables( = {}) batches = Enumerator.new do |y| resp = @client.describe_route_tables() resp.each_page do |page| batch = [] page.data.route_tables.each do |r| batch << RouteTable.new( id: r.route_table_id, data: r, client: @client ) end y.yield(batch) end end RouteTable::Collection.new(batches) end |
#security_group(id) ⇒ SecurityGroup
3254 3255 3256 3257 3258 3259 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3254 def security_group(id) SecurityGroup.new( id: id, client: @client ) end |
#security_groups(options = {}) ⇒ SecurityGroup::Collection
3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3375 def security_groups( = {}) batches = Enumerator.new do |y| resp = @client.describe_security_groups() resp.each_page do |page| batch = [] page.data.security_groups.each do |s| batch << SecurityGroup.new( id: s.group_id, data: s, client: @client ) end y.yield(batch) end end SecurityGroup::Collection.new(batches) end |
#snapshot(id) ⇒ Snapshot
3395 3396 3397 3398 3399 3400 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3395 def snapshot(id) Snapshot.new( id: id, client: @client ) end |
#snapshots(options = {}) ⇒ Snapshot::Collection
3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3477 def snapshots( = {}) batches = Enumerator.new do |y| resp = @client.describe_snapshots() resp.each_page do |page| batch = [] page.data.snapshots.each do |s| batch << Snapshot.new( id: s.snapshot_id, data: s, client: @client ) end y.yield(batch) end end Snapshot::Collection.new(batches) end |
#subnet(id) ⇒ Subnet
3497 3498 3499 3500 3501 3502 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3497 def subnet(id) Subnet.new( id: id, client: @client ) end |
#subnets(options = {}) ⇒ Subnet::Collection
3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3616 def subnets( = {}) batches = Enumerator.new do |y| resp = @client.describe_subnets() resp.each_page do |page| batch = [] page.data.subnets.each do |s| batch << Subnet.new( id: s.subnet_id, data: s, client: @client ) end y.yield(batch) end end Subnet::Collection.new(batches) end |
#volume(id) ⇒ Volume
3636 3637 3638 3639 3640 3641 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3636 def volume(id) Volume.new( id: id, client: @client ) end |
#volumes(options = {}) ⇒ Volume::Collection
3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3718 def volumes( = {}) batches = Enumerator.new do |y| resp = @client.describe_volumes() resp.each_page do |page| batch = [] page.data.volumes.each do |v| batch << Volume.new( id: v.volume_id, data: v, client: @client ) end y.yield(batch) end end Volume::Collection.new(batches) end |
#vpc(id) ⇒ Vpc
3738 3739 3740 3741 3742 3743 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3738 def vpc(id) Vpc.new( id: id, client: @client ) end |
#vpc_addresses(options = {}) ⇒ VpcAddress::Collection
3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3808 def vpc_addresses( = {}) batches = Enumerator.new do |y| batch = [] = Aws::Util.deep_merge(, filters: [{ name: "domain", values: ["vpc"] }]) resp = @client.describe_addresses() resp.data.addresses.each do |a| batch << VpcAddress.new( allocation_id: a.allocation_id, data: a, client: @client ) end y.yield(batch) end VpcAddress::Collection.new(batches) end |
#vpc_peering_connection(id) ⇒ VpcPeeringConnection
3830 3831 3832 3833 3834 3835 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3830 def vpc_peering_connection(id) VpcPeeringConnection.new( id: id, client: @client ) end |
#vpc_peering_connections(options = {}) ⇒ VpcPeeringConnection::Collection
3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3900 def vpc_peering_connections( = {}) batches = Enumerator.new do |y| resp = @client.describe_vpc_peering_connections() resp.each_page do |page| batch = [] page.data.vpc_peering_connections.each do |v| batch << VpcPeeringConnection.new( id: v.vpc_peering_connection_id, data: v, client: @client ) end y.yield(batch) end end VpcPeeringConnection::Collection.new(batches) end |
#vpcs(options = {}) ⇒ Vpc::Collection
3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3990 def vpcs( = {}) batches = Enumerator.new do |y| resp = @client.describe_vpcs() resp.each_page do |page| batch = [] page.data.vpcs.each do |v| batch << Vpc.new( id: v.vpc_id, data: v, client: @client ) end y.yield(batch) end end Vpc::Collection.new(batches) end |