Class: OCI::GenerativeAi::Models::ApiKeyItem

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/generative_ai/models/api_key_item.rb

Overview

The ApiKey item.

Constant Summary collapse

STATE_ENUM =
[
  STATE_ACTIVE = 'ACTIVE'.freeze,
  STATE_INACTIVE = 'INACTIVE'.freeze,
  STATE_REVOKED = 'REVOKED'.freeze,
  STATE_EXPIRED = 'EXPIRED'.freeze,
  STATE_DELETED = 'DELETED'.freeze,
  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 = {}) ⇒ ApiKeyItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :key (String)

    The value to assign to the #key property

  • :key_name (String)

    The value to assign to the #key_name property

  • :key_mask (String)

    The value to assign to the #key_mask property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :time_expiry (DateTime)

    The value to assign to the #time_expiry property

  • :time_activated (DateTime)

    The value to assign to the #time_activated property

  • :time_deactivated (DateTime)

    The value to assign to the #time_deactivated property

  • :time_revoked (DateTime)

    The value to assign to the #time_revoked property

  • :time_last_used (DateTime)

    The value to assign to the #time_last_used property

  • :state (String)

    The value to assign to the #state property



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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 113

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

  self.key_name = attributes[:'keyName'] if attributes[:'keyName']

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

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

  self.key_mask = attributes[:'keyMask'] if attributes[:'keyMask']

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

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

  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_expiry = attributes[:'timeExpiry'] if attributes[:'timeExpiry']

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

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

  self.time_activated = attributes[:'timeActivated'] if attributes[:'timeActivated']

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

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

  self.time_deactivated = attributes[:'timeDeactivated'] if attributes[:'timeDeactivated']

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

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

  self.time_revoked = attributes[:'timeRevoked'] if attributes[:'timeRevoked']

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

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

  self.time_last_used = attributes[:'timeLastUsed'] if attributes[:'timeLastUsed']

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

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

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

Instance Attribute Details

#keyString

The key.

Returns:

  • (String)


23
24
25
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 23

def key
  @key
end

#key_maskString

[Required] The masked key.

Returns:

  • (String)


31
32
33
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 31

def key_mask
  @key_mask
end

#key_nameString

[Required] The key name.

Returns:

  • (String)


27
28
29
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 27

def key_name
  @key_name
end

#stateString

[Required] The current state of the API key item.

Returns:

  • (String)


59
60
61
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 59

def state
  @state
end

#time_activatedDateTime

The date and time that the key is activated in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


43
44
45
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 43

def time_activated
  @time_activated
end

#time_createdDateTime

[Required] The date and time that the key was created in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


35
36
37
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 35

def time_created
  @time_created
end

#time_deactivatedDateTime

The date and time that the key is deactivated in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


47
48
49
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 47

def time_deactivated
  @time_deactivated
end

#time_expiryDateTime

[Required] The date and time when the key would be expired, if not provided it would be 90 days, in the format defined by RFC 3339.

Returns:

  • (DateTime)


39
40
41
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 39

def time_expiry
  @time_expiry
end

#time_last_usedDateTime

The date and time that the key is last used in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


55
56
57
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 55

def time_last_used
  @time_last_used
end

#time_revokedDateTime

The date and time that the key is revoked in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


51
52
53
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 51

def time_revoked
  @time_revoked
end

Class Method Details

.attribute_mapObject

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



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 62

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'key_name': :'keyName',
    'key_mask': :'keyMask',
    'time_created': :'timeCreated',
    'time_expiry': :'timeExpiry',
    'time_activated': :'timeActivated',
    'time_deactivated': :'timeDeactivated',
    'time_revoked': :'timeRevoked',
    'time_last_used': :'timeLastUsed',
    'state': :'state'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 80

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'key_name': :'String',
    'key_mask': :'String',
    'time_created': :'DateTime',
    'time_expiry': :'DateTime',
    'time_activated': :'DateTime',
    'time_deactivated': :'DateTime',
    'time_revoked': :'DateTime',
    'time_last_used': :'DateTime',
    '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



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 192

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

  self.class == other.class &&
    key == other.key &&
    key_name == other.key_name &&
    key_mask == other.key_mask &&
    time_created == other.time_created &&
    time_expiry == other.time_expiry &&
    time_activated == other.time_activated &&
    time_deactivated == other.time_deactivated &&
    time_revoked == other.time_revoked &&
    time_last_used == other.time_last_used &&
    state == other.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



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 231

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


211
212
213
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 211

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



220
221
222
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 220

def hash
  [key, key_name, key_mask, time_created, time_expiry, time_activated, time_deactivated, time_revoked, time_last_used, state].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



264
265
266
267
268
269
270
271
272
273
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 264

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



258
259
260
# File 'lib/oci/generative_ai/models/api_key_item.rb', line 258

def to_s
  to_hash.to_s
end