Class: Fog::Compute::AWS::Subnets
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::AWS::Subnets
- Defined in:
- lib/rackspace-fog/aws/models/compute/subnets.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
-
#all(filters = filters) ⇒ Object
Returns an array of all Subnets that have been created.
-
#get(subnet_id) ⇒ Object
Used to retrieve a Subnet subnet-id is required to get the associated VPC information.
-
#initialize(attributes) ⇒ Subnets
constructor
Creates a new subnet.
Methods inherited from Fog::Collection
#clear, #create, #destroy, #inspect, #load, model, #model, #new, #reload, #table, #to_json
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
#initialize(attributes) ⇒ Subnets
Creates a new subnet
AWS.subnets.new
Returns
Returns the details of the new Subnet
>> AWS.subnets.new <Fog::AWS::Compute::Subnet subnet_id=subnet-someId, state=, vpc_id=vpc-someId cidr_block=someIpRange available_ip_address_count=someInt tagset=nil >
33 34 35 36 |
# File 'lib/rackspace-fog/aws/models/compute/subnets.rb', line 33 def initialize(attributes) self.filters ||= {} super end |
Instance Method Details
#all(filters = filters) ⇒ Object
Returns an array of all Subnets that have been created
AWS.subnets.all
Returns
Returns an array of all VPCs
>> AWS.subnets.all <Fog::AWS::Compute::Subnet filters={} [ subnet_id=subnet-someId, state=, vpc_id=vpc-someId cidr_block=someIpRange available_ip_address_count=someInt tagset=nil ] >
60 61 62 63 64 65 66 67 68 |
# File 'lib/rackspace-fog/aws/models/compute/subnets.rb', line 60 def all(filters = filters) unless filters.is_a?(Hash) Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('subnet-id' => []) instead [light_black](#{caller.first})[/]") filters = {'subnet-id' => [*filters]} end self.filters = filters data = connection.describe_subnets(filters).body load(data['subnetSet']) end |
#get(subnet_id) ⇒ Object
Used to retrieve a Subnet subnet-id is required to get the associated VPC information.
You can run the following command to get the details: AWS.subnets.get(“subnet-12345678”)
Returns
>> AWS.subnets.get(“subnet-12345678”) <Fog::AWS::Compute::Subnet subnet_id=subnet-someId, state=, vpc_id=vpc-someId cidr_block=someIpRange available_ip_address_count=someInt tagset=nil >
89 90 91 92 93 |
# File 'lib/rackspace-fog/aws/models/compute/subnets.rb', line 89 def get(subnet_id) if subnet_id self.class.new(:connection => connection).all('subnet-id' => subnet_id).first end end |