Class: OCI::TenantManagerControlPlane::Models::CloudAssignedSubscriptionSummary

Inherits:
AssignedSubscriptionSummary show all
Defined in:
lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb

Overview

Summary of assigned subscription information.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_NEEDS_ATTENTION = 'NEEDS_ATTENTION'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Constants inherited from AssignedSubscriptionSummary

AssignedSubscriptionSummary::ENTITY_VERSION_ENUM

Instance Attribute Summary collapse

Attributes inherited from AssignedSubscriptionSummary

#compartment_id, #defined_tags, #entity_version, #freeform_tags, #id, #service_name, #time_created, #time_updated

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AssignedSubscriptionSummary

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ CloudAssignedSubscriptionSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id proprety

  • :compartment_id (String)

    The value to assign to the #compartment_id proprety

  • :service_name (String)

    The value to assign to the #service_name proprety

  • :time_created (DateTime)

    The value to assign to the #time_created proprety

  • :time_updated (DateTime)

    The value to assign to the #time_updated proprety

  • :freeform_tags (Hash<String, String>)

    The value to assign to the #freeform_tags proprety

  • :defined_tags (Hash<String, Hash<String, Object>>)

    The value to assign to the #defined_tags proprety

  • :subscription_number (String)

    The value to assign to the #subscription_number property

  • :currency_code (String)

    The value to assign to the #currency_code property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 88

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['entityVersion'] = 'V2'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.subscription_number = attributes[:'subscriptionNumber'] if attributes[:'subscriptionNumber']

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

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

  self.currency_code = attributes[:'currencyCode'] if attributes[:'currencyCode']

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

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

  self.lifecycle_state = attributes[:'lifecycleState'] if attributes[:'lifecycleState']

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

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

Instance Attribute Details

#currency_codeString

[Required] Currency code. For example USD, MXN.

Returns:

  • (String)


28
29
30
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 28

def currency_code
  @currency_code
end

#lifecycle_stateString

[Required] Lifecycle state of the subscription.

Returns:

  • (String)


32
33
34
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 32

def lifecycle_state
  @lifecycle_state
end

#subscription_numberString

[Required] Unique Oracle Cloud Subscriptions identifier that is immutable on creation.

Returns:

  • (String)


24
25
26
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 24

def subscription_number
  @subscription_number
end

Class Method Details

.attribute_mapObject

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



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 35

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'entity_version': :'entityVersion',
    'id': :'id',
    'compartment_id': :'compartmentId',
    'service_name': :'serviceName',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated',
    'freeform_tags': :'freeformTags',
    'defined_tags': :'definedTags',
    'subscription_number': :'subscriptionNumber',
    'currency_code': :'currencyCode',
    'lifecycle_state': :'lifecycleState'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 54

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'entity_version': :'String',
    'id': :'String',
    'compartment_id': :'String',
    'service_name': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime',
    'freeform_tags': :'Hash<String, String>',
    'defined_tags': :'Hash<String, Hash<String, Object>>',
    'subscription_number': :'String',
    'currency_code': :'String',
    'lifecycle_state': :'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



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 137

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

  self.class == other.class &&
    entity_version == other.entity_version &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    service_name == other.service_name &&
    time_created == other.time_created &&
    time_updated == other.time_updated &&
    freeform_tags == other.freeform_tags &&
    defined_tags == other.defined_tags &&
    subscription_number == other.subscription_number &&
    currency_code == other.currency_code &&
    lifecycle_state == other.lifecycle_state
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



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 177

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


157
158
159
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 157

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



166
167
168
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 166

def hash
  [entity_version, id, compartment_id, service_name, time_created, time_updated, freeform_tags, defined_tags, subscription_number, currency_code, lifecycle_state].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



210
211
212
213
214
215
216
217
218
219
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 210

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



204
205
206
# File 'lib/oci/tenant_manager_control_plane/models/cloud_assigned_subscription_summary.rb', line 204

def to_s
  to_hash.to_s
end