Class: OCI::DataScience::Models::ScheduleIntervalTrigger

Inherits:
ScheduleTrigger show all
Defined in:
lib/oci/data_science/models/schedule_interval_trigger.rb

Overview

The interval schedule trigger.

Constant Summary collapse

FREQUENCY_ENUM =
[
  FREQUENCY_HOURLY = 'HOURLY'.freeze,
  FREQUENCY_DAILY = 'DAILY'.freeze,
  FREQUENCY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from ScheduleTrigger

OCI::DataScience::Models::ScheduleTrigger::TRIGGER_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from ScheduleTrigger

#time_end, #time_start, #trigger_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ScheduleTrigger

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ ScheduleIntervalTrigger

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :time_start (DateTime)

    The value to assign to the #time_start proprety

  • :time_end (DateTime)

    The value to assign to the #time_end proprety

  • :frequency (String)

    The value to assign to the #frequency property

  • :interval (Integer)

    The value to assign to the #interval property

  • :is_random_start_time (BOOLEAN)

    The value to assign to the #is_random_start_time property



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 72

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

  attributes['triggerType'] = 'INTERVAL'

  super(attributes)

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

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

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

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

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

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

Instance Attribute Details

#frequencyString

[Required] The type of frequency

Returns:

  • (String)


21
22
23
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 21

def frequency
  @frequency
end

#intervalInteger

[Required] The interval of frequency.

Returns:

  • (Integer)


25
26
27
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 25

def interval
  @interval
end

#is_random_start_timeBOOLEAN

when true and timeStart is null, system generate a random start time between now and now + interval; isRandomStartTime can be true if timeStart is null.

Returns:

  • (BOOLEAN)


31
32
33
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 31

def is_random_start_time
  @is_random_start_time
end

Class Method Details

.attribute_mapObject

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



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 34

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'trigger_type': :'triggerType',
    'time_start': :'timeStart',
    'time_end': :'timeEnd',
    'frequency': :'frequency',
    'interval': :'interval',
    'is_random_start_time': :'isRandomStartTime'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 48

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'trigger_type': :'String',
    'time_start': :'DateTime',
    'time_end': :'DateTime',
    'frequency': :'String',
    'interval': :'Integer',
    'is_random_start_time': :'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



115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 115

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

  self.class == other.class &&
    trigger_type == other.trigger_type &&
    time_start == other.time_start &&
    time_end == other.time_end &&
    frequency == other.frequency &&
    interval == other.interval &&
    is_random_start_time == other.is_random_start_time
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



150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 150

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


130
131
132
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 130

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



139
140
141
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 139

def hash
  [trigger_type, time_start, time_end, frequency, interval, is_random_start_time].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 183

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



177
178
179
# File 'lib/oci/data_science/models/schedule_interval_trigger.rb', line 177

def to_s
  to_hash.to_s
end