Class: OCI::Secrets::Models::SecretBundle

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/secrets/models/secret_bundle.rb

Overview

The contents of the secret, properties of the secret (and secret version), and user-provided contextual metadata for the secret.

Constant Summary collapse

STAGES_ENUM =
[
  STAGES_CURRENT = 'CURRENT'.freeze,
  STAGES_PENDING = 'PENDING'.freeze,
  STAGES_LATEST = 'LATEST'.freeze,
  STAGES_PREVIOUS = 'PREVIOUS'.freeze,
  STAGES_DEPRECATED = 'DEPRECATED'.freeze,
  STAGES_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ SecretBundle

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
155
156
157
158
159
160
161
162
# File 'lib/oci/secrets/models/secret_bundle.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.secret_id = attributes[:'secretId'] if attributes[:'secretId']

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

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

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

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

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

  self.version_name = attributes[:'versionName'] if attributes[:'versionName']

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

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

  self.secret_bundle_content = attributes[:'secretBundleContent'] if attributes[:'secretBundleContent']

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

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

  self.time_of_deletion = attributes[:'timeOfDeletion'] if attributes[:'timeOfDeletion']

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

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

  self.time_of_expiry = attributes[:'timeOfExpiry'] if attributes[:'timeOfExpiry']

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

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

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

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

Instance Attribute Details

#metadataHash<String, Object>

Customer-provided contextual metadata for the secret.

Returns:

  • (Hash<String, Object>)


60
61
62
# File 'lib/oci/secrets/models/secret_bundle.rb', line 60

def 
  @metadata
end

#secret_bundle_contentOCI::Secrets::Models::SecretBundleContentDetails



39
40
41
# File 'lib/oci/secrets/models/secret_bundle.rb', line 39

def secret_bundle_content
  @secret_bundle_content
end

#secret_idString

[Required] The OCID of the secret.

Returns:

  • (String)


23
24
25
# File 'lib/oci/secrets/models/secret_bundle.rb', line 23

def secret_id
  @secret_id
end

#stagesArray<String>

A list of possible rotation states for the secret version.

Returns:

  • (Array<String>)


55
56
57
# File 'lib/oci/secrets/models/secret_bundle.rb', line 55

def stages
  @stages
end

#time_createdDateTime

The time when the secret bundle was created.

Returns:

  • (DateTime)


27
28
29
# File 'lib/oci/secrets/models/secret_bundle.rb', line 27

def time_created
  @time_created
end

#time_of_deletionDateTime

An optional property indicating when to delete the secret version, expressed in RFC 3339 timestamp format. Example: 2019-04-03T21:10:29.600Z

Returns:

  • (DateTime)


45
46
47
# File 'lib/oci/secrets/models/secret_bundle.rb', line 45

def time_of_deletion
  @time_of_deletion
end

#time_of_expiryDateTime

An optional property indicating when the secret version will expire, expressed in RFC 3339 timestamp format. Example: 2019-04-03T21:10:29.600Z

Returns:

  • (DateTime)


51
52
53
# File 'lib/oci/secrets/models/secret_bundle.rb', line 51

def time_of_expiry
  @time_of_expiry
end

#version_nameString

The name of the secret version. Labels are unique across the different versions of a particular secret.

Returns:

  • (String)


36
37
38
# File 'lib/oci/secrets/models/secret_bundle.rb', line 36

def version_name
  @version_name
end

#version_numberInteger

[Required] The version number of the secret.

Returns:

  • (Integer)


31
32
33
# File 'lib/oci/secrets/models/secret_bundle.rb', line 31

def version_number
  @version_number
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'secret_id': :'secretId',
    'time_created': :'timeCreated',
    'version_number': :'versionNumber',
    'version_name': :'versionName',
    'secret_bundle_content': :'secretBundleContent',
    'time_of_deletion': :'timeOfDeletion',
    'time_of_expiry': :'timeOfExpiry',
    'stages': :'stages',
    'metadata': :'metadata'
    # 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
# File 'lib/oci/secrets/models/secret_bundle.rb', line 80

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'secret_id': :'String',
    'time_created': :'DateTime',
    'version_number': :'Integer',
    'version_name': :'String',
    'secret_bundle_content': :'OCI::Secrets::Models::SecretBundleContentDetails',
    'time_of_deletion': :'DateTime',
    'time_of_expiry': :'DateTime',
    'stages': :'Array<String>',
    'metadata': :'Hash<String, Object>'
    # 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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
# File 'lib/oci/secrets/models/secret_bundle.rb', line 191

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

  self.class == other.class &&
    secret_id == other.secret_id &&
    time_created == other.time_created &&
    version_number == other.version_number &&
    version_name == other.version_name &&
    secret_bundle_content == other.secret_bundle_content &&
    time_of_deletion == other.time_of_deletion &&
    time_of_expiry == other.time_of_expiry &&
    stages == other.stages &&
     == other.
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



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

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


209
210
211
# File 'lib/oci/secrets/models/secret_bundle.rb', line 209

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



218
219
220
# File 'lib/oci/secrets/models/secret_bundle.rb', line 218

def hash
  [secret_id, time_created, version_number, version_name, secret_bundle_content, time_of_deletion, time_of_expiry, stages, ].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



262
263
264
265
266
267
268
269
270
271
# File 'lib/oci/secrets/models/secret_bundle.rb', line 262

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



256
257
258
# File 'lib/oci/secrets/models/secret_bundle.rb', line 256

def to_s
  to_hash.to_s
end