Class: OCI::Certificates::Models::CertificateBundle

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/certificates/models/certificate_bundle.rb

Overview

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

This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

CERTIFICATE_BUNDLE_TYPE_ENUM =
[
  CERTIFICATE_BUNDLE_TYPE_CERTIFICATE_CONTENT_PUBLIC_ONLY = 'CERTIFICATE_CONTENT_PUBLIC_ONLY'.freeze,
  CERTIFICATE_BUNDLE_TYPE_CERTIFICATE_CONTENT_WITH_PRIVATE_KEY = 'CERTIFICATE_CONTENT_WITH_PRIVATE_KEY'.freeze,
  CERTIFICATE_BUNDLE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
STAGES_ENUM =
[
  STAGES_CURRENT = 'CURRENT'.freeze,
  STAGES_PENDING = 'PENDING'.freeze,
  STAGES_LATEST = 'LATEST'.freeze,
  STAGES_PREVIOUS = 'PREVIOUS'.freeze,
  STAGES_DEPRECATED = 'DEPRECATED'.freeze,
  STAGES_FAILED = 'FAILED'.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 = {}) ⇒ CertificateBundle

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 155

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

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

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

  self.certificate_id = attributes[:'certificateId'] if attributes[:'certificateId']

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

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

  self.certificate_name = attributes[:'certificateName'] if attributes[:'certificateName']

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

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

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

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

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

  self.certificate_pem = attributes[:'certificatePem'] if attributes[:'certificatePem']
  self.certificate_pem = "null" if certificate_pem.nil? && !attributes.key?(:'certificatePem') # rubocop:disable Style/StringLiterals

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

  self.certificate_pem = attributes[:'certificate_pem'] if attributes[:'certificate_pem']
  self.certificate_pem = "null" if certificate_pem.nil? && !attributes.key?(:'certificatePem') && !attributes.key?(:'certificate_pem') # rubocop:disable Style/StringLiterals

  self.cert_chain_pem = attributes[:'certChainPem'] if attributes[:'certChainPem']
  self.cert_chain_pem = "null" if cert_chain_pem.nil? && !attributes.key?(:'certChainPem') # rubocop:disable Style/StringLiterals

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

  self.cert_chain_pem = attributes[:'cert_chain_pem'] if attributes[:'cert_chain_pem']
  self.cert_chain_pem = "null" if cert_chain_pem.nil? && !attributes.key?(:'certChainPem') && !attributes.key?(:'cert_chain_pem') # rubocop:disable Style/StringLiterals

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

  self.version_name = attributes[:'versionName'] if attributes[:'versionName']
  self.version_name = "null" if version_name.nil? && !attributes.key?(:'versionName') # rubocop:disable Style/StringLiterals

  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.version_name = "null" if version_name.nil? && !attributes.key?(:'versionName') && !attributes.key?(:'version_name') # rubocop:disable Style/StringLiterals

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

  self.revocation_status = attributes[:'revocationStatus'] if attributes[:'revocationStatus']

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

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

Instance Attribute Details

#cert_chain_pemString

The certificate chain (in PEM format) for the certificate bundle.

Returns:

  • (String)


58
59
60
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 58

def cert_chain_pem
  @cert_chain_pem
end

#certificate_bundle_typeString

[Required] The type of certificate bundle, which indicates whether the private key fields are included.

Returns:

  • (String)


32
33
34
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 32

def certificate_bundle_type
  @certificate_bundle_type
end

#certificate_idString

[Required] The OCID of the certificate.

Returns:

  • (String)


36
37
38
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 36

def certificate_id
  @certificate_id
end

#certificate_nameString

[Required] The name of the certificate.

Returns:

  • (String)


40
41
42
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 40

def certificate_name
  @certificate_name
end

#certificate_pemString

The certificate in PEM format.

Returns:

  • (String)


54
55
56
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 54

def certificate_pem
  @certificate_pem
end

#revocation_statusOCI::Certificates::Models::RevocationStatus



79
80
81
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 79

def revocation_status
  @revocation_status
end

#serial_numberString

[Required] A unique certificate identifier used in certificate revocation tracking, formatted as octets. Example: 03 AC FC FA CC B3 CB 02 B8 F8 DE F5 85 E7 7B FF

Returns:

  • (String)


50
51
52
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 50

def serial_number
  @serial_number
end

#stagesArray<String>

[Required] A list of rotation states for the certificate bundle.

Returns:

  • (Array<String>)


76
77
78
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 76

def stages
  @stages
end

#time_createdDateTime

[Required] An optional property indicating when the certificate version was created, expressed in RFC 3339 timestamp format. Example: 2019-04-03T21:10:29.600Z

Returns:

  • (DateTime)


64
65
66
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 64

def time_created
  @time_created
end

#validityOCI::Certificates::Models::Validity

This attribute is required.



68
69
70
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 68

def validity
  @validity
end

#version_nameString

The name of the certificate version.

Returns:

  • (String)


72
73
74
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 72

def version_name
  @version_name
end

#version_numberInteger

[Required] The version number of the certificate.

Returns:

  • (Integer)


44
45
46
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 44

def version_number
  @version_number
end

Class Method Details

.attribute_mapObject

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



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 82

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'certificate_bundle_type': :'certificateBundleType',
    'certificate_id': :'certificateId',
    'certificate_name': :'certificateName',
    'version_number': :'versionNumber',
    'serial_number': :'serialNumber',
    'certificate_pem': :'certificatePem',
    'cert_chain_pem': :'certChainPem',
    'time_created': :'timeCreated',
    'validity': :'validity',
    'version_name': :'versionName',
    'stages': :'stages',
    'revocation_status': :'revocationStatus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



126
127
128
129
130
131
132
133
134
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 126

def self.get_subtype(object_hash)
  type = object_hash[:'certificateBundleType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::Certificates::Models::CertificateBundlePublicOnly' if type == 'CERTIFICATE_CONTENT_PUBLIC_ONLY'
  return 'OCI::Certificates::Models::CertificateBundleWithPrivateKey' if type == 'CERTIFICATE_CONTENT_WITH_PRIVATE_KEY'

  # TODO: Log a warning when the subtype is not found.
  'OCI::Certificates::Models::CertificateBundle'
end

.swagger_typesObject

Attribute type mapping.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 102

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'certificate_bundle_type': :'String',
    'certificate_id': :'String',
    'certificate_name': :'String',
    'version_number': :'Integer',
    'serial_number': :'String',
    'certificate_pem': :'String',
    'cert_chain_pem': :'String',
    'time_created': :'DateTime',
    'validity': :'OCI::Certificates::Models::Validity',
    'version_name': :'String',
    'stages': :'Array<String>',
    'revocation_status': :'OCI::Certificates::Models::RevocationStatus'
    # 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



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 272

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

  self.class == other.class &&
    certificate_bundle_type == other.certificate_bundle_type &&
    certificate_id == other.certificate_id &&
    certificate_name == other.certificate_name &&
    version_number == other.version_number &&
    serial_number == other.serial_number &&
    certificate_pem == other.certificate_pem &&
    cert_chain_pem == other.cert_chain_pem &&
    time_created == other.time_created &&
    validity == other.validity &&
    version_name == other.version_name &&
    stages == other.stages &&
    revocation_status == other.revocation_status
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



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 313

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


293
294
295
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 293

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



302
303
304
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 302

def hash
  [certificate_bundle_type, certificate_id, certificate_name, version_number, serial_number, certificate_pem, cert_chain_pem, time_created, validity, version_name, stages, revocation_status].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



346
347
348
349
350
351
352
353
354
355
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 346

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



340
341
342
# File 'lib/oci/certificates/models/certificate_bundle.rb', line 340

def to_s
  to_hash.to_s
end