Class: Fog::Vsphere::Compute::Rules
- Inherits:
-
Collection
- Object
- Collection
- Fog::Vsphere::Compute::Rules
- Defined in:
- lib/fog/vsphere/models/compute/rules.rb
Instance Method Summary collapse
- #all(_filters = {}) ⇒ Object
- #get(key_or_name) ⇒ Object
-
#new(attributes = {}) ⇒ Object
Pass datacenter/cluster to every new rule.
Instance Method Details
#all(_filters = {}) ⇒ Object
11 12 13 14 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 11 def all(_filters = {}) requires :datacenter, :cluster load service.list_rules(datacenter: datacenter, cluster: cluster) end |
#get(key_or_name) ⇒ Object
16 17 18 19 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 16 def get(key_or_name) all.find { |rule| [rule.key, rule.name].include? key_or_name } || raise(Fog::Vsphere::Compute::NotFound, "no such rule #{key_or_name}") end |
#new(attributes = {}) ⇒ Object
Pass datacenter/cluster to every new rule
22 23 24 25 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 22 def new(attributes = {}) requires :datacenter, :cluster super(attributes.merge(datacenter: datacenter, cluster: cluster)) end |