Class: OCI::Nosql::Models::KmsKey

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/nosql/models/kms_key.rb

Overview

Information about the state of the service's encryption key management. The following properties are read-only and ignored when this object is used in UpdateConfiguration: kmsKeyState, timeCreated, timeUpdated.

Constant Summary collapse

KMS_KEY_STATE_ENUM =
[
  KMS_KEY_STATE_UPDATING = 'UPDATING'.freeze,
  KMS_KEY_STATE_ACTIVE = 'ACTIVE'.freeze,
  KMS_KEY_STATE_DELETED = 'DELETED'.freeze,
  KMS_KEY_STATE_FAILED = 'FAILED'.freeze,
  KMS_KEY_STATE_REVERTING = 'REVERTING'.freeze,
  KMS_KEY_STATE_DISABLED = 'DISABLED'.freeze,
  KMS_KEY_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ KmsKey

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 property

  • :kms_vault_id (String)

    The value to assign to the #kms_vault_id property

  • :kms_key_state (String)

    The value to assign to the #kms_key_state property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_updated (DateTime)

    The value to assign to the #time_updated property



95
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
# File 'lib/oci/nosql/models/kms_key.rb', line 95

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

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

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

  self.kms_key_state = attributes[:'kmsKeyState'] if attributes[:'kmsKeyState']

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

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated']

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

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

Instance Attribute Details

#idString

The OCID of the KMS encryption key assigned to this Hosted Environment. If the Hosted Environment is using an Oracle-managed Key, then the id will be a null string..

Returns:

  • (String)


30
31
32
# File 'lib/oci/nosql/models/kms_key.rb', line 30

def id
  @id
end

#kms_key_stateString

The current state of the encryption key assigned to this Hosted Environment. Oracle-managed keys will always report an ACTIVE state.

Returns:

  • (String)


45
46
47
# File 'lib/oci/nosql/models/kms_key.rb', line 45

def kms_key_state
  @kms_key_state
end

#kms_vault_idString

The OCID of the vault containing the encryption key assigned to this Hosted Environment. If the Hosted Environment is using an Oracle-managed Key, then the kmsVaultId will be a null string.

Returns:

  • (String)


38
39
40
# File 'lib/oci/nosql/models/kms_key.rb', line 38

def kms_vault_id
  @kms_vault_id
end

#time_createdDateTime

The timestamp when encryption key was first enabled for this Hosted Environment. RFC3339 formatted.

Returns:

  • (DateTime)


51
52
53
# File 'lib/oci/nosql/models/kms_key.rb', line 51

def time_created
  @time_created
end

#time_updatedDateTime

The timestamp of the last update to the encryption key status. RFC3339 formatted.

Returns:

  • (DateTime)


56
57
58
# File 'lib/oci/nosql/models/kms_key.rb', line 56

def time_updated
  @time_updated
end

Class Method Details

.attribute_mapObject

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



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/oci/nosql/models/kms_key.rb', line 59

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'kms_vault_id': :'kmsVaultId',
    'kms_key_state': :'kmsKeyState',
    'time_created': :'timeCreated',
    'time_updated': :'timeUpdated'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
# File 'lib/oci/nosql/models/kms_key.rb', line 72

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'kms_vault_id': :'String',
    'kms_key_state': :'String',
    'time_created': :'DateTime',
    'time_updated': :'DateTime'
    # 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



148
149
150
151
152
153
154
155
156
157
# File 'lib/oci/nosql/models/kms_key.rb', line 148

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

  self.class == other.class &&
    id == other.id &&
    kms_vault_id == other.kms_vault_id &&
    kms_key_state == other.kms_key_state &&
    time_created == other.time_created &&
    time_updated == other.time_updated
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



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/nosql/models/kms_key.rb', line 182

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


162
163
164
# File 'lib/oci/nosql/models/kms_key.rb', line 162

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



171
172
173
# File 'lib/oci/nosql/models/kms_key.rb', line 171

def hash
  [id, kms_vault_id, kms_key_state, time_created, time_updated].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



215
216
217
218
219
220
221
222
223
224
# File 'lib/oci/nosql/models/kms_key.rb', line 215

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



209
210
211
# File 'lib/oci/nosql/models/kms_key.rb', line 209

def to_s
  to_hash.to_s
end