akeyless 2.16.5 → 2.16.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -1
  3. data/docs/CreateTokenizer.md +42 -0
  4. data/docs/CreateTokenizerOutput.md +18 -0
  5. data/docs/Detokenize.md +26 -0
  6. data/docs/DetokenizeOutput.md +18 -0
  7. data/docs/DynamicSecretProducerInfo.md +2 -0
  8. data/docs/EmailTokenizerInfo.md +22 -0
  9. data/docs/ItemGeneralInfo.md +5 -1
  10. data/docs/ListTargets.md +2 -0
  11. data/docs/LogForwardingConfigPart.md +0 -2
  12. data/docs/Producer.md +2 -0
  13. data/docs/RegexpTokenizerInfo.md +24 -0
  14. data/docs/RotateSecret.md +22 -0
  15. data/docs/RotatedSecretOutput.md +18 -0
  16. data/docs/SystemAccessCredentialsReplyObj.md +2 -0
  17. data/docs/Tokenize.md +26 -0
  18. data/docs/TokenizeOutput.md +20 -0
  19. data/docs/TokenizerInfo.md +18 -0
  20. data/docs/UpdateTokenizer.md +46 -0
  21. data/docs/UpdateTokenizerOutput.md +18 -0
  22. data/docs/V2Api.md +315 -0
  23. data/docs/VaultlessTokenizerInfo.md +28 -0
  24. data/lib/akeyless/api/v2_api.rb +320 -0
  25. data/lib/akeyless/models/create_tokenizer.rb +358 -0
  26. data/lib/akeyless/models/create_tokenizer_output.rb +219 -0
  27. data/lib/akeyless/models/detokenize.rb +271 -0
  28. data/lib/akeyless/models/detokenize_output.rb +219 -0
  29. data/lib/akeyless/models/dynamic_secret_producer_info.rb +10 -1
  30. data/lib/akeyless/models/email_tokenizer_info.rb +241 -0
  31. data/lib/akeyless/models/item_general_info.rb +22 -4
  32. data/lib/akeyless/models/list_targets.rb +13 -1
  33. data/lib/akeyless/models/log_forwarding_config_part.rb +1 -10
  34. data/lib/akeyless/models/producer.rb +10 -1
  35. data/lib/akeyless/models/regexp_tokenizer_info.rb +251 -0
  36. data/lib/akeyless/models/rotate_secret.rb +245 -0
  37. data/lib/akeyless/models/rotated_secret_output.rb +219 -0
  38. data/lib/akeyless/models/system_access_credentials_reply_obj.rb +11 -1
  39. data/lib/akeyless/models/tokenize.rb +271 -0
  40. data/lib/akeyless/models/tokenize_output.rb +228 -0
  41. data/lib/akeyless/models/tokenizer_info.rb +219 -0
  42. data/lib/akeyless/models/update_tokenizer.rb +382 -0
  43. data/lib/akeyless/models/update_tokenizer_output.rb +219 -0
  44. data/lib/akeyless/models/vaultless_tokenizer_info.rb +267 -0
  45. data/lib/akeyless/version.rb +1 -1
  46. data/lib/akeyless.rb +14 -0
  47. data/spec/models/create_tokenizer_output_spec.rb +34 -0
  48. data/spec/models/create_tokenizer_spec.rb +106 -0
  49. data/spec/models/detokenize_output_spec.rb +34 -0
  50. data/spec/models/detokenize_spec.rb +58 -0
  51. data/spec/models/email_tokenizer_info_spec.rb +46 -0
  52. data/spec/models/regexp_tokenizer_info_spec.rb +52 -0
  53. data/spec/models/rotate_secret_spec.rb +46 -0
  54. data/spec/models/rotated_secret_output_spec.rb +34 -0
  55. data/spec/models/tokenize_output_spec.rb +40 -0
  56. data/spec/models/tokenize_spec.rb +58 -0
  57. data/spec/models/tokenizer_info_spec.rb +34 -0
  58. data/spec/models/update_tokenizer_output_spec.rb +34 -0
  59. data/spec/models/update_tokenizer_spec.rb +118 -0
  60. data/spec/models/vaultless_tokenizer_info_spec.rb +64 -0
  61. metadata +533 -477
@@ -2515,6 +2515,70 @@ module Akeyless
2515
2515
  return data, status_code, headers
2516
2516
  end
2517
2517
 
2518
+ # @param body [CreateTokenizer]
2519
+ # @param [Hash] opts the optional parameters
2520
+ # @return [CreateTokenizerOutput]
2521
+ def create_tokenizer(body, opts = {})
2522
+ data, _status_code, _headers = create_tokenizer_with_http_info(body, opts)
2523
+ data
2524
+ end
2525
+
2526
+ # @param body [CreateTokenizer]
2527
+ # @param [Hash] opts the optional parameters
2528
+ # @return [Array<(CreateTokenizerOutput, Integer, Hash)>] CreateTokenizerOutput data, response status code and response headers
2529
+ def create_tokenizer_with_http_info(body, opts = {})
2530
+ if @api_client.config.debugging
2531
+ @api_client.config.logger.debug 'Calling API: V2Api.create_tokenizer ...'
2532
+ end
2533
+ # verify the required parameter 'body' is set
2534
+ if @api_client.config.client_side_validation && body.nil?
2535
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.create_tokenizer"
2536
+ end
2537
+ # resource path
2538
+ local_var_path = '/create-tokenizer'
2539
+
2540
+ # query parameters
2541
+ query_params = opts[:query_params] || {}
2542
+
2543
+ # header parameters
2544
+ header_params = opts[:header_params] || {}
2545
+ # HTTP header 'Accept' (if needed)
2546
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2547
+ # HTTP header 'Content-Type'
2548
+ content_type = @api_client.select_header_content_type(['application/json'])
2549
+ if !content_type.nil?
2550
+ header_params['Content-Type'] = content_type
2551
+ end
2552
+
2553
+ # form parameters
2554
+ form_params = opts[:form_params] || {}
2555
+
2556
+ # http body (model)
2557
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
2558
+
2559
+ # return_type
2560
+ return_type = opts[:debug_return_type] || 'CreateTokenizerOutput'
2561
+
2562
+ # auth_names
2563
+ auth_names = opts[:debug_auth_names] || []
2564
+
2565
+ new_options = opts.merge(
2566
+ :operation => :"V2Api.create_tokenizer",
2567
+ :header_params => header_params,
2568
+ :query_params => query_params,
2569
+ :form_params => form_params,
2570
+ :body => post_body,
2571
+ :auth_names => auth_names,
2572
+ :return_type => return_type
2573
+ )
2574
+
2575
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
2576
+ if @api_client.config.debugging
2577
+ @api_client.config.logger.debug "API called: V2Api#create_tokenizer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2578
+ end
2579
+ return data, status_code, headers
2580
+ end
2581
+
2518
2582
  # @param body [CreateWebTarget]
2519
2583
  # @param [Hash] opts the optional parameters
2520
2584
  # @return [CreateWebTargetOutput]
@@ -3667,6 +3731,70 @@ module Akeyless
3667
3731
  return data, status_code, headers
3668
3732
  end
3669
3733
 
3734
+ # @param body [Detokenize]
3735
+ # @param [Hash] opts the optional parameters
3736
+ # @return [DetokenizeOutput]
3737
+ def detokenize(body, opts = {})
3738
+ data, _status_code, _headers = detokenize_with_http_info(body, opts)
3739
+ data
3740
+ end
3741
+
3742
+ # @param body [Detokenize]
3743
+ # @param [Hash] opts the optional parameters
3744
+ # @return [Array<(DetokenizeOutput, Integer, Hash)>] DetokenizeOutput data, response status code and response headers
3745
+ def detokenize_with_http_info(body, opts = {})
3746
+ if @api_client.config.debugging
3747
+ @api_client.config.logger.debug 'Calling API: V2Api.detokenize ...'
3748
+ end
3749
+ # verify the required parameter 'body' is set
3750
+ if @api_client.config.client_side_validation && body.nil?
3751
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.detokenize"
3752
+ end
3753
+ # resource path
3754
+ local_var_path = '/detokenize'
3755
+
3756
+ # query parameters
3757
+ query_params = opts[:query_params] || {}
3758
+
3759
+ # header parameters
3760
+ header_params = opts[:header_params] || {}
3761
+ # HTTP header 'Accept' (if needed)
3762
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
3763
+ # HTTP header 'Content-Type'
3764
+ content_type = @api_client.select_header_content_type(['application/json'])
3765
+ if !content_type.nil?
3766
+ header_params['Content-Type'] = content_type
3767
+ end
3768
+
3769
+ # form parameters
3770
+ form_params = opts[:form_params] || {}
3771
+
3772
+ # http body (model)
3773
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3774
+
3775
+ # return_type
3776
+ return_type = opts[:debug_return_type] || 'DetokenizeOutput'
3777
+
3778
+ # auth_names
3779
+ auth_names = opts[:debug_auth_names] || []
3780
+
3781
+ new_options = opts.merge(
3782
+ :operation => :"V2Api.detokenize",
3783
+ :header_params => header_params,
3784
+ :query_params => query_params,
3785
+ :form_params => form_params,
3786
+ :body => post_body,
3787
+ :auth_names => auth_names,
3788
+ :return_type => return_type
3789
+ )
3790
+
3791
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3792
+ if @api_client.config.debugging
3793
+ @api_client.config.logger.debug "API called: V2Api#detokenize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3794
+ end
3795
+ return data, status_code, headers
3796
+ end
3797
+
3670
3798
  # @param body [Encrypt]
3671
3799
  # @param [Hash] opts the optional parameters
3672
3800
  # @return [EncryptOutput]
@@ -10557,6 +10685,70 @@ module Akeyless
10557
10685
  return data, status_code, headers
10558
10686
  end
10559
10687
 
10688
+ # @param body [RotateSecret]
10689
+ # @param [Hash] opts the optional parameters
10690
+ # @return [RotatedSecretOutput]
10691
+ def rotate_secret(body, opts = {})
10692
+ data, _status_code, _headers = rotate_secret_with_http_info(body, opts)
10693
+ data
10694
+ end
10695
+
10696
+ # @param body [RotateSecret]
10697
+ # @param [Hash] opts the optional parameters
10698
+ # @return [Array<(RotatedSecretOutput, Integer, Hash)>] RotatedSecretOutput data, response status code and response headers
10699
+ def rotate_secret_with_http_info(body, opts = {})
10700
+ if @api_client.config.debugging
10701
+ @api_client.config.logger.debug 'Calling API: V2Api.rotate_secret ...'
10702
+ end
10703
+ # verify the required parameter 'body' is set
10704
+ if @api_client.config.client_side_validation && body.nil?
10705
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.rotate_secret"
10706
+ end
10707
+ # resource path
10708
+ local_var_path = '/gateway-rotate-secret'
10709
+
10710
+ # query parameters
10711
+ query_params = opts[:query_params] || {}
10712
+
10713
+ # header parameters
10714
+ header_params = opts[:header_params] || {}
10715
+ # HTTP header 'Accept' (if needed)
10716
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
10717
+ # HTTP header 'Content-Type'
10718
+ content_type = @api_client.select_header_content_type(['application/json'])
10719
+ if !content_type.nil?
10720
+ header_params['Content-Type'] = content_type
10721
+ end
10722
+
10723
+ # form parameters
10724
+ form_params = opts[:form_params] || {}
10725
+
10726
+ # http body (model)
10727
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
10728
+
10729
+ # return_type
10730
+ return_type = opts[:debug_return_type] || 'RotatedSecretOutput'
10731
+
10732
+ # auth_names
10733
+ auth_names = opts[:debug_auth_names] || []
10734
+
10735
+ new_options = opts.merge(
10736
+ :operation => :"V2Api.rotate_secret",
10737
+ :header_params => header_params,
10738
+ :query_params => query_params,
10739
+ :form_params => form_params,
10740
+ :body => post_body,
10741
+ :auth_names => auth_names,
10742
+ :return_type => return_type
10743
+ )
10744
+
10745
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
10746
+ if @api_client.config.debugging
10747
+ @api_client.config.logger.debug "API called: V2Api#rotate_secret\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
10748
+ end
10749
+ return data, status_code, headers
10750
+ end
10751
+
10560
10752
  # @param body [SetItemState]
10561
10753
  # @param [Hash] opts the optional parameters
10562
10754
  # @return [Object]
@@ -10941,6 +11133,70 @@ module Akeyless
10941
11133
  return data, status_code, headers
10942
11134
  end
10943
11135
 
11136
+ # @param body [Tokenize]
11137
+ # @param [Hash] opts the optional parameters
11138
+ # @return [TokenizeOutput]
11139
+ def tokenize(body, opts = {})
11140
+ data, _status_code, _headers = tokenize_with_http_info(body, opts)
11141
+ data
11142
+ end
11143
+
11144
+ # @param body [Tokenize]
11145
+ # @param [Hash] opts the optional parameters
11146
+ # @return [Array<(TokenizeOutput, Integer, Hash)>] TokenizeOutput data, response status code and response headers
11147
+ def tokenize_with_http_info(body, opts = {})
11148
+ if @api_client.config.debugging
11149
+ @api_client.config.logger.debug 'Calling API: V2Api.tokenize ...'
11150
+ end
11151
+ # verify the required parameter 'body' is set
11152
+ if @api_client.config.client_side_validation && body.nil?
11153
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.tokenize"
11154
+ end
11155
+ # resource path
11156
+ local_var_path = '/tokenize'
11157
+
11158
+ # query parameters
11159
+ query_params = opts[:query_params] || {}
11160
+
11161
+ # header parameters
11162
+ header_params = opts[:header_params] || {}
11163
+ # HTTP header 'Accept' (if needed)
11164
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
11165
+ # HTTP header 'Content-Type'
11166
+ content_type = @api_client.select_header_content_type(['application/json'])
11167
+ if !content_type.nil?
11168
+ header_params['Content-Type'] = content_type
11169
+ end
11170
+
11171
+ # form parameters
11172
+ form_params = opts[:form_params] || {}
11173
+
11174
+ # http body (model)
11175
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
11176
+
11177
+ # return_type
11178
+ return_type = opts[:debug_return_type] || 'TokenizeOutput'
11179
+
11180
+ # auth_names
11181
+ auth_names = opts[:debug_auth_names] || []
11182
+
11183
+ new_options = opts.merge(
11184
+ :operation => :"V2Api.tokenize",
11185
+ :header_params => header_params,
11186
+ :query_params => query_params,
11187
+ :form_params => form_params,
11188
+ :body => post_body,
11189
+ :auth_names => auth_names,
11190
+ :return_type => return_type
11191
+ )
11192
+
11193
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
11194
+ if @api_client.config.debugging
11195
+ @api_client.config.logger.debug "API called: V2Api#tokenize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
11196
+ end
11197
+ return data, status_code, headers
11198
+ end
11199
+
10944
11200
  # @param body [UidCreateChildToken]
10945
11201
  # @param [Hash] opts the optional parameters
10946
11202
  # @return [UidCreateChildTokenOutput]
@@ -13810,6 +14066,70 @@ module Akeyless
13810
14066
  return data, status_code, headers
13811
14067
  end
13812
14068
 
14069
+ # @param body [UpdateTokenizer]
14070
+ # @param [Hash] opts the optional parameters
14071
+ # @return [UpdateTokenizerOutput]
14072
+ def update_tokenizer(body, opts = {})
14073
+ data, _status_code, _headers = update_tokenizer_with_http_info(body, opts)
14074
+ data
14075
+ end
14076
+
14077
+ # @param body [UpdateTokenizer]
14078
+ # @param [Hash] opts the optional parameters
14079
+ # @return [Array<(UpdateTokenizerOutput, Integer, Hash)>] UpdateTokenizerOutput data, response status code and response headers
14080
+ def update_tokenizer_with_http_info(body, opts = {})
14081
+ if @api_client.config.debugging
14082
+ @api_client.config.logger.debug 'Calling API: V2Api.update_tokenizer ...'
14083
+ end
14084
+ # verify the required parameter 'body' is set
14085
+ if @api_client.config.client_side_validation && body.nil?
14086
+ fail ArgumentError, "Missing the required parameter 'body' when calling V2Api.update_tokenizer"
14087
+ end
14088
+ # resource path
14089
+ local_var_path = '/update-tokenizer'
14090
+
14091
+ # query parameters
14092
+ query_params = opts[:query_params] || {}
14093
+
14094
+ # header parameters
14095
+ header_params = opts[:header_params] || {}
14096
+ # HTTP header 'Accept' (if needed)
14097
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
14098
+ # HTTP header 'Content-Type'
14099
+ content_type = @api_client.select_header_content_type(['application/json'])
14100
+ if !content_type.nil?
14101
+ header_params['Content-Type'] = content_type
14102
+ end
14103
+
14104
+ # form parameters
14105
+ form_params = opts[:form_params] || {}
14106
+
14107
+ # http body (model)
14108
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
14109
+
14110
+ # return_type
14111
+ return_type = opts[:debug_return_type] || 'UpdateTokenizerOutput'
14112
+
14113
+ # auth_names
14114
+ auth_names = opts[:debug_auth_names] || []
14115
+
14116
+ new_options = opts.merge(
14117
+ :operation => :"V2Api.update_tokenizer",
14118
+ :header_params => header_params,
14119
+ :query_params => query_params,
14120
+ :form_params => form_params,
14121
+ :body => post_body,
14122
+ :auth_names => auth_names,
14123
+ :return_type => return_type
14124
+ )
14125
+
14126
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
14127
+ if @api_client.config.debugging
14128
+ @api_client.config.logger.debug "API called: V2Api#update_tokenizer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
14129
+ end
14130
+ return data, status_code, headers
14131
+ end
14132
+
13813
14133
  # @param body [UpdateWebTarget]
13814
14134
  # @param [Hash] opts the optional parameters
13815
14135
  # @return [UpdateWebTargetOutput]
@@ -0,0 +1,358 @@
1
+ =begin
2
+ #Akeyless API
3
+
4
+ #The purpose of this application is to provide access to Akeyless API.
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@akeyless.io
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.0-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Akeyless
17
+ # createTokenizer is a command that creates a tokenizer item
18
+ class CreateTokenizer
19
+ # Alphabet to use in regexp vaultless tokenization
20
+ attr_accessor :alphabet
21
+
22
+ # The Decryption output template to use in regexp vaultless tokenization
23
+ attr_accessor :decryption_template
24
+
25
+ # AES key name to use in vaultless tokenization
26
+ attr_accessor :encryption_key_name
27
+
28
+ # The Encryption output template to use in regexp vaultless tokenization
29
+ attr_accessor :encryption_template
30
+
31
+ # A metadata about the tokenizer
32
+ attr_accessor :metadata
33
+
34
+ # Tokenizer name
35
+ attr_accessor :name
36
+
37
+ # Pattern to use in regexp vaultless tokenization
38
+ attr_accessor :pattern
39
+
40
+ # List of the tags attached to this key
41
+ attr_accessor :tag
42
+
43
+ # Which template type this tokenizer is used for [SSN,CreditCard,USPhoneNumber,Email,Regexp]
44
+ attr_accessor :template_type
45
+
46
+ # Authentication token (see `/auth` and `/configure`)
47
+ attr_accessor :token
48
+
49
+ # Tokenizer type
50
+ attr_accessor :tokenizer_type
51
+
52
+ # The tweak type to use in vaultless tokenization [Supplied, Generated, Internal, Masking]
53
+ attr_accessor :tweak_type
54
+
55
+ # The universal identity token, Required only for universal_identity authentication
56
+ attr_accessor :uid_token
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'alphabet' => :'alphabet',
62
+ :'decryption_template' => :'decryption-template',
63
+ :'encryption_key_name' => :'encryption-key-name',
64
+ :'encryption_template' => :'encryption-template',
65
+ :'metadata' => :'metadata',
66
+ :'name' => :'name',
67
+ :'pattern' => :'pattern',
68
+ :'tag' => :'tag',
69
+ :'template_type' => :'template-type',
70
+ :'token' => :'token',
71
+ :'tokenizer_type' => :'tokenizer-type',
72
+ :'tweak_type' => :'tweak-type',
73
+ :'uid_token' => :'uid-token'
74
+ }
75
+ end
76
+
77
+ # Returns all the JSON keys this model knows about
78
+ def self.acceptable_attributes
79
+ attribute_map.values
80
+ end
81
+
82
+ # Attribute type mapping.
83
+ def self.openapi_types
84
+ {
85
+ :'alphabet' => :'String',
86
+ :'decryption_template' => :'String',
87
+ :'encryption_key_name' => :'String',
88
+ :'encryption_template' => :'String',
89
+ :'metadata' => :'String',
90
+ :'name' => :'String',
91
+ :'pattern' => :'String',
92
+ :'tag' => :'Array<String>',
93
+ :'template_type' => :'String',
94
+ :'token' => :'String',
95
+ :'tokenizer_type' => :'String',
96
+ :'tweak_type' => :'String',
97
+ :'uid_token' => :'String'
98
+ }
99
+ end
100
+
101
+ # List of attributes with nullable: true
102
+ def self.openapi_nullable
103
+ Set.new([
104
+ ])
105
+ end
106
+
107
+ # Initializes the object
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ def initialize(attributes = {})
110
+ if (!attributes.is_a?(Hash))
111
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Akeyless::CreateTokenizer` initialize method"
112
+ end
113
+
114
+ # check to see if the attribute exists and convert string to symbol for hash key
115
+ attributes = attributes.each_with_object({}) { |(k, v), h|
116
+ if (!self.class.attribute_map.key?(k.to_sym))
117
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Akeyless::CreateTokenizer`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
118
+ end
119
+ h[k.to_sym] = v
120
+ }
121
+
122
+ if attributes.key?(:'alphabet')
123
+ self.alphabet = attributes[:'alphabet']
124
+ end
125
+
126
+ if attributes.key?(:'decryption_template')
127
+ self.decryption_template = attributes[:'decryption_template']
128
+ end
129
+
130
+ if attributes.key?(:'encryption_key_name')
131
+ self.encryption_key_name = attributes[:'encryption_key_name']
132
+ end
133
+
134
+ if attributes.key?(:'encryption_template')
135
+ self.encryption_template = attributes[:'encryption_template']
136
+ end
137
+
138
+ if attributes.key?(:'metadata')
139
+ self.metadata = attributes[:'metadata']
140
+ end
141
+
142
+ if attributes.key?(:'name')
143
+ self.name = attributes[:'name']
144
+ end
145
+
146
+ if attributes.key?(:'pattern')
147
+ self.pattern = attributes[:'pattern']
148
+ end
149
+
150
+ if attributes.key?(:'tag')
151
+ if (value = attributes[:'tag']).is_a?(Array)
152
+ self.tag = value
153
+ end
154
+ end
155
+
156
+ if attributes.key?(:'template_type')
157
+ self.template_type = attributes[:'template_type']
158
+ end
159
+
160
+ if attributes.key?(:'token')
161
+ self.token = attributes[:'token']
162
+ end
163
+
164
+ if attributes.key?(:'tokenizer_type')
165
+ self.tokenizer_type = attributes[:'tokenizer_type']
166
+ end
167
+
168
+ if attributes.key?(:'tweak_type')
169
+ self.tweak_type = attributes[:'tweak_type']
170
+ end
171
+
172
+ if attributes.key?(:'uid_token')
173
+ self.uid_token = attributes[:'uid_token']
174
+ end
175
+ end
176
+
177
+ # Show invalid properties with the reasons. Usually used together with valid?
178
+ # @return Array for valid properties with the reasons
179
+ def list_invalid_properties
180
+ invalid_properties = Array.new
181
+ if @name.nil?
182
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
183
+ end
184
+
185
+ if @template_type.nil?
186
+ invalid_properties.push('invalid value for "template_type", template_type cannot be nil.')
187
+ end
188
+
189
+ if @tokenizer_type.nil?
190
+ invalid_properties.push('invalid value for "tokenizer_type", tokenizer_type cannot be nil.')
191
+ end
192
+
193
+ invalid_properties
194
+ end
195
+
196
+ # Check to see if the all the properties in the model are valid
197
+ # @return true if the model is valid
198
+ def valid?
199
+ return false if @name.nil?
200
+ return false if @template_type.nil?
201
+ return false if @tokenizer_type.nil?
202
+ true
203
+ end
204
+
205
+ # Checks equality by comparing each attribute.
206
+ # @param [Object] Object to be compared
207
+ def ==(o)
208
+ return true if self.equal?(o)
209
+ self.class == o.class &&
210
+ alphabet == o.alphabet &&
211
+ decryption_template == o.decryption_template &&
212
+ encryption_key_name == o.encryption_key_name &&
213
+ encryption_template == o.encryption_template &&
214
+ metadata == o.metadata &&
215
+ name == o.name &&
216
+ pattern == o.pattern &&
217
+ tag == o.tag &&
218
+ template_type == o.template_type &&
219
+ token == o.token &&
220
+ tokenizer_type == o.tokenizer_type &&
221
+ tweak_type == o.tweak_type &&
222
+ uid_token == o.uid_token
223
+ end
224
+
225
+ # @see the `==` method
226
+ # @param [Object] Object to be compared
227
+ def eql?(o)
228
+ self == o
229
+ end
230
+
231
+ # Calculates hash code according to all attributes.
232
+ # @return [Integer] Hash code
233
+ def hash
234
+ [alphabet, decryption_template, encryption_key_name, encryption_template, metadata, name, pattern, tag, template_type, token, tokenizer_type, tweak_type, uid_token].hash
235
+ end
236
+
237
+ # Builds the object from hash
238
+ # @param [Hash] attributes Model attributes in the form of hash
239
+ # @return [Object] Returns the model itself
240
+ def self.build_from_hash(attributes)
241
+ new.build_from_hash(attributes)
242
+ end
243
+
244
+ # Builds the object from hash
245
+ # @param [Hash] attributes Model attributes in the form of hash
246
+ # @return [Object] Returns the model itself
247
+ def build_from_hash(attributes)
248
+ return nil unless attributes.is_a?(Hash)
249
+ attributes = attributes.transform_keys(&:to_sym)
250
+ self.class.openapi_types.each_pair do |key, type|
251
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
252
+ self.send("#{key}=", nil)
253
+ elsif type =~ /\AArray<(.*)>/i
254
+ # check to ensure the input is an array given that the attribute
255
+ # is documented as an array but the input is not
256
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
257
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
258
+ end
259
+ elsif !attributes[self.class.attribute_map[key]].nil?
260
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
261
+ end
262
+ end
263
+
264
+ self
265
+ end
266
+
267
+ # Deserializes the data based on type
268
+ # @param string type Data type
269
+ # @param string value Value to be deserialized
270
+ # @return [Object] Deserialized data
271
+ def _deserialize(type, value)
272
+ case type.to_sym
273
+ when :Time
274
+ Time.parse(value)
275
+ when :Date
276
+ Date.parse(value)
277
+ when :String
278
+ value.to_s
279
+ when :Integer
280
+ value.to_i
281
+ when :Float
282
+ value.to_f
283
+ when :Boolean
284
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
285
+ true
286
+ else
287
+ false
288
+ end
289
+ when :Object
290
+ # generic object (usually a Hash), return directly
291
+ value
292
+ when /\AArray<(?<inner_type>.+)>\z/
293
+ inner_type = Regexp.last_match[:inner_type]
294
+ value.map { |v| _deserialize(inner_type, v) }
295
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
296
+ k_type = Regexp.last_match[:k_type]
297
+ v_type = Regexp.last_match[:v_type]
298
+ {}.tap do |hash|
299
+ value.each do |k, v|
300
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
301
+ end
302
+ end
303
+ else # model
304
+ # models (e.g. Pet) or oneOf
305
+ klass = Akeyless.const_get(type)
306
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
307
+ end
308
+ end
309
+
310
+ # Returns the string representation of the object
311
+ # @return [String] String presentation of the object
312
+ def to_s
313
+ to_hash.to_s
314
+ end
315
+
316
+ # to_body is an alias to to_hash (backward compatibility)
317
+ # @return [Hash] Returns the object in the form of hash
318
+ def to_body
319
+ to_hash
320
+ end
321
+
322
+ # Returns the object in the form of hash
323
+ # @return [Hash] Returns the object in the form of hash
324
+ def to_hash
325
+ hash = {}
326
+ self.class.attribute_map.each_pair do |attr, param|
327
+ value = self.send(attr)
328
+ if value.nil?
329
+ is_nullable = self.class.openapi_nullable.include?(attr)
330
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
331
+ end
332
+
333
+ hash[param] = _to_hash(value)
334
+ end
335
+ hash
336
+ end
337
+
338
+ # Outputs non-array value in the form of hash
339
+ # For object, use to_hash. Otherwise, just return the value
340
+ # @param [Object] value Any valid value
341
+ # @return [Hash] Returns the value in the form of hash
342
+ def _to_hash(value)
343
+ if value.is_a?(Array)
344
+ value.compact.map { |v| _to_hash(v) }
345
+ elsif value.is_a?(Hash)
346
+ {}.tap do |hash|
347
+ value.each { |k, v| hash[k] = _to_hash(v) }
348
+ end
349
+ elsif value.respond_to? :to_hash
350
+ value.to_hash
351
+ else
352
+ value
353
+ end
354
+ end
355
+
356
+ end
357
+
358
+ end