Class: MistApi::GatewayTrafficShaping
- Defined in:
- lib/mist_api/models/gateway_traffic_shaping.rb
Overview
GatewayTrafficShaping Model.
Instance Attribute Summary collapse
-
#class_percentages ⇒ Array[Integer]
percentages for different class of traffic: high / medium / low / best-effort.
-
#enabled ⇒ TrueClass | FalseClass
percentages for different class of traffic: high / medium / low / best-effort.
-
#max_tx_kbps ⇒ Integer
Interface Transmit Cap in kbps.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(class_percentages = SKIP, enabled = false, max_tx_kbps = SKIP) ⇒ GatewayTrafficShaping
constructor
A new instance of GatewayTrafficShaping.
-
#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(class_percentages = SKIP, enabled = false, max_tx_kbps = SKIP) ⇒ GatewayTrafficShaping
Returns a new instance of GatewayTrafficShaping.
49 50 51 52 53 54 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 49 def initialize(class_percentages = SKIP, enabled = false, max_tx_kbps = SKIP) @class_percentages = class_percentages unless class_percentages == SKIP @enabled = enabled unless enabled == SKIP @max_tx_kbps = max_tx_kbps unless max_tx_kbps == SKIP end |
Instance Attribute Details
#class_percentages ⇒ Array[Integer]
percentages for different class of traffic: high / medium / low / best-effort. Sum must be equal to 100
15 16 17 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 15 def class_percentages @class_percentages end |
#enabled ⇒ TrueClass | FalseClass
percentages for different class of traffic: high / medium / low / best-effort. Sum must be equal to 100
20 21 22 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 20 def enabled @enabled end |
#max_tx_kbps ⇒ Integer
Interface Transmit Cap in kbps
24 25 26 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 24 def max_tx_kbps @max_tx_kbps end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 57 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. class_percentages = hash.key?('class_percentages') ? hash['class_percentages'] : SKIP enabled = hash['enabled'] ||= false max_tx_kbps = hash.key?('max_tx_kbps') ? hash['max_tx_kbps'] : SKIP # Create object from extracted values. GatewayTrafficShaping.new(class_percentages, enabled, max_tx_kbps) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['class_percentages'] = 'class_percentages' @_hash['enabled'] = 'enabled' @_hash['max_tx_kbps'] = 'max_tx_kbps' @_hash end |
.nullables ⇒ Object
An array for nullable fields
45 46 47 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 45 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 42 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 36 def self.optionals %w[ class_percentages enabled max_tx_kbps ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
74 75 76 77 78 79 80 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 74 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
90 91 92 93 94 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 90 def inspect class_name = self.class.name.split('::').last "<#{class_name} class_percentages: #{@class_percentages.inspect}, enabled:"\ " #{@enabled.inspect}, max_tx_kbps: #{@max_tx_kbps.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
83 84 85 86 87 |
# File 'lib/mist_api/models/gateway_traffic_shaping.rb', line 83 def to_s class_name = self.class.name.split('::').last "<#{class_name} class_percentages: #{@class_percentages}, enabled: #{@enabled},"\ " max_tx_kbps: #{@max_tx_kbps}>" end |