Class: OCI::StackMonitoring::Models::OsCommandUpdateQueryProperties

Inherits:
MetricExtensionUpdateQueryProperties show all
Defined in:
lib/oci/stack_monitoring/models/os_command_update_query_properties.rb

Overview

Query Properties applicable to OS_COMMAND type of collection method

Constant Summary

Constants inherited from MetricExtensionUpdateQueryProperties

MetricExtensionUpdateQueryProperties::COLLECTION_METHOD_ENUM

Instance Attribute Summary collapse

Attributes inherited from MetricExtensionUpdateQueryProperties

#collection_method

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MetricExtensionUpdateQueryProperties

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ OsCommandUpdateQueryProperties

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 70

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

  attributes['collectionMethod'] = 'OS_COMMAND'

  super(attributes)

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

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

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

  self.script_details = attributes[:'scriptDetails'] if attributes[:'scriptDetails']

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

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

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

  self.starts_with = attributes[:'startsWith'] if attributes[:'startsWith']

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

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

Instance Attribute Details

#argumentsString

Arguments required by either command or script

Returns:

  • (String)


25
26
27
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 25

def arguments
  @arguments
end

#commandString

OS command to execute without arguments

Returns:

  • (String)


14
15
16
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 14

def command
  @command
end

#delimiterString

Character used to delimit multiple metric values in single line of output

Returns:

  • (String)


18
19
20
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 18

def delimiter
  @delimiter
end

#script_detailsOCI::StackMonitoring::Models::ScriptFileDetails



21
22
23
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 21

def script_details
  @script_details
end

#starts_withString

String prefix used to identify metric output of the OS Command

Returns:

  • (String)


29
30
31
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 29

def starts_with
  @starts_with
end

Class Method Details

.attribute_mapObject

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



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 32

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'collection_method': :'collectionMethod',
    'command': :'command',
    'delimiter': :'delimiter',
    'script_details': :'scriptDetails',
    'arguments': :'arguments',
    'starts_with': :'startsWith'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 46

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'collection_method': :'String',
    'command': :'String',
    'delimiter': :'String',
    'script_details': :'OCI::StackMonitoring::Models::ScriptFileDetails',
    'arguments': :'String',
    'starts_with': :'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



106
107
108
109
110
111
112
113
114
115
116
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 106

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

  self.class == other.class &&
    collection_method == other.collection_method &&
    command == other.command &&
    delimiter == other.delimiter &&
    script_details == other.script_details &&
    arguments == other.arguments &&
    starts_with == other.starts_with
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



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 141

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


121
122
123
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 121

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



130
131
132
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 130

def hash
  [collection_method, command, delimiter, script_details, arguments, starts_with].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



174
175
176
177
178
179
180
181
182
183
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 174

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



168
169
170
# File 'lib/oci/stack_monitoring/models/os_command_update_query_properties.rb', line 168

def to_s
  to_hash.to_s
end