Class: VSphereAutomation::VCenter::VcenterCertificateManagementVcenterTlsInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VcenterCertificateManagementVcenterTlsInfo

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 98

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 }

  if attributes.has_key?(:'version')
    self.version = attributes[:'version']
  end

  if attributes.has_key?(:'serial_number')
    self.serial_number = attributes[:'serial_number']
  end

  if attributes.has_key?(:'signature_algorithm')
    self.signature_algorithm = attributes[:'signature_algorithm']
  end

  if attributes.has_key?(:'issuer_dn')
    self.issuer_dn = attributes[:'issuer_dn']
  end

  if attributes.has_key?(:'valid_from')
    self.valid_from = attributes[:'valid_from']
  end

  if attributes.has_key?(:'valid_to')
    self.valid_to = attributes[:'valid_to']
  end

  if attributes.has_key?(:'subject_dn')
    self.subject_dn = attributes[:'subject_dn']
  end

  if attributes.has_key?(:'thumbprint')
    self.thumbprint = attributes[:'thumbprint']
  end

  if attributes.has_key?(:'basic_constraints')
    self.basic_constraints = attributes[:'basic_constraints']
  end

  if attributes.has_key?(:'key_usage')
    if (value = attributes[:'key_usage']).is_a?(Array)
      self.key_usage = value
    end
  end

  if attributes.has_key?(:'extended_key_usage')
    if (value = attributes[:'extended_key_usage']).is_a?(Array)
      self.extended_key_usage = value
    end
  end

  if attributes.has_key?(:'subject_alternative_name')
    if (value = attributes[:'subject_alternative_name']).is_a?(Array)
      self.subject_alternative_name = value
    end
  end

  if attributes.has_key?(:'authority_information_access_uri')
    if (value = attributes[:'authority_information_access_uri']).is_a?(Array)
      self.authority_information_access_uri = value
    end
  end

  if attributes.has_key?(:'cert')
    self.cert = attributes[:'cert']
  end
end

Instance Attribute Details

#authority_information_access_uriObject

Collection of authority information access URI.



51
52
53
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 51

def authority_information_access_uri
  @authority_information_access_uri
end

#basic_constraintsObject

Certificate constraints path length from the critical BasicConstraints extension, (OID = 2.5.29.19).



39
40
41
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 39

def basic_constraints
  @basic_constraints
end

#certObject

TLS certificate in PEM format.



54
55
56
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 54

def cert
  @cert
end

#extended_key_usageObject

Collection of extended keyusage that contains details for which the certificate can be used for.



45
46
47
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 45

def extended_key_usage
  @extended_key_usage
end

#issuer_dnObject

Issuer (issuer distinguished name) value from the certificate.



24
25
26
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 24

def issuer_dn
  @issuer_dn
end

#key_usageObject

Collection of keyusage contained in the certificate.



42
43
44
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 42

def key_usage
  @key_usage
end

#serial_numberObject

SerialNumber value from the certificate.



18
19
20
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 18

def serial_number
  @serial_number
end

#signature_algorithmObject

Signature algorithm name from the certificate.



21
22
23
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 21

def signature_algorithm
  @signature_algorithm
end

#subject_alternative_nameObject

Collection of subject alternative names.



48
49
50
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 48

def subject_alternative_name
  @subject_alternative_name
end

#subject_dnObject

Subject (subject distinguished name) value from the certificate.



33
34
35
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 33

def subject_dn
  @subject_dn
end

#thumbprintObject

Thumbprint value from the certificate.



36
37
38
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 36

def thumbprint
  @thumbprint
end

#valid_fromObject

validFrom specify the start date of the certificate.



27
28
29
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 27

def valid_from
  @valid_from
end

#valid_toObject

validTo specify the end date of the certificate.



30
31
32
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 30

def valid_to
  @valid_to
end

#versionObject

Version (version number) value from the certificate.



15
16
17
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 15

def version
  @version
end

Class Method Details

.attribute_mapObject

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



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 57

def self.attribute_map
  {
    :'version' => :'version',
    :'serial_number' => :'serial_number',
    :'signature_algorithm' => :'signature_algorithm',
    :'issuer_dn' => :'issuer_dn',
    :'valid_from' => :'valid_from',
    :'valid_to' => :'valid_to',
    :'subject_dn' => :'subject_dn',
    :'thumbprint' => :'thumbprint',
    :'basic_constraints' => :'basic_constraints',
    :'key_usage' => :'key_usage',
    :'extended_key_usage' => :'extended_key_usage',
    :'subject_alternative_name' => :'subject_alternative_name',
    :'authority_information_access_uri' => :'authority_information_access_uri',
    :'cert' => :'cert'
  }
end

.openapi_typesObject

Attribute type mapping.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 77

def self.openapi_types
  {
    :'version' => :'Integer',
    :'serial_number' => :'String',
    :'signature_algorithm' => :'String',
    :'issuer_dn' => :'String',
    :'valid_from' => :'DateTime',
    :'valid_to' => :'DateTime',
    :'subject_dn' => :'String',
    :'thumbprint' => :'String',
    :'basic_constraints' => :'Integer',
    :'key_usage' => :'Array<String>',
    :'extended_key_usage' => :'Array<String>',
    :'subject_alternative_name' => :'Array<String>',
    :'authority_information_access_uri' => :'Array<String>',
    :'cert' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 254

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      version == o.version &&
      serial_number == o.serial_number &&
      signature_algorithm == o.signature_algorithm &&
      issuer_dn == o.issuer_dn &&
      valid_from == o.valid_from &&
      valid_to == o.valid_to &&
      subject_dn == o.subject_dn &&
      thumbprint == o.thumbprint &&
      basic_constraints == o.basic_constraints &&
      key_usage == o.key_usage &&
      extended_key_usage == o.extended_key_usage &&
      subject_alternative_name == o.subject_alternative_name &&
      authority_information_access_uri == o.authority_information_access_uri &&
      cert == o.cert
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 309

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN, :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = VSphereAutomation::VCenter.const_get(type).new
    temp_model.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



375
376
377
378
379
380
381
382
383
384
385
386
387
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 375

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 288

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.openapi_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/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)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(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?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


275
276
277
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 275

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



281
282
283
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 281

def hash
  [version, serial_number, signature_algorithm, issuer_dn, valid_from, valid_to, subject_dn, thumbprint, basic_constraints, key_usage, extended_key_usage, subject_alternative_name, authority_information_access_uri, cert].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



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/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 171

def list_invalid_properties
  invalid_properties = Array.new
  if @version.nil?
    invalid_properties.push('invalid value for "version", version cannot be nil.')
  end

  if @serial_number.nil?
    invalid_properties.push('invalid value for "serial_number", serial_number cannot be nil.')
  end

  if @signature_algorithm.nil?
    invalid_properties.push('invalid value for "signature_algorithm", signature_algorithm cannot be nil.')
  end

  if @issuer_dn.nil?
    invalid_properties.push('invalid value for "issuer_dn", issuer_dn cannot be nil.')
  end

  if @valid_from.nil?
    invalid_properties.push('invalid value for "valid_from", valid_from cannot be nil.')
  end

  if @valid_to.nil?
    invalid_properties.push('invalid value for "valid_to", valid_to cannot be nil.')
  end

  if @subject_dn.nil?
    invalid_properties.push('invalid value for "subject_dn", subject_dn cannot be nil.')
  end

  if @thumbprint.nil?
    invalid_properties.push('invalid value for "thumbprint", thumbprint cannot be nil.')
  end

  if @basic_constraints.nil?
    invalid_properties.push('invalid value for "basic_constraints", basic_constraints cannot be nil.')
  end

  if @key_usage.nil?
    invalid_properties.push('invalid value for "key_usage", key_usage cannot be nil.')
  end

  if @extended_key_usage.nil?
    invalid_properties.push('invalid value for "extended_key_usage", extended_key_usage cannot be nil.')
  end

  if @subject_alternative_name.nil?
    invalid_properties.push('invalid value for "subject_alternative_name", subject_alternative_name cannot be nil.')
  end

  if @authority_information_access_uri.nil?
    invalid_properties.push('invalid value for "authority_information_access_uri", authority_information_access_uri cannot be nil.')
  end

  if @cert.nil?
    invalid_properties.push('invalid value for "cert", cert cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



355
356
357
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 355

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



361
362
363
364
365
366
367
368
369
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 361

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



349
350
351
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 349

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/vsphere-automation-vcenter/models/vcenter_certificate_management_vcenter_tls_info.rb', line 234

def valid?
  return false if @version.nil?
  return false if @serial_number.nil?
  return false if @signature_algorithm.nil?
  return false if @issuer_dn.nil?
  return false if @valid_from.nil?
  return false if @valid_to.nil?
  return false if @subject_dn.nil?
  return false if @thumbprint.nil?
  return false if @basic_constraints.nil?
  return false if @key_usage.nil?
  return false if @extended_key_usage.nil?
  return false if @subject_alternative_name.nil?
  return false if @authority_information_access_uri.nil?
  return false if @cert.nil?
  true
end