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
1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1872 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
578 579 580 581 582 583 584 585 586 587 588 589 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 578 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
616 617 618 619 620 621 622 623 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 616 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
666 667 668 669 670 671 672 673 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 666 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
725 726 727 728 729 730 731 732 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 725 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
762 763 764 765 766 767 768 769 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 762 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
892 893 894 895 896 897 898 899 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 892 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
946 947 948 949 950 951 952 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 946 def create_placement_group( = {}) @client.create_placement_group() PlacementGroup.new( name: [:group_name], client: @client ) end |
#create_route_table(options = {}) ⇒ RouteTable
982 983 984 985 986 987 988 989 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 982 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
1039 1040 1041 1042 1043 1044 1045 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1039 def create_security_group( = {}) resp = @client.create_security_group() SecurityGroup.new( id: resp.data.group_id, client: @client ) end |
#create_snapshot(options = {}) ⇒ Snapshot
1100 1101 1102 1103 1104 1105 1106 1107 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1100 def create_snapshot( = {}) resp = @client.create_snapshot() Snapshot.new( id: resp.data.snapshot_id, data: resp.data, client: @client ) end |
#create_subnet(options = {}) ⇒ Subnet
1181 1182 1183 1184 1185 1186 1187 1188 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1181 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
1218 1219 1220 1221 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1218 def ( = {}) resp = @client.() resp.data end |
#create_volume(options = {}) ⇒ Volume
1433 1434 1435 1436 1437 1438 1439 1440 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1433 def create_volume( = {}) resp = @client.create_volume() Volume.new( id: resp.data.volume_id, data: resp.data, client: @client ) end |
#create_vpc(options = {}) ⇒ Vpc
1538 1539 1540 1541 1542 1543 1544 1545 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1538 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
1591 1592 1593 1594 1595 1596 1597 1598 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1591 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
1259 1260 1261 1262 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1259 def ( = {}) resp = @client.() resp.data end |
#dhcp_options(id) ⇒ DhcpOptions
1894 1895 1896 1897 1898 1899 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1894 def (id) DhcpOptions.new( id: id, client: @client ) end |
#dhcp_options_sets(options = {}) ⇒ DhcpOptions::Collection
1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1945 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
1616 1617 1618 1619 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1616 def disassociate_route_table( = {}) resp = @client.disassociate_route_table() resp.data end |
#image(id) ⇒ Image
1965 1966 1967 1968 1969 1970 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1965 def image(id) Image.new( id: id, client: @client ) end |
#images(options = {}) ⇒ Image::Collection
2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2128 def images( = {}) batches = Enumerator.new do |y| batch = [] resp = @client.describe_images() resp.data.images.each do |i| batch << Image.new( id: i.image_id, data: i, client: @client ) end y.yield(batch) end Image::Collection.new(batches) end |
#import_key_pair(options = {}) ⇒ KeyPairInfo
1653 1654 1655 1656 1657 1658 1659 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1653 def import_key_pair( = {}) resp = @client.import_key_pair() KeyPairInfo.new( name: resp.data.key_name, client: @client ) end |
#instance(id) ⇒ Instance
2146 2147 2148 2149 2150 2151 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2146 def instance(id) Instance.new( id: id, client: @client ) end |
#instances(options = {}) ⇒ Instance::Collection
2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2459 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
2481 2482 2483 2484 2485 2486 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2481 def internet_gateway(id) InternetGateway.new( id: id, client: @client ) end |
#internet_gateways(options = {}) ⇒ InternetGateway::Collection
2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2534 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
2554 2555 2556 2557 2558 2559 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2554 def key_pair(name) KeyPairInfo.new( name: name, client: @client ) end |
#key_pairs(options = {}) ⇒ KeyPairInfo::Collection
2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2610 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
2628 2629 2630 2631 2632 2633 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2628 def nat_gateway(id) NatGateway.new( id: id, client: @client ) end |
#nat_gateways(options = {}) ⇒ NatGateway::Collection
2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2677 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
2697 2698 2699 2700 2701 2702 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2697 def network_acl(id) NetworkAcl.new( id: id, client: @client ) end |
#network_acls(options = {}) ⇒ NetworkAcl::Collection
2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2784 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
2804 2805 2806 2807 2808 2809 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2804 def network_interface(id) NetworkInterface.new( id: id, client: @client ) end |
#network_interfaces(options = {}) ⇒ NetworkInterface::Collection
2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2951 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
2971 2972 2973 2974 2975 2976 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 2971 def placement_group(name) PlacementGroup.new( name: name, client: @client ) end |
#placement_groups(options = {}) ⇒ PlacementGroup::Collection
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 3030 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
1799 1800 1801 1802 1803 1804 1805 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 1799 def register_image( = {}) resp = @client.register_image() Image.new( id: resp.data.image_id, client: @client ) end |
#route_table(id) ⇒ RouteTable
3048 3049 3050 3051 3052 3053 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3048 def route_table(id) RouteTable.new( id: id, client: @client ) end |
#route_table_association(id) ⇒ RouteTableAssociation
3057 3058 3059 3060 3061 3062 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3057 def route_table_association(id) RouteTableAssociation.new( id: id, client: @client ) end |
#route_tables(options = {}) ⇒ RouteTable::Collection
3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3157 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
3177 3178 3179 3180 3181 3182 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3177 def security_group(id) SecurityGroup.new( id: id, client: @client ) end |
#security_groups(options = {}) ⇒ SecurityGroup::Collection
3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3298 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
3318 3319 3320 3321 3322 3323 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3318 def snapshot(id) Snapshot.new( id: id, client: @client ) end |
#snapshots(options = {}) ⇒ Snapshot::Collection
3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3400 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
3420 3421 3422 3423 3424 3425 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3420 def subnet(id) Subnet.new( id: id, client: @client ) end |
#subnets(options = {}) ⇒ Subnet::Collection
3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3505 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
3525 3526 3527 3528 3529 3530 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3525 def volume(id) Volume.new( id: id, client: @client ) end |
#volumes(options = {}) ⇒ Volume::Collection
3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3607 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
3627 3628 3629 3630 3631 3632 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3627 def vpc(id) Vpc.new( id: id, client: @client ) end |
#vpc_addresses(options = {}) ⇒ VpcAddress::Collection
3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3697 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
3719 3720 3721 3722 3723 3724 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3719 def vpc_peering_connection(id) VpcPeeringConnection.new( id: id, client: @client ) end |
#vpc_peering_connections(options = {}) ⇒ VpcPeeringConnection::Collection
3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3789 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
3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 |
# File 'gems/aws-sdk-ec2/lib/aws-sdk-ec2/resource.rb', line 3879 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 |