Class: Akeyless::GenerateCsr

Inherits:
Object
  • Object
show all
Defined in:
lib/akeyless/models/generate_csr.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GenerateCsr

Initializes the object

Parameters:

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

    Model attributes in the form of hash



147
148
149
150
151
152
153
154
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
# File 'lib/akeyless/models/generate_csr.rb', line 147

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::GenerateCsr` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::GenerateCsr`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'alg')
    self.alg = attributes[:'alg']
  end

  if attributes.key?(:'alt_names')
    self.alt_names = attributes[:'alt_names']
  end

  if attributes.key?(:'certificate_type')
    self.certificate_type = attributes[:'certificate_type']
  end

  if attributes.key?(:'city')
    self.city = attributes[:'city']
  end

  if attributes.key?(:'common_name')
    self.common_name = attributes[:'common_name']
  else
    self.common_name = nil
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'critical')
    self.critical = attributes[:'critical']
  end

  if attributes.key?(:'dep')
    self.dep = attributes[:'dep']
  end

  if attributes.key?(:'email_addresses')
    self.email_addresses = attributes[:'email_addresses']
  end

  if attributes.key?(:'export_private_key')
    self.export_private_key = attributes[:'export_private_key']
  else
    self.export_private_key = false
  end

  if attributes.key?(:'generate_key')
    self.generate_key = attributes[:'generate_key']
  end

  if attributes.key?(:'ip_addresses')
    self.ip_addresses = attributes[:'ip_addresses']
  end

  if attributes.key?(:'json')
    self.json = attributes[:'json']
  else
    self.json = false
  end

  if attributes.key?(:'key_type')
    self.key_type = attributes[:'key_type']
  else
    self.key_type = 'classic-key'
  end

  if attributes.key?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

  if attributes.key?(:'org')
    self.org = attributes[:'org']
  end

  if attributes.key?(:'split_level')
    self.split_level = attributes[:'split_level']
  else
    self.split_level = 3
  end

  if attributes.key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.key?(:'token')
    self.token = attributes[:'token']
  end

  if attributes.key?(:'uid_token')
    self.uid_token = attributes[:'uid_token']
  end

  if attributes.key?(:'uri_sans')
    self.uri_sans = attributes[:'uri_sans']
  end
end

Instance Attribute Details

#algObject

Returns the value of attribute alg.



18
19
20
# File 'lib/akeyless/models/generate_csr.rb', line 18

def alg
  @alg
end

#alt_namesObject

A comma-separated list of dns alternative names



21
22
23
# File 'lib/akeyless/models/generate_csr.rb', line 21

def alt_names
  @alt_names
end

#certificate_typeObject

The certificate type to be included in the CSR certificate (ssl-client/ssl-server/certificate-signing)



24
25
26
# File 'lib/akeyless/models/generate_csr.rb', line 24

def certificate_type
  @certificate_type
end

#cityObject

The city to be included in the CSR certificate



27
28
29
# File 'lib/akeyless/models/generate_csr.rb', line 27

def city
  @city
end

#common_nameObject

The common name to be included in the CSR certificate



30
31
32
# File 'lib/akeyless/models/generate_csr.rb', line 30

def common_name
  @common_name
end

#countryObject

The country to be included in the CSR certificate



33
34
35
# File 'lib/akeyless/models/generate_csr.rb', line 33

def country
  @country
end

#criticalObject

Add critical to the key usage extension (will be false if not added)



36
37
38
# File 'lib/akeyless/models/generate_csr.rb', line 36

def critical
  @critical
end

#depObject

The department to be included in the CSR certificate



39
40
41
# File 'lib/akeyless/models/generate_csr.rb', line 39

def dep
  @dep
end

#email_addressesObject

A comma-separated list of email addresses alternative names



42
43
44
# File 'lib/akeyless/models/generate_csr.rb', line 42

def email_addresses
  @email_addresses
end

#export_private_keyObject

The flag to indicate if the private key should be exported



45
46
47
# File 'lib/akeyless/models/generate_csr.rb', line 45

def export_private_key
  @export_private_key
end

#generate_keyObject

Generate a new classic key for the csr



48
49
50
# File 'lib/akeyless/models/generate_csr.rb', line 48

def generate_key
  @generate_key
end

#ip_addressesObject

A comma-separated list of ip addresses alternative names



51
52
53
# File 'lib/akeyless/models/generate_csr.rb', line 51

def ip_addresses
  @ip_addresses
end

#jsonObject

Set output format to JSON



54
55
56
# File 'lib/akeyless/models/generate_csr.rb', line 54

def json
  @json
end

#key_typeObject

The type of the key to generate (classic-key/dfc)



57
58
59
# File 'lib/akeyless/models/generate_csr.rb', line 57

def key_type
  @key_type
end

#nameObject

The key name



60
61
62
# File 'lib/akeyless/models/generate_csr.rb', line 60

def name
  @name
end

#orgObject

The organization to be included in the CSR certificate



63
64
65
# File 'lib/akeyless/models/generate_csr.rb', line 63

def org
  @org
end

#split_levelObject

The number of fragments that the item will be split into (not includes customer fragment)



66
67
68
# File 'lib/akeyless/models/generate_csr.rb', line 66

def split_level
  @split_level
end

#stateObject

The state to be included in the CSR certificate



69
70
71
# File 'lib/akeyless/models/generate_csr.rb', line 69

def state
  @state
end

#tokenObject

Authentication token (see ‘/auth` and `/configure`)



72
73
74
# File 'lib/akeyless/models/generate_csr.rb', line 72

def token
  @token
end

#uid_tokenObject

The universal identity token, Required only for universal_identity authentication



75
76
77
# File 'lib/akeyless/models/generate_csr.rb', line 75

def uid_token
  @uid_token
end

#uri_sansObject

A comma-separated list of uri alternative names



78
79
80
# File 'lib/akeyless/models/generate_csr.rb', line 78

def uri_sans
  @uri_sans
end

Class Method Details

._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



354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
# File 'lib/akeyless/models/generate_csr.rb', line 354

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :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
    # models (e.g. Pet) or oneOf
    klass = Akeyless.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



108
109
110
# File 'lib/akeyless/models/generate_csr.rb', line 108

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/akeyless/models/generate_csr.rb', line 81

def self.attribute_map
  {
    :'alg' => :'alg',
    :'alt_names' => :'alt-names',
    :'certificate_type' => :'certificate-type',
    :'city' => :'city',
    :'common_name' => :'common-name',
    :'country' => :'country',
    :'critical' => :'critical',
    :'dep' => :'dep',
    :'email_addresses' => :'email-addresses',
    :'export_private_key' => :'export-private-key',
    :'generate_key' => :'generate-key',
    :'ip_addresses' => :'ip-addresses',
    :'json' => :'json',
    :'key_type' => :'key-type',
    :'name' => :'name',
    :'org' => :'org',
    :'split_level' => :'split-level',
    :'state' => :'state',
    :'token' => :'token',
    :'uid_token' => :'uid-token',
    :'uri_sans' => :'uri-sans'
  }
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



330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/akeyless/models/generate_csr.rb', line 330

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



140
141
142
143
# File 'lib/akeyless/models/generate_csr.rb', line 140

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/akeyless/models/generate_csr.rb', line 113

def self.openapi_types
  {
    :'alg' => :'String',
    :'alt_names' => :'String',
    :'certificate_type' => :'String',
    :'city' => :'String',
    :'common_name' => :'String',
    :'country' => :'String',
    :'critical' => :'Boolean',
    :'dep' => :'String',
    :'email_addresses' => :'String',
    :'export_private_key' => :'Boolean',
    :'generate_key' => :'Boolean',
    :'ip_addresses' => :'String',
    :'json' => :'Boolean',
    :'key_type' => :'String',
    :'name' => :'String',
    :'org' => :'String',
    :'split_level' => :'Integer',
    :'state' => :'String',
    :'token' => :'String',
    :'uid_token' => :'String',
    :'uri_sans' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/akeyless/models/generate_csr.rb', line 289

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      alg == o.alg &&
      alt_names == o.alt_names &&
      certificate_type == o.certificate_type &&
      city == o.city &&
      common_name == o.common_name &&
      country == o.country &&
      critical == o.critical &&
      dep == o.dep &&
      email_addresses == o.email_addresses &&
      export_private_key == o.export_private_key &&
      generate_key == o.generate_key &&
      ip_addresses == o.ip_addresses &&
      json == o.json &&
      key_type == o.key_type &&
      name == o.name &&
      org == o.org &&
      split_level == o.split_level &&
      state == o.state &&
      token == o.token &&
      uid_token == o.uid_token &&
      uri_sans == o.uri_sans
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



425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/akeyless/models/generate_csr.rb', line 425

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

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


317
318
319
# File 'lib/akeyless/models/generate_csr.rb', line 317

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



323
324
325
# File 'lib/akeyless/models/generate_csr.rb', line 323

def hash
  [alg, alt_names, certificate_type, city, common_name, country, critical, dep, email_addresses, export_private_key, generate_key, ip_addresses, json, key_type, name, org, split_level, state, token, uid_token, uri_sans].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
# File 'lib/akeyless/models/generate_csr.rb', line 259

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @common_name.nil?
    invalid_properties.push('invalid value for "common_name", common_name cannot be nil.')
  end

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

  if @name.nil?
    invalid_properties.push('invalid value for "name", name 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



401
402
403
# File 'lib/akeyless/models/generate_csr.rb', line 401

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



407
408
409
410
411
412
413
414
415
416
417
418
419
# File 'lib/akeyless/models/generate_csr.rb', line 407

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



395
396
397
# File 'lib/akeyless/models/generate_csr.rb', line 395

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



279
280
281
282
283
284
285
# File 'lib/akeyless/models/generate_csr.rb', line 279

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @common_name.nil?
  return false if @key_type.nil?
  return false if @name.nil?
  true
end