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

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

Overview

Defines a chronological recurrence pattern for creating scheduled backups at a particular periodicity.

Constant Summary collapse

BACKUP_TYPE_ENUM =

rubocop:disable Metrics/LineLength

[
  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

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

  • :retention_seconds (Integer)

    The value to assign to the #retention_seconds property



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 75

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

Instance Attribute Details

#backup_typeString

[Required] The type of backup to create.

Returns:

  • (String)


27
28
29
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 27

def backup_type
  @backup_type
end

#offset_secondsInteger

[Required] The number of seconds (positive or negative) that the backup time should be shifted from the default interval boundaries specified by the period.

Returns:

  • (Integer)


31
32
33
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 31

def offset_seconds
  @offset_seconds
end

#periodString

[Required] How often the backup should occur.

Returns:

  • (String)


35
36
37
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 35

def period
  @period
end

#retention_secondsInteger

[Required] How long, in seconds, backups created by this schedule should be kept until being automatically deleted.

Returns:

  • (Integer)


39
40
41
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 39

def retention_seconds
  @retention_seconds
end

Class Method Details

.attribute_mapObject

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



42
43
44
45
46
47
48
49
50
51
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 42

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'backup_type': :'backupType',
    'offset_seconds': :'offsetSeconds',
    'period': :'period',
    'retention_seconds': :'retentionSeconds'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 54

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



139
140
141
142
143
144
145
146
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 139

def ==(other)
  return true if equal?(other)
  self.class == other.class &&
    backup_type == other.backup_type &&
    offset_seconds == other.offset_seconds &&
    period == other.period &&
    retention_seconds == other.retention_seconds
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



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 171

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


151
152
153
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 151

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



160
161
162
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 160

def hash
  [backup_type, offset_seconds, period, retention_seconds].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



203
204
205
206
207
208
209
210
211
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 203

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



197
198
199
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 197

def to_s
  to_hash.to_s
end