Class: OCI::FileStorage::Models::SnapshotSchedule

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/file_storage/models/snapshot_schedule.rb

Overview

The snapshot schedule is a structure within a parent file system snapshot policy. It contains data about the frequency of snapshot creation and the retention time of the taken snapshots.

Constant Summary collapse

PERIOD_ENUM =
[
  PERIOD_HOURLY = 'HOURLY'.freeze,
  PERIOD_DAILY = 'DAILY'.freeze,
  PERIOD_WEEKLY = 'WEEKLY'.freeze,
  PERIOD_MONTHLY = 'MONTHLY'.freeze,
  PERIOD_YEARLY = 'YEARLY'.freeze,
  PERIOD_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
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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SnapshotSchedule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :schedule_prefix (String)

    The value to assign to the #schedule_prefix property

  • :time_schedule_start (DateTime)

    The value to assign to the #time_schedule_start property

  • :period (String)

    The value to assign to the #period property

  • :retention_duration_in_seconds (Integer)

    The value to assign to the #retention_duration_in_seconds property

  • :time_zone (String)

    The value to assign to the #time_zone 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



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 158

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

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

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

  self.time_schedule_start = attributes[:'timeScheduleStart'] if attributes[:'timeScheduleStart']

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

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

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

  self.retention_duration_in_seconds = attributes[:'retentionDurationInSeconds'] if attributes[:'retentionDurationInSeconds']

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

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

  self.time_zone = attributes[:'timeZone'] if attributes[:'timeZone']

  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.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']
end

Instance Attribute Details

#day_of_monthInteger

The day of the month to create a scheduled snapshot. If the day does not exist for the month, snapshot creation will be skipped. Used for MONTHLY and YEARLY snapshot schedules.

Returns:

  • (Integer)


101
102
103
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 101

def day_of_month
  @day_of_month
end

#day_of_weekString

The day of the week to create a scheduled snapshot. Used for WEEKLY snapshot schedules.

Returns:

  • (String)


94
95
96
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 94

def day_of_week
  @day_of_week
end

#hour_of_dayInteger

The hour of the day to create a DAILY, WEEKLY, MONTHLY, or YEARLY snapshot. If not set, a value will be chosen at creation time.

Returns:

  • (Integer)


88
89
90
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 88

def hour_of_day
  @hour_of_day
end

#monthString

The month to create a scheduled snapshot. Used only for YEARLY snapshot schedules.

Returns:

  • (String)


107
108
109
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 107

def month
  @month
end

#periodString

[Required] The frequency of scheduled snapshots.

Returns:

  • (String)


72
73
74
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 72

def period
  @period
end

#retention_duration_in_secondsInteger

The number of seconds to retain snapshots created with this schedule. Snapshot expiration time will not be set if this value is empty.

Returns:

  • (Integer)


78
79
80
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 78

def retention_duration_in_seconds
  @retention_duration_in_seconds
end

#schedule_prefixString

A name prefix to be applied to snapshots created by this schedule.

Example: compliance1

Returns:

  • (String)


61
62
63
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 61

def schedule_prefix
  @schedule_prefix
end

#time_schedule_startDateTime

The starting point used to begin the scheduling of the snapshots based upon recurrence string in RFC 3339 timestamp format. If no timeScheduleStart is provided, the value will be set to the time when the schedule was created.

Returns:

  • (DateTime)


68
69
70
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 68

def time_schedule_start
  @time_schedule_start
end

#time_zoneString

[Required] Time zone used for scheduling the snapshot.

Returns:

  • (String)


82
83
84
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 82

def time_zone
  @time_zone
end

Class Method Details

.attribute_mapObject

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



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 110

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'schedule_prefix': :'schedulePrefix',
    'time_schedule_start': :'timeScheduleStart',
    'period': :'period',
    'retention_duration_in_seconds': :'retentionDurationInSeconds',
    'time_zone': :'timeZone',
    'hour_of_day': :'hourOfDay',
    'day_of_week': :'dayOfWeek',
    'day_of_month': :'dayOfMonth',
    'month': :'month'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 127

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'schedule_prefix': :'String',
    'time_schedule_start': :'DateTime',
    'period': :'String',
    'retention_duration_in_seconds': :'Integer',
    'time_zone': :'String',
    'hour_of_day': :'Integer',
    'day_of_week': :'String',
    'day_of_month': :'Integer',
    'month': :'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



270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 270

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

  self.class == other.class &&
    schedule_prefix == other.schedule_prefix &&
    time_schedule_start == other.time_schedule_start &&
    period == other.period &&
    retention_duration_in_seconds == other.retention_duration_in_seconds &&
    time_zone == other.time_zone &&
    hour_of_day == other.hour_of_day &&
    day_of_week == other.day_of_week &&
    day_of_month == other.day_of_month &&
    month == other.month
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



308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 308

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


288
289
290
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 288

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



297
298
299
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 297

def hash
  [schedule_prefix, time_schedule_start, period, retention_duration_in_seconds, time_zone, hour_of_day, day_of_week, day_of_month, month].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



341
342
343
344
345
346
347
348
349
350
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 341

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



335
336
337
# File 'lib/oci/file_storage/models/snapshot_schedule.rb', line 335

def to_s
  to_hash.to_s
end