Class: OCI::DisasterRecovery::Models::AssociateDrProtectionGroupDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb

Overview

The details for associating a DR protection group with a peer DR protection group.

Constant Summary collapse

ROLE_ENUM =
[
  ROLE_PRIMARY = 'PRIMARY'.freeze,
  ROLE_STANDBY = 'STANDBY'.freeze,
  ROLE_UNCONFIGURED = 'UNCONFIGURED'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AssociateDrProtectionGroupDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :peer_id (String)

    The value to assign to the #peer_id property

  • :peer_region (String)

    The value to assign to the #peer_region property

  • :role (String)

    The value to assign to the #role property



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 69

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

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

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

  self.peer_region = attributes[:'peerRegion'] if attributes[:'peerRegion']

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

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

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

Instance Attribute Details

#peer_idString

The OCID of the peer DR protection group.

Example: ocid1.drprotectiongroup.oc1..uniqueID

Returns:

  • (String)


22
23
24
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 22

def peer_id
  @peer_id
end

#peer_regionString

The region of the peer DR protection group.

Example: us-ashburn-1

Returns:

  • (String)


29
30
31
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 29

def peer_region
  @peer_region
end

#roleString

[Required] The role of the DR protection group.

Example: STANDBY

Returns:

  • (String)


36
37
38
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 36

def role
  @role
end

Class Method Details

.attribute_mapObject

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



39
40
41
42
43
44
45
46
47
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 39

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'peer_id': :'peerId',
    'peer_region': :'peerRegion',
    'role': :'role'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



50
51
52
53
54
55
56
57
58
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 50

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'peer_id': :'String',
    'peer_region': :'String',
    'role': :'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



105
106
107
108
109
110
111
112
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 105

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

  self.class == other.class &&
    peer_id == other.peer_id &&
    peer_region == other.peer_region &&
    role == other.role
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



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 137

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


117
118
119
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 117

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



126
127
128
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 126

def hash
  [peer_id, peer_region, role].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



170
171
172
173
174
175
176
177
178
179
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 170

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



164
165
166
# File 'lib/oci/disaster_recovery/models/associate_dr_protection_group_details.rb', line 164

def to_s
  to_hash.to_s
end