Class: MistApi::AclPolicy
- Defined in:
- lib/mist_api/models/acl_policy.rb
Overview
ACL Policy: - for GBP-based policy, all src_tags and dst_tags have to be gbp-based - for ACL-based policy, ‘network` is required in either the source or destination so that we know where to attach the policy to
Instance Attribute Summary collapse
-
#actions ⇒ Array[AclPolicyAction]
ACL Policy Actions: - for GBP-based policy, all src_tags and dst_tags have to be gbp-based - for ACL-based policy, ‘network` is required in either the source or destination so that we know where to attach the policy to.
-
#name ⇒ String
ACL Policy Actions: - for GBP-based policy, all src_tags and dst_tags have to be gbp-based - for ACL-based policy, ‘network` is required in either the source or destination so that we know where to attach the policy to.
-
#src_tags ⇒ Array[String]
ACL Policy Source Tags: - for GBP-based policy, all src_tags and dst_tags have to be gbp-based - for ACL-based policy, ‘network` is required in either the source or destination so that we know where to attach the policy to.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(actions = SKIP, name = SKIP, src_tags = SKIP) ⇒ AclPolicy
constructor
A new instance of AclPolicy.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(actions = SKIP, name = SKIP, src_tags = SKIP) ⇒ AclPolicy
Returns a new instance of AclPolicy.
58 59 60 61 62 |
# File 'lib/mist_api/models/acl_policy.rb', line 58 def initialize(actions = SKIP, name = SKIP, = SKIP) @actions = actions unless actions == SKIP @name = name unless name == SKIP @src_tags = unless == SKIP end |
Instance Attribute Details
#actions ⇒ Array[AclPolicyAction]
ACL Policy Actions:
- for GBP-based policy, all src_tags and dst_tags have to be gbp-based
- for ACL-based policy, `network` is required in either the source or
destination so that we know where to attach the policy to
19 20 21 |
# File 'lib/mist_api/models/acl_policy.rb', line 19 def actions @actions end |
#name ⇒ String
ACL Policy Actions:
- for GBP-based policy, all src_tags and dst_tags have to be gbp-based
- for ACL-based policy, `network` is required in either the source or
destination so that we know where to attach the policy to
26 27 28 |
# File 'lib/mist_api/models/acl_policy.rb', line 26 def name @name end |
#src_tags ⇒ Array[String]
ACL Policy Source Tags:
- for GBP-based policy, all src_tags and dst_tags have to be gbp-based
- for ACL-based policy, `network` is required in either the source or
destination so that we know where to attach the policy to
33 34 35 |
# File 'lib/mist_api/models/acl_policy.rb', line 33 def @src_tags end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/mist_api/models/acl_policy.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it actions = nil unless hash['actions'].nil? actions = [] hash['actions'].each do |structure| actions << (AclPolicyAction.from_hash(structure) if structure) end end actions = SKIP unless hash.key?('actions') name = hash.key?('name') ? hash['name'] : SKIP = hash.key?('src_tags') ? hash['src_tags'] : SKIP # Create object from extracted values. AclPolicy.new(actions, name, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 |
# File 'lib/mist_api/models/acl_policy.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['actions'] = 'actions' @_hash['name'] = 'name' @_hash['src_tags'] = 'src_tags' @_hash end |
.nullables ⇒ Object
An array for nullable fields
54 55 56 |
# File 'lib/mist_api/models/acl_policy.rb', line 54 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
45 46 47 48 49 50 51 |
# File 'lib/mist_api/models/acl_policy.rb', line 45 def self.optionals %w[ actions name src_tags ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
95 96 97 98 99 |
# File 'lib/mist_api/models/acl_policy.rb', line 95 def inspect class_name = self.class.name.split('::').last "<#{class_name} actions: #{@actions.inspect}, name: #{@name.inspect}, src_tags:"\ " #{@src_tags.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
89 90 91 92 |
# File 'lib/mist_api/models/acl_policy.rb', line 89 def to_s class_name = self.class.name.split('::').last "<#{class_name} actions: #{@actions}, name: #{@name}, src_tags: #{@src_tags}>" end |