Class: OCI::LogAnalytics::Models::PurgeAction

Inherits:
Action
  • Object
show all
Defined in:
lib/oci/log_analytics/models/purge_action.rb

Overview

Purge action for scheduled task.

Constant Summary collapse

DATA_TYPE_ENUM =
[
  DATA_TYPE_LOG = 'LOG'.freeze,
  DATA_TYPE_LOOKUP = 'LOOKUP'.freeze,
  DATA_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from Action

Action::TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from Action

#type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Action

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ PurgeAction

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :query_string (String)

    The value to assign to the #query_string property

  • :data_type (String)

    The value to assign to the #data_type property

  • :purge_duration (String)

    The value to assign to the #purge_duration property

  • :purge_compartment_id (String)

    The value to assign to the #purge_compartment_id property

  • :compartment_id_in_subtree (BOOLEAN)

    The value to assign to the #compartment_id_in_subtree property



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
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/log_analytics/models/purge_action.rb', line 84

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

  attributes['type'] = 'PURGE'

  super(attributes)

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

  self.query_string = attributes[:'queryString'] if attributes[:'queryString']

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

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

  self.data_type = attributes[:'dataType'] if attributes[:'dataType']

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

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

  self.purge_duration = attributes[:'purgeDuration'] if attributes[:'purgeDuration']

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

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

  self.purge_compartment_id = attributes[:'purgeCompartmentId'] if attributes[:'purgeCompartmentId']

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

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

  self.compartment_id_in_subtree = attributes[:'compartmentIdInSubtree'] unless attributes[:'compartmentIdInSubtree'].nil?
  self.compartment_id_in_subtree = false if compartment_id_in_subtree.nil? && !attributes.key?(:'compartmentIdInSubtree') # rubocop:disable Style/StringLiterals

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

  self.compartment_id_in_subtree = attributes[:'compartment_id_in_subtree'] unless attributes[:'compartment_id_in_subtree'].nil?
  self.compartment_id_in_subtree = false if compartment_id_in_subtree.nil? && !attributes.key?(:'compartmentIdInSubtree') && !attributes.key?(:'compartment_id_in_subtree') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#compartment_id_in_subtreeBOOLEAN

if true, purge child compartments data

Returns:

  • (BOOLEAN)


43
44
45
# File 'lib/oci/log_analytics/models/purge_action.rb', line 43

def compartment_id_in_subtree
  @compartment_id_in_subtree
end

#data_typeString

[Required] the type of the log data to be purged

Returns:

  • (String)


25
26
27
# File 'lib/oci/log_analytics/models/purge_action.rb', line 25

def data_type
  @data_type
end

#purge_compartment_idString

[Required] the compartment OCID under which the data will be purged

Returns:

  • (String)


39
40
41
# File 'lib/oci/log_analytics/models/purge_action.rb', line 39

def purge_compartment_id
  @purge_compartment_id
end

#purge_durationString

[Required] The duration of data to be retained, which is used to calculate the timeDataEnded when the task fires. The value should be negative. Purge duration in ISO 8601 extended format as described in en.wikipedia.org/wiki/ISO_8601#Durations. The largest supported unit is D, e.g. -P365D (not -P1Y) or -P14D (not -P2W).

Returns:

  • (String)


35
36
37
# File 'lib/oci/log_analytics/models/purge_action.rb', line 35

def purge_duration
  @purge_duration
end

#query_stringString

[Required] Purge query string.

Returns:

  • (String)


21
22
23
# File 'lib/oci/log_analytics/models/purge_action.rb', line 21

def query_string
  @query_string
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'query_string': :'queryString',
    'data_type': :'dataType',
    'purge_duration': :'purgeDuration',
    'purge_compartment_id': :'purgeCompartmentId',
    'compartment_id_in_subtree': :'compartmentIdInSubtree'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/oci/log_analytics/models/purge_action.rb', line 60

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'query_string': :'String',
    'data_type': :'String',
    'purge_duration': :'String',
    'purge_compartment_id': :'String',
    'compartment_id_in_subtree': :'BOOLEAN'
    # 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



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

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

  self.class == other.class &&
    type == other.type &&
    query_string == other.query_string &&
    data_type == other.data_type &&
    purge_duration == other.purge_duration &&
    purge_compartment_id == other.purge_compartment_id &&
    compartment_id_in_subtree == other.compartment_id_in_subtree
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/log_analytics/models/purge_action.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/log_analytics/models/purge_action.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/log_analytics/models/purge_action.rb', line 171

def hash
  [type, query_string, data_type, purge_duration, purge_compartment_id, compartment_id_in_subtree].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/log_analytics/models/purge_action.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/log_analytics/models/purge_action.rb', line 209

def to_s
  to_hash.to_s
end