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
9 10 11 12 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 9 def all(_filters = {}) requires :datacenter, :cluster load service.list_rules(datacenter: datacenter, cluster: cluster) end |
#get(key_or_name) ⇒ Object
14 15 16 17 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 14 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
20 21 22 23 |
# File 'lib/fog/vsphere/models/compute/rules.rb', line 20 def new(attributes = {}) requires :datacenter, :cluster super(attributes.merge(datacenter: datacenter, cluster: cluster)) end |