Class: OCI::ApmSynthetics::Models::NetworkConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/apm_synthetics/models/network_configuration.rb

Overview

Details of the network configuration. For NETWORK monitor type, NetworkConfiguration is mandatory.

Constant Summary collapse

PROTOCOL_ENUM =
[
  PROTOCOL_ICMP = 'ICMP'.freeze,
  PROTOCOL_TCP = 'TCP'.freeze,
  PROTOCOL_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PROBE_MODE_ENUM =
[
  PROBE_MODE_SACK = 'SACK'.freeze,
  PROBE_MODE_SYN = 'SYN'.freeze,
  PROBE_MODE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ NetworkConfiguration

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :number_of_hops (Integer)

    The value to assign to the #number_of_hops property

  • :probe_per_hop (Integer)

    The value to assign to the #probe_per_hop property

  • :transmission_rate (Integer)

    The value to assign to the #transmission_rate property

  • :protocol (String)

    The value to assign to the #protocol property

  • :probe_mode (String)

    The value to assign to the #probe_mode property



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 81

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.number_of_hops = attributes[:'numberOfHops'] if attributes[:'numberOfHops']

  raise 'You cannot provide both :numberOfHops and :number_of_hops' if attributes.key?(:'numberOfHops') && attributes.key?(:'number_of_hops')

  self.number_of_hops = attributes[:'number_of_hops'] if attributes[:'number_of_hops']

  self.probe_per_hop = attributes[:'probePerHop'] if attributes[:'probePerHop']

  raise 'You cannot provide both :probePerHop and :probe_per_hop' if attributes.key?(:'probePerHop') && attributes.key?(:'probe_per_hop')

  self.probe_per_hop = attributes[:'probe_per_hop'] if attributes[:'probe_per_hop']

  self.transmission_rate = attributes[:'transmissionRate'] if attributes[:'transmissionRate']

  raise 'You cannot provide both :transmissionRate and :transmission_rate' if attributes.key?(:'transmissionRate') && attributes.key?(:'transmission_rate')

  self.transmission_rate = attributes[:'transmission_rate'] if attributes[:'transmission_rate']

  self.protocol = attributes[:'protocol'] if attributes[:'protocol']
  self.protocol = "TCP" if protocol.nil? && !attributes.key?(:'protocol') # rubocop:disable Style/StringLiterals

  self.probe_mode = attributes[:'probeMode'] if attributes[:'probeMode']

  raise 'You cannot provide both :probeMode and :probe_mode' if attributes.key?(:'probeMode') && attributes.key?(:'probe_mode')

  self.probe_mode = attributes[:'probe_mode'] if attributes[:'probe_mode']
end

Instance Attribute Details

#number_of_hopsInteger

Number of hops.

Returns:

  • (Integer)


26
27
28
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 26

def number_of_hops
  @number_of_hops
end

#probe_modeString

Type of probe mode when TCP protocol is selected.

Returns:

  • (String)


42
43
44
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 42

def probe_mode
  @probe_mode
end

#probe_per_hopInteger

Number of probes per hop.

Returns:

  • (Integer)


30
31
32
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 30

def probe_per_hop
  @probe_per_hop
end

#protocolString

Type of protocol.

Returns:

  • (String)


38
39
40
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 38

def protocol
  @protocol
end

#transmission_rateInteger

Number of probe packets sent out simultaneously.

Returns:

  • (Integer)


34
35
36
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 34

def transmission_rate
  @transmission_rate
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 45

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'number_of_hops': :'numberOfHops',
    'probe_per_hop': :'probePerHop',
    'transmission_rate': :'transmissionRate',
    'protocol': :'protocol',
    'probe_mode': :'probeMode'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 58

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'number_of_hops': :'Integer',
    'probe_per_hop': :'Integer',
    'transmission_rate': :'Integer',
    'protocol': :'String',
    'probe_mode': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 148

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    number_of_hops == other.number_of_hops &&
    probe_per_hop == other.probe_per_hop &&
    transmission_rate == other.transmission_rate &&
    protocol == other.protocol &&
    probe_mode == other.probe_mode
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 182

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


162
163
164
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 162

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



171
172
173
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 171

def hash
  [number_of_hops, probe_per_hop, transmission_rate, protocol, probe_mode].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 215

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



209
210
211
# File 'lib/oci/apm_synthetics/models/network_configuration.rb', line 209

def to_s
  to_hash.to_s
end