Class: OCI::Database::Models::WindowPreferenceDetail

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/database/models/window_preference_detail.rb

Overview

The Single Scheduling Window details.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ WindowPreferenceDetail

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



80
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
114
115
# File 'lib/oci/database/models/window_preference_detail.rb', line 80

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.months = attributes[:'months'] if attributes[:'months']

  self.weeks_of_month = attributes[:'weeksOfMonth'] if attributes[:'weeksOfMonth']

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

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

  self.days_of_week = attributes[:'daysOfWeek'] if attributes[:'daysOfWeek']

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

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

  self.start_time = attributes[:'startTime'] if attributes[:'startTime']

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

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

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

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

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

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

Instance Attribute Details

#days_of_weekArray<OCI::Database::Models::DayOfWeek>

[Required] Days during the week when scheduling window should be performed.



25
26
27
# File 'lib/oci/database/models/window_preference_detail.rb', line 25

def days_of_week
  @days_of_week
end

#durationInteger

[Required] Duration window allows user to set a duration they plan to allocate for Scheduling window. The duration is in minutes.

Returns:

  • (Integer)


34
35
36
# File 'lib/oci/database/models/window_preference_detail.rb', line 34

def duration
  @duration
end

#is_enforced_durationBOOLEAN

[Required] Indicates if duration the user plans to allocate for scheduling window is strictly enforced. The default value is FALSE.

Returns:

  • (BOOLEAN)


38
39
40
# File 'lib/oci/database/models/window_preference_detail.rb', line 38

def is_enforced_duration
  @is_enforced_duration
end

#monthsArray<OCI::Database::Models::Month>

Months during the year when scheduled window should be performed.

Returns:



14
15
16
# File 'lib/oci/database/models/window_preference_detail.rb', line 14

def months
  @months
end

#start_timeString

[Required] The scheduling window start time. The value must use the ISO-8601 format "hh:mm".

Returns:

  • (String)


29
30
31
# File 'lib/oci/database/models/window_preference_detail.rb', line 29

def start_time
  @start_time
end

#weeks_of_monthArray<Integer>

[Required] Weeks during the month when scheduled window should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow scheduling window during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Scheduling window cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and startTime parameters to allow you to specify specific days of the week and hours that scheduled window will be performed.

Returns:

  • (Array<Integer>)


21
22
23
# File 'lib/oci/database/models/window_preference_detail.rb', line 21

def weeks_of_month
  @weeks_of_month
end

Class Method Details

.attribute_mapObject

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



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oci/database/models/window_preference_detail.rb', line 41

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'months': :'months',
    'weeks_of_month': :'weeksOfMonth',
    'days_of_week': :'daysOfWeek',
    'start_time': :'startTime',
    'duration': :'duration',
    'is_enforced_duration': :'isEnforcedDuration'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/oci/database/models/window_preference_detail.rb', line 55

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'months': :'Array<OCI::Database::Models::Month>',
    'weeks_of_month': :'Array<Integer>',
    'days_of_week': :'Array<OCI::Database::Models::DayOfWeek>',
    'start_time': :'String',
    'duration': :'Integer',
    'is_enforced_duration': :'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



124
125
126
127
128
129
130
131
132
133
134
# File 'lib/oci/database/models/window_preference_detail.rb', line 124

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

  self.class == other.class &&
    months == other.months &&
    weeks_of_month == other.weeks_of_month &&
    days_of_week == other.days_of_week &&
    start_time == other.start_time &&
    duration == other.duration &&
    is_enforced_duration == other.is_enforced_duration
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



159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/oci/database/models/window_preference_detail.rb', line 159

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


139
140
141
# File 'lib/oci/database/models/window_preference_detail.rb', line 139

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



148
149
150
# File 'lib/oci/database/models/window_preference_detail.rb', line 148

def hash
  [months, weeks_of_month, days_of_week, start_time, duration, is_enforced_duration].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



192
193
194
195
196
197
198
199
200
201
# File 'lib/oci/database/models/window_preference_detail.rb', line 192

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



186
187
188
# File 'lib/oci/database/models/window_preference_detail.rb', line 186

def to_s
  to_hash.to_s
end