Class: OCI::Multicloud::Models::CloudServiceProviderMetadataItem

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb

Overview

Cloud Service Provider metadata item. Warning - In future this object can change to generic object with future Cloud Service Provider based on CloudServiceProvider field. This can be one of CSP provider type Azure, GCP and AWS.

This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

SUBSCRIPTION_TYPE_ENUM =
[
  SUBSCRIPTION_TYPE_ORACLEDBATAZURE = 'ORACLEDBATAZURE'.freeze,
  SUBSCRIPTION_TYPE_ORACLEDBATGOOGLE = 'ORACLEDBATGOOGLE'.freeze,
  SUBSCRIPTION_TYPE_ORACLEDBATAWS = 'ORACLEDBATAWS'.freeze,
  SUBSCRIPTION_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CloudServiceProviderMetadataItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
150
151
152
153
154
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 111

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

  self.resource_anchor_name = attributes[:'resourceAnchorName'] if attributes[:'resourceAnchorName']

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

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

  self.csp_resource_anchor_id = attributes[:'cspResourceAnchorId'] if attributes[:'cspResourceAnchorId']

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

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

  self.csp_resource_anchor_name = attributes[:'cspResourceAnchorName'] if attributes[:'cspResourceAnchorName']

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

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

  self.resource_anchor_uri = attributes[:'resourceAnchorUri'] if attributes[:'resourceAnchorUri']

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

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

  self.csp_additional_properties = attributes[:'cspAdditionalProperties'] if attributes[:'cspAdditionalProperties']

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

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

  self.subscription_type = attributes[:'subscriptionType'] if attributes[:'subscriptionType']

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

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

Instance Attribute Details

#csp_additional_propertiesHash<String, String>

CSP Specific Additional Properties, AzureSubnetId for Azure

Returns:

  • (Hash<String, String>)


45
46
47
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 45

def csp_additional_properties
  @csp_additional_properties
end

#csp_resource_anchor_idString

CSP resource anchor ID.

Returns:

  • (String)


33
34
35
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 33

def csp_resource_anchor_id
  @csp_resource_anchor_id
end

#csp_resource_anchor_nameString

CSP resource anchor name.

Returns:

  • (String)


37
38
39
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 37

def csp_resource_anchor_name
  @csp_resource_anchor_name
end

#regionString

The Azure, AWS or GCP region.

Returns:

  • (String)


25
26
27
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 25

def region
  @region
end

#resource_anchor_nameString

[Required] OCI resource anchor name.

Returns:

  • (String)


29
30
31
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 29

def resource_anchor_name
  @resource_anchor_name
end

#resource_anchor_uriString

CSP resource anchor Uri.

Returns:

  • (String)


41
42
43
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 41

def resource_anchor_uri
  @resource_anchor_uri
end

#subscription_typeString

[Required] Oracle Cloud Infrastructure Subscription Type.

Returns:

  • (String)


49
50
51
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 49

def subscription_type
  @subscription_type
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'region': :'region',
    'resource_anchor_name': :'resourceAnchorName',
    'csp_resource_anchor_id': :'cspResourceAnchorId',
    'csp_resource_anchor_name': :'cspResourceAnchorName',
    'resource_anchor_uri': :'resourceAnchorUri',
    'csp_additional_properties': :'cspAdditionalProperties',
    'subscription_type': :'subscriptionType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



86
87
88
89
90
91
92
93
94
95
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 86

def self.get_subtype(object_hash)
  type = object_hash[:'subscriptionType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::Multicloud::Models::AzureCloudServiceProviderMetadataItem' if type == 'ORACLEDBATAZURE'
  return 'OCI::Multicloud::Models::GcpCloudServiceProviderMetadataItem' if type == 'ORACLEDBATGOOGLE'
  return 'OCI::Multicloud::Models::AwsCloudServiceProviderMetadataItem' if type == 'ORACLEDBATAWS'

  # TODO: Log a warning when the subtype is not found.
  'OCI::Multicloud::Models::CloudServiceProviderMetadataItem'
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'region': :'String',
    'resource_anchor_name': :'String',
    'csp_resource_anchor_id': :'String',
    'csp_resource_anchor_name': :'String',
    'resource_anchor_uri': :'String',
    'csp_additional_properties': :'Hash<String, String>',
    'subscription_type': :'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



176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 176

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

  self.class == other.class &&
    region == other.region &&
    resource_anchor_name == other.resource_anchor_name &&
    csp_resource_anchor_id == other.csp_resource_anchor_id &&
    csp_resource_anchor_name == other.csp_resource_anchor_name &&
    resource_anchor_uri == other.resource_anchor_uri &&
    csp_additional_properties == other.csp_additional_properties &&
    subscription_type == other.subscription_type
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



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 212

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


192
193
194
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 192

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



201
202
203
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 201

def hash
  [region, resource_anchor_name, csp_resource_anchor_id, csp_resource_anchor_name, resource_anchor_uri, csp_additional_properties, subscription_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



245
246
247
248
249
250
251
252
253
254
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 245

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



239
240
241
# File 'lib/oci/multicloud/models/cloud_service_provider_metadata_item.rb', line 239

def to_s
  to_hash.to_s
end