Class: OCI::Blockchain::Models::ScaleBlockchainPlatformDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/blockchain/models/scale_blockchain_platform_details.rb

Overview

Scale operation details for a blockchain platform. The scale operation payload has multiple options - Add one or more Ordering Service Node (addOsns) - Add one or more Peers (addPeers) - Add more replicas of CA, Console and Rest Proxy (addReplicas) - Add more storage to the platform (addStorage) - Modify the CPU allocation for Peer Nodes (modifyPeers) - Remove one or more replicas of CA, Console and Rest Proxy (removeReplicas) - Remove one or more Ordering Service Node (removeOsns) - Remove one or more Peers (removePeers). The scale operation payload must have at least one of the above options.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ScaleBlockchainPlatformDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 96

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

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

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

  self.add_replicas = attributes[:'addReplicas'] if attributes[:'addReplicas']

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

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

  self.add_peers = attributes[:'addPeers'] if attributes[:'addPeers']

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

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

  self.add_storage = attributes[:'addStorage'] if attributes[:'addStorage']

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

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

  self.modify_peers = attributes[:'modifyPeers'] if attributes[:'modifyPeers']

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

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

  self.remove_replicas = attributes[:'removeReplicas'] if attributes[:'removeReplicas']

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

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

  self.remove_osns = attributes[:'removeOsns'] if attributes[:'removeOsns']

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

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

  self.remove_peers = attributes[:'removePeers'] if attributes[:'removePeers']

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

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

Instance Attribute Details

#add_osnsArray<OCI::Blockchain::Models::CreateOsnDetails>

new OSNs to add



23
24
25
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 23

def add_osns
  @add_osns
end

#add_peersArray<OCI::Blockchain::Models::CreatePeerDetails>

new Peers to add



30
31
32
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 30

def add_peers
  @add_peers
end

#add_replicasOCI::Blockchain::Models::ReplicaDetails



26
27
28
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 26

def add_replicas
  @add_replicas
end

#add_storageOCI::Blockchain::Models::ScaleStorageDetails



33
34
35
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 33

def add_storage
  @add_storage
end

#modify_peersArray<OCI::Blockchain::Models::ModifyPeerDetails>

modify ocpu allocation to existing Peers



37
38
39
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 37

def modify_peers
  @modify_peers
end

#remove_osnsArray<String>

OSN id list to remove

Returns:

  • (Array<String>)


44
45
46
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 44

def remove_osns
  @remove_osns
end

#remove_peersArray<String>

Peer id list to remove

Returns:

  • (Array<String>)


48
49
50
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 48

def remove_peers
  @remove_peers
end

#remove_replicasOCI::Blockchain::Models::ReplicaDetails



40
41
42
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 40

def remove_replicas
  @remove_replicas
end

Class Method Details

.attribute_mapObject

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



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 51

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'add_osns': :'addOsns',
    'add_replicas': :'addReplicas',
    'add_peers': :'addPeers',
    'add_storage': :'addStorage',
    'modify_peers': :'modifyPeers',
    'remove_replicas': :'removeReplicas',
    'remove_osns': :'removeOsns',
    'remove_peers': :'removePeers'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 67

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'add_osns': :'Array<OCI::Blockchain::Models::CreateOsnDetails>',
    'add_replicas': :'OCI::Blockchain::Models::ReplicaDetails',
    'add_peers': :'Array<OCI::Blockchain::Models::CreatePeerDetails>',
    'add_storage': :'OCI::Blockchain::Models::ScaleStorageDetails',
    'modify_peers': :'Array<OCI::Blockchain::Models::ModifyPeerDetails>',
    'remove_replicas': :'OCI::Blockchain::Models::ReplicaDetails',
    'remove_osns': :'Array<String>',
    'remove_peers': :'Array<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



158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 158

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

  self.class == other.class &&
    add_osns == other.add_osns &&
    add_replicas == other.add_replicas &&
    add_peers == other.add_peers &&
    add_storage == other.add_storage &&
    modify_peers == other.modify_peers &&
    remove_replicas == other.remove_replicas &&
    remove_osns == other.remove_osns &&
    remove_peers == other.remove_peers
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



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 195

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


175
176
177
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 175

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



184
185
186
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 184

def hash
  [add_osns, add_replicas, add_peers, add_storage, modify_peers, remove_replicas, remove_osns, remove_peers].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



228
229
230
231
232
233
234
235
236
237
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 228

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



222
223
224
# File 'lib/oci/blockchain/models/scale_blockchain_platform_details.rb', line 222

def to_s
  to_hash.to_s
end