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 =
[BACKUP_TYPE_FULL = 'FULL',
BACKUP_TYPE_INCREMENTAL = 'INCREMENTAL',
BACKUP_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']
PERIOD_ENUM =
[PERIOD_ONE_HOUR = 'ONE_HOUR',
PERIOD_ONE_DAY = 'ONE_DAY',
PERIOD_ONE_WEEK = 'ONE_WEEK',
PERIOD_ONE_MONTH = 'ONE_MONTH',
PERIOD_ONE_YEAR = 'ONE_YEAR',
PERIOD_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE']

Instance Attribute 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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 44

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}

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

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

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

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

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

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

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

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

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

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

end

Instance Attribute Details

#backup_typeString

[Required] The type of backup to create.

Returns:

  • (String)


23
24
25
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 23

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)


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

def offset_seconds
  @offset_seconds
end

#periodString

[Required] How often the backup should occur.

Returns:

  • (String)


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

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)


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

def retention_seconds
  @retention_seconds
end

Instance Method Details

#==(other_object) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other_object (Object)

    to be compared



108
109
110
111
112
113
114
115
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 108

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



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

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)
        self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.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_object) ⇒ Boolean

Parameters:

  • other_object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


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

def eql?(other_object)
  self == other_object
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



125
126
127
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 125

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



157
158
159
160
161
162
163
164
165
# File 'lib/oci/core/models/volume_backup_schedule.rb', line 157

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



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

def to_s
  to_hash.to_s
end