Class: Fog::Compute::AWS::Vpcs
- Inherits:
-
Fog::Collection
- Object
- Array
- Fog::Collection
- Fog::Compute::AWS::Vpcs
- Defined in:
- lib/rackspace-fog/aws/models/compute/vpcs.rb
Instance Attribute Summary
Attributes inherited from Fog::Collection
Instance Method Summary collapse
-
#all(filters = filters) ⇒ Object
Returns an array of all VPCs that have been created.
-
#get(vpc_id) ⇒ Object
Used to retrieve a VPC vpc_id is required to get the associated VPC information.
-
#initialize(attributes) ⇒ Vpcs
constructor
Creates a new VPC.
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) ⇒ Vpcs
Creates a new VPC
AWS.vpcs.new
Returns
Returns the details of the new VPC
>> AWS.vpcs.new <Fog::AWS::VPC::VPC id=nil, state=nil, cidr_block=nil, dhcp_options_id=nil tags=nil tenancy=nil >
33 34 35 36 |
# File 'lib/rackspace-fog/aws/models/compute/vpcs.rb', line 33 def initialize(attributes) self.filters ||= {} super end |
Instance Method Details
#all(filters = filters) ⇒ Object
Returns an array of all VPCs that have been created
AWS.vpcs.all
Returns
Returns an array of all VPCs
>> AWS.vpcs.all <Fog::AWS::VPC::VPCs filters={} [ <Fog::AWS::VPC::VPC id=“vpc-12345678”, TODO > ] >
58 59 60 61 62 63 64 65 66 |
# File 'lib/rackspace-fog/aws/models/compute/vpcs.rb', line 58 def all(filters = filters) unless filters.is_a?(Hash) Fog::Logger.warning("all with #{filters.class} param is deprecated, use all('vpc-id' => []) instead [light_black](#{caller.first})[/]") filters = {'vpc-id' => [*filters]} end self.filters = filters data = connection.describe_vpcs(filters).body load(data['vpcSet']) end |
#get(vpc_id) ⇒ Object
Used to retrieve a VPC vpc_id is required to get the associated VPC information.
You can run the following command to get the details: AWS.vpcs.get(“vpc-12345678”)
Returns
>> AWS.vpcs.get(“vpc-12345678”) <Fog::AWS::Compute::VPC id=“vpc-12345678”, TODO >
83 84 85 86 87 |
# File 'lib/rackspace-fog/aws/models/compute/vpcs.rb', line 83 def get(vpc_id) if vpc_id self.class.new(:connection => connection).all('vpc-id' => vpc_id).first end end |