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



173
174
175
176
177
178
179
180
181
182
183
184
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
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 173

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)


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

def day_of_month
  @day_of_month
end

#day_of_weekString

The day of the week to schedule the volume backup.

Returns:

  • (String)


103
104
105
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 103

def day_of_week
  @day_of_week
end

#hour_of_dayInteger

The hour of the day to schedule the volume backup.

Returns:

  • (Integer)


99
100
101
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 99

def hour_of_day
  @hour_of_day
end

#monthString

The month of the year to schedule the volume backup.

Returns:

  • (String)


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

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)


73
74
75
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 73

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)


95
96
97
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 95

def offset_type
  @offset_type
end

#periodString

[Required] The volume backup frequency.

Returns:

  • (String)


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

def period
  @period
end

#retention_secondsInteger

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

Returns:

  • (Integer)


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

def retention_seconds
  @retention_seconds
end

#time_zoneString

Specifies what time zone is the schedule in

Returns:

  • (String)


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

def time_zone
  @time_zone
end

Class Method Details

.attribute_mapObject

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



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 122

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.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 140

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



319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 319

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



358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 358

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


338
339
340
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 338

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



347
348
349
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 347

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



391
392
393
394
395
396
397
398
399
400
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 391

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



385
386
387
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 385

def to_s
  to_hash.to_s
end