Class: Fog::Compute::AWS::NetworkAcls

Inherits:
Fog::Collection show all
Defined in:
lib/fog/aws/models/compute/network_acls.rb

Instance Attribute Summary

Attributes inherited from Fog::Collection

#service

Instance Method Summary collapse

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 Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes) ⇒ NetworkAcls

Creates a new network ACL

AWS.network_acls.new

Returns

Returns the details of the new network ACL

>> <Fog::Compute::AWS::NetworkAcl

network_acl_id=nil,
vpc_id=nil,
default=nil,
entries=nil,
associations=nil,
tags=nil

>



31
32
33
34
# File 'lib/fog/aws/models/compute/network_acls.rb', line 31

def initialize(attributes)
  self.filters ||= {}
  super
end

Instance Method Details

#all(filters = filters) ⇒ Object

Returns an array of all network ACLs that have been created

AWS.network_acls.all

Returns

Returns an array of all network ACLs

>> AWS.network_acls.all

<Fog::AWS::Compute::NetworkAcls
  filters={}
  [
    <Fog::Compute::AWS::NetworkAcl
      network_acl_id="acl-abcdefgh",
      vpc_id="vpc-abcdefgh",
      default=true,
      entries=[
        {
          "icmpTypeCode" => {},
          "portRange"    => {},
          "ruleNumber"   => 32767,
          "protocol"     => -1,
          "ruleAction"   => "deny",
          "egress"       => false,
          "cidrBlock"    => "0.0.0.0/0"
        },
        {
          "icmpTypeCode" => {},
          "portRange"    => {},
          "ruleNumber"   => 32767,
          "protocol"     => -1,
          "ruleAction"   => "deny",
          "egress"       => true,
          "cidrBlock"    => "0.0.0.0/0"
        }
      ],
      associations=[
        {
          "networkAclAssociationId" => "aclassoc-abcdefgh",
          "networkAclId"            => "acl-abcdefgh",
          "subnetId"                => "subnet-abcdefgh"
        }
      ],
      tags={}
    >
  ]
>


84
85
86
87
88
# File 'lib/fog/aws/models/compute/network_acls.rb', line 84

def all(filters = filters)
  self.filters = filters
  data = service.describe_network_acls(filters).body
  load(data['networkAclSet'])
end

#get(nacl_id) ⇒ Object

Used to retrieve a network interface network interface id is required to get any information

You can run the following command to get the details: AWS.network_interfaces.get(“eni-11223344”)

Returns

>> AWS.network_acls.get(“acl-abcdefgh”)

<Fog::Compute::AWS::NetworkAcl
  network_acl_id="acl-abcdefgh",
  vpc_id="vpc-abcdefgh",
  default=true,
  entries=[
    {
      "icmpTypeCode" => {},
      "portRange"    => {},
      "ruleNumber"   => 32767,
      "protocol"     => -1,
      "ruleAction"   => "deny",
      "egress"       => false,
      "cidrBlock"    => "0.0.0.0/0"
    },
    {
      "icmpTypeCode" => {},
      "portRange"    => {},
      "ruleNumber"   => 32767,
      "protocol"     => -1,
      "ruleAction"   => "deny",
      "egress"       => true,
      "cidrBlock"    => "0.0.0.0/0"
    }
  ],
  associations=[
    {
      "networkAclAssociationId" => "aclassoc-abcdefgh",
      "networkAclId"            => "acl-abcdefgh",
      "subnetId"                => "subnet-abcdefgh"
    }
  ],
  tags={}
>


132
133
134
# File 'lib/fog/aws/models/compute/network_acls.rb', line 132

def get(nacl_id)
  self.class.new(:service => service).all('network-acl-id' => nacl_id).first if nacl_id
end