Class: OCI::Core::Models::VolumeBackupSchedule

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/core/models/volume_backup_schedule.rb

Overview

Defines the backup frequency and retention period for a volume backup policy. For more information, see Policy-Based Backups.

Constant Summary collapse

BACKUP_TYPE_ENUM =
[
  BACKUP_TYPE_FULL = 'FULL'.freeze,
  BACKUP_TYPE_INCREMENTAL = 'INCREMENTAL'.freeze,
  BACKUP_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PERIOD_ENUM =
[
  PERIOD_ONE_HOUR = 'ONE_HOUR'.freeze,
  PERIOD_ONE_DAY = 'ONE_DAY'.freeze,
  PERIOD_ONE_WEEK = 'ONE_WEEK'.freeze,
  PERIOD_ONE_MONTH = 'ONE_MONTH'.freeze,
  PERIOD_ONE_YEAR = 'ONE_YEAR'.freeze,
  PERIOD_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
OFFSET_TYPE_ENUM =
[
  OFFSET_TYPE_STRUCTURED = 'STRUCTURED'.freeze,
  OFFSET_TYPE_NUMERIC_SECONDS = 'NUMERIC_SECONDS'.freeze,
  OFFSET_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
DAY_OF_WEEK_ENUM =
[
  DAY_OF_WEEK_MONDAY = 'MONDAY'.freeze,
  DAY_OF_WEEK_TUESDAY = 'TUESDAY'.freeze,
  DAY_OF_WEEK_WEDNESDAY = 'WEDNESDAY'.freeze,
  DAY_OF_WEEK_THURSDAY = 'THURSDAY'.freeze,
  DAY_OF_WEEK_FRIDAY = 'FRIDAY'.freeze,
  DAY_OF_WEEK_SATURDAY = 'SATURDAY'.freeze,
  DAY_OF_WEEK_SUNDAY = 'SUNDAY'.freeze,
  DAY_OF_WEEK_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
MONTH_ENUM =
[
  MONTH_JANUARY = 'JANUARY'.freeze,
  MONTH_FEBRUARY = 'FEBRUARY'.freeze,
  MONTH_MARCH = 'MARCH'.freeze,
  MONTH_APRIL = 'APRIL'.freeze,
  MONTH_MAY = 'MAY'.freeze,
  MONTH_JUNE = 'JUNE'.freeze,
  MONTH_JULY = 'JULY'.freeze,
  MONTH_AUGUST = 'AUGUST'.freeze,
  MONTH_SEPTEMBER = 'SEPTEMBER'.freeze,
  MONTH_OCTOBER = 'OCTOBER'.freeze,
  MONTH_NOVEMBER = 'NOVEMBER'.freeze,
  MONTH_DECEMBER = 'DECEMBER'.freeze,
  MONTH_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
TIME_ZONE_ENUM =
[
  TIME_ZONE_UTC = 'UTC'.freeze,
  TIME_ZONE_REGIONAL_DATA_CENTER_TIME = 'REGIONAL_DATA_CENTER_TIME'.freeze,
  TIME_ZONE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VolumeBackupSchedule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :backup_type (String)

    The value to assign to the #backup_type property

  • :offset_seconds (Integer)

    The value to assign to the #offset_seconds property

  • :period (String)

    The value to assign to the #period property

  • :offset_type (String)

    The value to assign to the #offset_type property

  • :hour_of_day (Integer)

    The value to assign to the #hour_of_day property

  • :day_of_week (String)

    The value to assign to the #day_of_week property

  • :day_of_month (Integer)

    The value to assign to the #day_of_month property

  • :month (String)

    The value to assign to the #month property

  • :retention_seconds (Integer)

    The value to assign to the #retention_seconds property

  • :time_zone (String)

    The value to assign to the #time_zone property



185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 185

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

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

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

  self.offset_seconds = attributes[:'offsetSeconds'] if attributes[:'offsetSeconds']

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

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

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

  self.offset_type = attributes[:'offsetType'] if attributes[:'offsetType']

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

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

  self.hour_of_day = attributes[:'hourOfDay'] if attributes[:'hourOfDay']

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

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

  self.day_of_week = attributes[:'dayOfWeek'] if attributes[:'dayOfWeek']

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

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

  self.day_of_month = attributes[:'dayOfMonth'] if attributes[:'dayOfMonth']

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

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

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

  self.retention_seconds = attributes[:'retentionSeconds'] if attributes[:'retentionSeconds']

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

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

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

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

  self.time_zone = attributes[:'time_zone'] if attributes[:'time_zone']
  self.time_zone = "UTC" if time_zone.nil? && !attributes.key?(:'timeZone') && !attributes.key?(:'time_zone') # rubocop:disable Style/StringLiterals
end

Instance Attribute Details

#backup_typeString

[Required] The type of volume backup to create.

Returns:

  • (String)


69
70
71
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 69

def backup_type
  @backup_type
end

#day_of_monthInteger

The day of the month to schedule the volume backup.

Returns:

  • (Integer)


119
120
121
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 119

def day_of_month
  @day_of_month
end

#day_of_weekString

The day of the week to schedule the volume backup.

Returns:

  • (String)


115
116
117
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 115

def day_of_week
  @day_of_week
end

#hour_of_dayInteger

The hour of the day to schedule the volume backup.

Returns:

  • (Integer)


111
112
113
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 111

def hour_of_day
  @hour_of_day
end

#monthString

The month of the year to schedule the volume backup.

Returns:

  • (String)


123
124
125
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 123

def month
  @month
end

#offset_secondsInteger

The number of seconds that the volume backup start time should be shifted from the default interval boundaries specified by the period. The volume backup start time is the frequency start time plus the offset.

Returns:

  • (Integer)


76
77
78
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 76

def offset_seconds
  @offset_seconds
end

#offset_typeString

Indicates how the offset is defined. If value is STRUCTURED, then hourOfDay, dayOfWeek, dayOfMonth, and month fields are used and offsetSeconds will be ignored in requests and users should ignore its value from the responses.

hourOfDay is applicable for periods ONE_DAY, ONE_WEEK, ONE_MONTH and ONE_YEAR.

dayOfWeek is applicable for period ONE_WEEK.

dayOfMonth is applicable for periods ONE_MONTH and ONE_YEAR.

'month' is applicable for period 'ONE_YEAR'.

They will be ignored in the requests for inapplicable periods.

If value is NUMERIC_SECONDS, then offsetSeconds will be used for both requests and responses and the structured fields will be ignored in the requests and users should ignore their values from the responses.

For clients using older versions of Apis and not sending offsetType in their requests, the behaviour is just like NUMERIC_SECONDS.

Returns:

  • (String)


107
108
109
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 107

def offset_type
  @offset_type
end

#periodString

[Required] The volume backup frequency.

Returns:

  • (String)


80
81
82
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 80

def period
  @period
end

#retention_secondsInteger

[Required] How long, in seconds, to keep the volume backups created by this schedule.

Returns:

  • (Integer)


127
128
129
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 127

def retention_seconds
  @retention_seconds
end

#time_zoneString

Specifies what time zone is the schedule in

Returns:

  • (String)


131
132
133
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 131

def time_zone
  @time_zone
end

Class Method Details

.attribute_mapObject

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



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 134

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'backup_type': :'backupType',
    'offset_seconds': :'offsetSeconds',
    'period': :'period',
    'offset_type': :'offsetType',
    'hour_of_day': :'hourOfDay',
    'day_of_week': :'dayOfWeek',
    'day_of_month': :'dayOfMonth',
    'month': :'month',
    'retention_seconds': :'retentionSeconds',
    'time_zone': :'timeZone'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 152

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'backup_type': :'String',
    'offset_seconds': :'Integer',
    'period': :'String',
    'offset_type': :'String',
    'hour_of_day': :'Integer',
    'day_of_week': :'String',
    'day_of_month': :'Integer',
    'month': :'String',
    'retention_seconds': :'Integer',
    'time_zone': :'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



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 331

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

  self.class == other.class &&
    backup_type == other.backup_type &&
    offset_seconds == other.offset_seconds &&
    period == other.period &&
    offset_type == other.offset_type &&
    hour_of_day == other.hour_of_day &&
    day_of_week == other.day_of_week &&
    day_of_month == other.day_of_month &&
    month == other.month &&
    retention_seconds == other.retention_seconds &&
    time_zone == other.time_zone
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



370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 370

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


350
351
352
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 350

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



359
360
361
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 359

def hash
  [backup_type, offset_seconds, period, offset_type, hour_of_day, day_of_week, day_of_month, month, retention_seconds, time_zone].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



403
404
405
406
407
408
409
410
411
412
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 403

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



397
398
399
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 397

def to_s
  to_hash.to_s
end