Class: OCI::FusionApps::Models::Subscription

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/fusion_apps/models/subscription.rb

Overview

Subscription information for compartmentId. Only root compartments are allowed.

Constant Summary collapse

LIFECYCLE_STATE_ENUM =
[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_UPDATING = 'UPDATING'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_FAILED = 'FAILED'.freeze,
  LIFECYCLE_STATE_NEEDS_ATTENTION = 'NEEDS_ATTENTION'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
LIFECYCLE_DETAILS_ENUM =
[
  LIFECYCLE_DETAILS_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_DETAILS_PURGED = 'PURGED'.freeze,
  LIFECYCLE_DETAILS_CANCELED = 'CANCELED'.freeze,
  LIFECYCLE_DETAILS_PAID_PURGED = 'PAID_PURGED'.freeze,
  LIFECYCLE_DETAILS_INITIALIZED = 'INITIALIZED'.freeze,
  LIFECYCLE_DETAILS_SOFT_TERMINATED = 'SOFT_TERMINATED'.freeze,
  LIFECYCLE_DETAILS_DISABLED = 'DISABLED'.freeze,
  LIFECYCLE_DETAILS_BEGIN_TERMINATION = 'BEGIN_TERMINATION'.freeze,
  LIFECYCLE_DETAILS_MIGRATED = 'MIGRATED'.freeze,
  LIFECYCLE_DETAILS_PENDING_CANCELATION = 'PENDING_CANCELATION'.freeze,
  LIFECYCLE_DETAILS_ARCHIVED = 'ARCHIVED'.freeze,
  LIFECYCLE_DETAILS_NON_RECOVERABLE = 'NON_RECOVERABLE'.freeze,
  LIFECYCLE_DETAILS_BEGIN_SOFT_TERMINATION = 'BEGIN_SOFT_TERMINATION'.freeze,
  LIFECYCLE_DETAILS_ACTIVATED = 'ACTIVATED'.freeze,
  LIFECYCLE_DETAILS_ACCESS_DISABLED = 'ACCESS_DISABLED'.freeze,
  LIFECYCLE_DETAILS_PENDING_REGISTRATION = 'PENDING_REGISTRATION'.freeze,
  LIFECYCLE_DETAILS_TERMINATED = 'TERMINATED'.freeze,
  LIFECYCLE_DETAILS_RELOCATING = 'RELOCATING'.freeze,
  LIFECYCLE_DETAILS_DEPROVISIONED = 'DEPROVISIONED'.freeze,
  LIFECYCLE_DETAILS_PROVISIONED = 'PROVISIONED'.freeze,
  LIFECYCLE_DETAILS_BEGIN_TERMINATION_PASSIVE = 'BEGIN_TERMINATION_PASSIVE'.freeze,
  LIFECYCLE_DETAILS_LOCKED = 'LOCKED'.freeze,
  LIFECYCLE_DETAILS_PENDING_DEPROVISIONING = 'PENDING_DEPROVISIONING'.freeze,
  LIFECYCLE_DETAILS_REGISTERED = 'REGISTERED'.freeze,
  LIFECYCLE_DETAILS_CANCELLED = 'CANCELLED'.freeze,
  LIFECYCLE_DETAILS_EXPIRED = 'EXPIRED'.freeze,
  LIFECYCLE_DETAILS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Subscription

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



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
# File 'lib/oci/fusion_apps/models/subscription.rb', line 118

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

  self.classic_subscription_id = attributes[:'classicSubscriptionId'] if attributes[:'classicSubscriptionId']

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

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

  self.service_name = attributes[:'serviceName'] if attributes[:'serviceName']

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

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

  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']

  self.lifecycle_details = attributes[:'lifecycleDetails'] if attributes[:'lifecycleDetails']

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

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

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

Instance Attribute Details

#classic_subscription_idString

[Required] Subscription id.

Returns:

  • (String)


60
61
62
# File 'lib/oci/fusion_apps/models/subscription.rb', line 60

def classic_subscription_id
  @classic_subscription_id
end

#idString

[Required] OCID of the subscription details for particular root compartment or tenancy.

Returns:

  • (String)


56
57
58
# File 'lib/oci/fusion_apps/models/subscription.rb', line 56

def id
  @id
end

#lifecycle_detailsString

Subscription resource intermediate states.

Returns:

  • (String)


72
73
74
# File 'lib/oci/fusion_apps/models/subscription.rb', line 72

def lifecycle_details
  @lifecycle_details
end

#lifecycle_stateString

Lifecycle state of the subscription.

Returns:

  • (String)


68
69
70
# File 'lib/oci/fusion_apps/models/subscription.rb', line 68

def lifecycle_state
  @lifecycle_state
end

#service_nameString

[Required] The type of subscription, such as 'CLOUDCM'/'SAAS'/'CRM', etc.

Returns:

  • (String)


64
65
66
# File 'lib/oci/fusion_apps/models/subscription.rb', line 64

def service_name
  @service_name
end

#skusArray<OCI::FusionApps::Models::SubscriptionSku>

[Required] Stock keeping unit.



76
77
78
# File 'lib/oci/fusion_apps/models/subscription.rb', line 76

def skus
  @skus
end

Class Method Details

.attribute_mapObject

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



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/oci/fusion_apps/models/subscription.rb', line 79

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'classic_subscription_id': :'classicSubscriptionId',
    'service_name': :'serviceName',
    'lifecycle_state': :'lifecycleState',
    'lifecycle_details': :'lifecycleDetails',
    'skus': :'skus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/oci/fusion_apps/models/subscription.rb', line 93

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'classic_subscription_id': :'String',
    'service_name': :'String',
    'lifecycle_state': :'String',
    'lifecycle_details': :'String',
    'skus': :'Array<OCI::FusionApps::Models::SubscriptionSku>'
    # 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



186
187
188
189
190
191
192
193
194
195
196
# File 'lib/oci/fusion_apps/models/subscription.rb', line 186

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

  self.class == other.class &&
    id == other.id &&
    classic_subscription_id == other.classic_subscription_id &&
    service_name == other.service_name &&
    lifecycle_state == other.lifecycle_state &&
    lifecycle_details == other.lifecycle_details &&
    skus == other.skus
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



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/oci/fusion_apps/models/subscription.rb', line 221

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


201
202
203
# File 'lib/oci/fusion_apps/models/subscription.rb', line 201

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



210
211
212
# File 'lib/oci/fusion_apps/models/subscription.rb', line 210

def hash
  [id, classic_subscription_id, service_name, lifecycle_state, lifecycle_details, skus].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



254
255
256
257
258
259
260
261
262
263
# File 'lib/oci/fusion_apps/models/subscription.rb', line 254

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



248
249
250
# File 'lib/oci/fusion_apps/models/subscription.rb', line 248

def to_s
  to_hash.to_s
end