infisical-sdk 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/schemas.rb ADDED
@@ -0,0 +1,1717 @@
1
+ # This code may look unusually verbose for Ruby (and it is), but
2
+ # it performs some subtle and complex validation of JSON data.
3
+ #
4
+ # To parse this JSON, add 'dry-struct' and 'dry-types' gems, then do:
5
+ #
6
+ # client_settings = ClientSettings.from_json! "{…}"
7
+ # puts client_settings.auth&.access_token.nil?
8
+ #
9
+ # command = Command.from_json! "{…}"
10
+ # puts command.aws_iam_auth_login&.identity_id
11
+ #
12
+ # response_for_access_token_success_response = ResponseForAccessTokenSuccessResponse.from_json! "{…}"
13
+ # puts response_for_access_token_success_response.data&.access_token
14
+ #
15
+ # response_for_create_secret_response = ResponseForCreateSecretResponse.from_json! "{…}"
16
+ # puts response_for_create_secret_response.data&.secret.environment
17
+ #
18
+ # response_for_create_symmetric_key_response = ResponseForCreateSymmetricKeyResponse.from_json! "{…}"
19
+ # puts response_for_create_symmetric_key_response.data&.key
20
+ #
21
+ # response_for_decrypt_symmetric_response = ResponseForDecryptSymmetricResponse.from_json! "{…}"
22
+ # puts response_for_decrypt_symmetric_response.data&.decrypted
23
+ #
24
+ # response_for_delete_secret_response = ResponseForDeleteSecretResponse.from_json! "{…}"
25
+ # puts response_for_delete_secret_response.data&.secret.environment
26
+ #
27
+ # response_for_encrypt_symmetric_response = ResponseForEncryptSymmetricResponse.from_json! "{…}"
28
+ # puts response_for_encrypt_symmetric_response.data&.ciphertext
29
+ #
30
+ # response_for_get_secret_response = ResponseForGetSecretResponse.from_json! "{…}"
31
+ # puts response_for_get_secret_response.data&.secret.environment
32
+ #
33
+ # response_for_list_secrets_response = ResponseForListSecretsResponse.from_json! "{…}"
34
+ # puts response_for_list_secrets_response.data&.secrets.first.environment
35
+ #
36
+ # response_for_update_secret_response = ResponseForUpdateSecretResponse.from_json! "{…}"
37
+ # puts response_for_update_secret_response.data&.secret.environment
38
+ #
39
+ # If from_json! succeeds, the value returned matches the schema.
40
+
41
+ require 'json'
42
+ require 'dry-types'
43
+ require 'dry-struct'
44
+
45
+ module Types
46
+ include Dry.Types(default: :nominal)
47
+
48
+ Integer = Strict::Integer
49
+ Nil = Strict::Nil
50
+ Bool = Strict::Bool
51
+ Hash = Strict::Hash
52
+ String = Strict::String
53
+ end
54
+
55
+ class AWSIamAuthMethod < Dry::Struct
56
+
57
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
58
+ attribute :identity_id, Types::String
59
+
60
+ def self.from_dynamic!(d)
61
+ d = Types::Hash[d]
62
+ new(
63
+ identity_id: d.fetch("identityId"),
64
+ )
65
+ end
66
+
67
+ def self.from_json!(json)
68
+ from_dynamic!(JSON.parse(json))
69
+ end
70
+
71
+ def to_dynamic
72
+ {
73
+ "identityId" => identity_id,
74
+ }
75
+ end
76
+
77
+ def to_json(options = nil)
78
+ JSON.generate(to_dynamic, options)
79
+ end
80
+ end
81
+
82
+ class AzureAuthMethod < Dry::Struct
83
+
84
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
85
+ attribute :identity_id, Types::String
86
+
87
+ def self.from_dynamic!(d)
88
+ d = Types::Hash[d]
89
+ new(
90
+ identity_id: d.fetch("identityId"),
91
+ )
92
+ end
93
+
94
+ def self.from_json!(json)
95
+ from_dynamic!(JSON.parse(json))
96
+ end
97
+
98
+ def to_dynamic
99
+ {
100
+ "identityId" => identity_id,
101
+ }
102
+ end
103
+
104
+ def to_json(options = nil)
105
+ JSON.generate(to_dynamic, options)
106
+ end
107
+ end
108
+
109
+ class GCPIamAuthMethod < Dry::Struct
110
+ attribute :identity_id, Types::String
111
+
112
+ # The path to the GCP Service Account key file.
113
+ #
114
+ # You can generate this key file by going to the GCP Console -> IAM & Admin -> Service
115
+ # Accounts -> *Select your service account* -> Keys tab -> Add key.
116
+ # Note: The key must be in JSON format.
117
+ attribute :service_account_key_file_path, Types::String
118
+
119
+ def self.from_dynamic!(d)
120
+ d = Types::Hash[d]
121
+ new(
122
+ identity_id: d.fetch("identityId"),
123
+ service_account_key_file_path: d.fetch("serviceAccountKeyFilePath"),
124
+ )
125
+ end
126
+
127
+ def self.from_json!(json)
128
+ from_dynamic!(JSON.parse(json))
129
+ end
130
+
131
+ def to_dynamic
132
+ {
133
+ "identityId" => identity_id,
134
+ "serviceAccountKeyFilePath" => service_account_key_file_path,
135
+ }
136
+ end
137
+
138
+ def to_json(options = nil)
139
+ JSON.generate(to_dynamic, options)
140
+ end
141
+ end
142
+
143
+ class GCPIDTokenAuthMethod < Dry::Struct
144
+ attribute :identity_id, Types::String
145
+
146
+ def self.from_dynamic!(d)
147
+ d = Types::Hash[d]
148
+ new(
149
+ identity_id: d.fetch("identityId"),
150
+ )
151
+ end
152
+
153
+ def self.from_json!(json)
154
+ from_dynamic!(JSON.parse(json))
155
+ end
156
+
157
+ def to_dynamic
158
+ {
159
+ "identityId" => identity_id,
160
+ }
161
+ end
162
+
163
+ def to_json(options = nil)
164
+ JSON.generate(to_dynamic, options)
165
+ end
166
+ end
167
+
168
+ class KubernetesAuthMethod < Dry::Struct
169
+
170
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
171
+ attribute :identity_id, Types::String
172
+
173
+ # The path to the Kubernetes Service Account token file.
174
+ #
175
+ # If no path is provided, it will default to
176
+ # /var/run/secrets/kubernetes.io/serviceaccount/token.
177
+ attribute :service_account_token_path, Types::String.optional.optional
178
+
179
+ def self.from_dynamic!(d)
180
+ d = Types::Hash[d]
181
+ new(
182
+ identity_id: d.fetch("identityId"),
183
+ service_account_token_path: d["serviceAccountTokenPath"],
184
+ )
185
+ end
186
+
187
+ def self.from_json!(json)
188
+ from_dynamic!(JSON.parse(json))
189
+ end
190
+
191
+ def to_dynamic
192
+ {
193
+ "identityId" => identity_id,
194
+ "serviceAccountTokenPath" => service_account_token_path,
195
+ }
196
+ end
197
+
198
+ def to_json(options = nil)
199
+ JSON.generate(to_dynamic, options)
200
+ end
201
+ end
202
+
203
+ class UniversalAuthMethod < Dry::Struct
204
+ attribute :client_id, Types::String
205
+ attribute :client_secret, Types::String
206
+
207
+ def self.from_dynamic!(d)
208
+ d = Types::Hash[d]
209
+ new(
210
+ client_id: d.fetch("clientId"),
211
+ client_secret: d.fetch("clientSecret"),
212
+ )
213
+ end
214
+
215
+ def self.from_json!(json)
216
+ from_dynamic!(JSON.parse(json))
217
+ end
218
+
219
+ def to_dynamic
220
+ {
221
+ "clientId" => client_id,
222
+ "clientSecret" => client_secret,
223
+ }
224
+ end
225
+
226
+ def to_json(options = nil)
227
+ JSON.generate(to_dynamic, options)
228
+ end
229
+ end
230
+
231
+ # Configure the authentication method to use.
232
+ #
233
+ # Make sure to only set one one method at a time to avoid conflicts and unexpected behavior.
234
+ class AuthenticationOptions < Dry::Struct
235
+ attribute :access_token, Types::String.optional.optional
236
+ attribute :aws_iam, AWSIamAuthMethod.optional.optional
237
+ attribute :azure, AzureAuthMethod.optional.optional
238
+ attribute :gcp_iam, GCPIamAuthMethod.optional.optional
239
+ attribute :gcp_id_token, GCPIDTokenAuthMethod.optional.optional
240
+ attribute :kubernetes, KubernetesAuthMethod.optional.optional
241
+ attribute :universal_auth, UniversalAuthMethod.optional.optional
242
+
243
+ def self.from_dynamic!(d)
244
+ d = Types::Hash[d]
245
+ new(
246
+ access_token: d["accessToken"],
247
+ aws_iam: d["awsIam"] ? AWSIamAuthMethod.from_dynamic!(d["awsIam"]) : nil,
248
+ azure: d["azure"] ? AzureAuthMethod.from_dynamic!(d["azure"]) : nil,
249
+ gcp_iam: d["gcpIam"] ? GCPIamAuthMethod.from_dynamic!(d["gcpIam"]) : nil,
250
+ gcp_id_token: d["gcpIdToken"] ? GCPIDTokenAuthMethod.from_dynamic!(d["gcpIdToken"]) : nil,
251
+ kubernetes: d["kubernetes"] ? KubernetesAuthMethod.from_dynamic!(d["kubernetes"]) : nil,
252
+ universal_auth: d["universalAuth"] ? UniversalAuthMethod.from_dynamic!(d["universalAuth"]) : nil,
253
+ )
254
+ end
255
+
256
+ def self.from_json!(json)
257
+ from_dynamic!(JSON.parse(json))
258
+ end
259
+
260
+ def to_dynamic
261
+ {
262
+ "accessToken" => access_token,
263
+ "awsIam" => aws_iam&.to_dynamic,
264
+ "azure" => azure&.to_dynamic,
265
+ "gcpIam" => gcp_iam&.to_dynamic,
266
+ "gcpIdToken" => gcp_id_token&.to_dynamic,
267
+ "kubernetes" => kubernetes&.to_dynamic,
268
+ "universalAuth" => universal_auth&.to_dynamic,
269
+ }
270
+ end
271
+
272
+ def to_json(options = nil)
273
+ JSON.generate(to_dynamic, options)
274
+ end
275
+ end
276
+
277
+ class ClientSettings < Dry::Struct
278
+
279
+ # **DEPRECATED**: The access token field is deprecated. Please use the new auth object
280
+ # field instead.
281
+ attribute :access_token, Types::String.optional.optional
282
+
283
+ # Configure the authentication method to use.
284
+ #
285
+ # Make sure to only set one one method at a time to avoid conflicts and unexpected behavior.
286
+ attribute :auth, AuthenticationOptions.optional
287
+
288
+ # cacheTTL controls how often the cache should refresh, default is 300 seconds. Set to 0 to
289
+ # disable the cache.
290
+ attribute :cache_ttl, Types::Integer.optional.optional
291
+
292
+ # **DEPRECATED**: The client secret field is deprecated. Please use the new auth object
293
+ # field instead.
294
+ attribute :client_id, Types::String.optional.optional
295
+
296
+ # **DEPRECATED**: The client secret field is deprecated. Please use the new auth object
297
+ # field instead.
298
+ attribute :client_secret, Types::String.optional.optional
299
+
300
+ # The URL of the site to connect to. Defaults to "https://app.infisical.com".
301
+ attribute :site_url, Types::String.optional.optional
302
+
303
+ attribute :user_agent, Types::String.optional.optional
304
+
305
+ def self.from_dynamic!(d)
306
+ d = Types::Hash[d]
307
+ new(
308
+ access_token: d["accessToken"],
309
+ auth: d["auth"] ? AuthenticationOptions.from_dynamic!(d["auth"]) : nil,
310
+ cache_ttl: d["cacheTtl"],
311
+ client_id: d["clientId"],
312
+ client_secret: d["clientSecret"],
313
+ site_url: d["siteUrl"],
314
+ user_agent: d["userAgent"],
315
+ )
316
+ end
317
+
318
+ def self.from_json!(json)
319
+ from_dynamic!(JSON.parse(json))
320
+ end
321
+
322
+ def to_dynamic
323
+ {
324
+ "accessToken" => access_token,
325
+ "auth" => auth&.to_dynamic,
326
+ "cacheTtl" => cache_ttl,
327
+ "clientId" => client_id,
328
+ "clientSecret" => client_secret,
329
+ "siteUrl" => site_url,
330
+ "userAgent" => user_agent,
331
+ }
332
+ end
333
+
334
+ def to_json(options = nil)
335
+ JSON.generate(to_dynamic, options)
336
+ end
337
+ end
338
+
339
+ class AwsIamAuthLoginClass < Dry::Struct
340
+
341
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
342
+ attribute :identity_id, Types::String
343
+
344
+ def self.from_dynamic!(d)
345
+ d = Types::Hash[d]
346
+ new(
347
+ identity_id: d.fetch("identityId"),
348
+ )
349
+ end
350
+
351
+ def self.from_json!(json)
352
+ from_dynamic!(JSON.parse(json))
353
+ end
354
+
355
+ def to_dynamic
356
+ {
357
+ "identityId" => identity_id,
358
+ }
359
+ end
360
+
361
+ def to_json(options = nil)
362
+ JSON.generate(to_dynamic, options)
363
+ end
364
+ end
365
+
366
+ class AzureAuthLoginClass < Dry::Struct
367
+
368
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
369
+ attribute :identity_id, Types::String
370
+
371
+ def self.from_dynamic!(d)
372
+ d = Types::Hash[d]
373
+ new(
374
+ identity_id: d.fetch("identityId"),
375
+ )
376
+ end
377
+
378
+ def self.from_json!(json)
379
+ from_dynamic!(JSON.parse(json))
380
+ end
381
+
382
+ def to_dynamic
383
+ {
384
+ "identityId" => identity_id,
385
+ }
386
+ end
387
+
388
+ def to_json(options = nil)
389
+ JSON.generate(to_dynamic, options)
390
+ end
391
+ end
392
+
393
+ class CreateSecretOptions < Dry::Struct
394
+ attribute :environment, Types::String
395
+ attribute :path, Types::String.optional.optional
396
+ attribute :project_id, Types::String
397
+ attribute :secret_comment, Types::String.optional.optional
398
+ attribute :secret_name, Types::String
399
+ attribute :secret_value, Types::String
400
+ attribute :skip_multiline_encoding, Types::Bool.optional.optional
401
+ attribute :create_secret_options_type, Types::String.optional.optional
402
+
403
+ def self.from_dynamic!(d)
404
+ d = Types::Hash[d]
405
+ new(
406
+ environment: d.fetch("environment"),
407
+ path: d["path"],
408
+ project_id: d.fetch("projectId"),
409
+ secret_comment: d["secretComment"],
410
+ secret_name: d.fetch("secretName"),
411
+ secret_value: d.fetch("secretValue"),
412
+ skip_multiline_encoding: d["skipMultilineEncoding"],
413
+ create_secret_options_type: d["type"],
414
+ )
415
+ end
416
+
417
+ def self.from_json!(json)
418
+ from_dynamic!(JSON.parse(json))
419
+ end
420
+
421
+ def to_dynamic
422
+ {
423
+ "environment" => environment,
424
+ "path" => path,
425
+ "projectId" => project_id,
426
+ "secretComment" => secret_comment,
427
+ "secretName" => secret_name,
428
+ "secretValue" => secret_value,
429
+ "skipMultilineEncoding" => skip_multiline_encoding,
430
+ "type" => create_secret_options_type,
431
+ }
432
+ end
433
+
434
+ def to_json(options = nil)
435
+ JSON.generate(to_dynamic, options)
436
+ end
437
+ end
438
+
439
+ class ArbitraryOptions < Dry::Struct
440
+ attribute :data, Types::String
441
+
442
+ def self.from_dynamic!(d)
443
+ d = Types::Hash[d]
444
+ new(
445
+ data: d.fetch("data"),
446
+ )
447
+ end
448
+
449
+ def self.from_json!(json)
450
+ from_dynamic!(JSON.parse(json))
451
+ end
452
+
453
+ def to_dynamic
454
+ {
455
+ "data" => data,
456
+ }
457
+ end
458
+
459
+ def to_json(options = nil)
460
+ JSON.generate(to_dynamic, options)
461
+ end
462
+ end
463
+
464
+ class DecryptSymmetricOptions < Dry::Struct
465
+ attribute :ciphertext, Types::String
466
+ attribute :iv, Types::String
467
+ attribute :key, Types::String
468
+ attribute :tag, Types::String
469
+
470
+ def self.from_dynamic!(d)
471
+ d = Types::Hash[d]
472
+ new(
473
+ ciphertext: d.fetch("ciphertext"),
474
+ iv: d.fetch("iv"),
475
+ key: d.fetch("key"),
476
+ tag: d.fetch("tag"),
477
+ )
478
+ end
479
+
480
+ def self.from_json!(json)
481
+ from_dynamic!(JSON.parse(json))
482
+ end
483
+
484
+ def to_dynamic
485
+ {
486
+ "ciphertext" => ciphertext,
487
+ "iv" => iv,
488
+ "key" => key,
489
+ "tag" => tag,
490
+ }
491
+ end
492
+
493
+ def to_json(options = nil)
494
+ JSON.generate(to_dynamic, options)
495
+ end
496
+ end
497
+
498
+ class DeleteSecretOptions < Dry::Struct
499
+ attribute :environment, Types::String
500
+ attribute :path, Types::String.optional.optional
501
+ attribute :project_id, Types::String
502
+ attribute :secret_name, Types::String
503
+ attribute :delete_secret_options_type, Types::String.optional.optional
504
+
505
+ def self.from_dynamic!(d)
506
+ d = Types::Hash[d]
507
+ new(
508
+ environment: d.fetch("environment"),
509
+ path: d["path"],
510
+ project_id: d.fetch("projectId"),
511
+ secret_name: d.fetch("secretName"),
512
+ delete_secret_options_type: d["type"],
513
+ )
514
+ end
515
+
516
+ def self.from_json!(json)
517
+ from_dynamic!(JSON.parse(json))
518
+ end
519
+
520
+ def to_dynamic
521
+ {
522
+ "environment" => environment,
523
+ "path" => path,
524
+ "projectId" => project_id,
525
+ "secretName" => secret_name,
526
+ "type" => delete_secret_options_type,
527
+ }
528
+ end
529
+
530
+ def to_json(options = nil)
531
+ JSON.generate(to_dynamic, options)
532
+ end
533
+ end
534
+
535
+ class EncryptSymmetricOptions < Dry::Struct
536
+ attribute :key, Types::String
537
+ attribute :plaintext, Types::String
538
+
539
+ def self.from_dynamic!(d)
540
+ d = Types::Hash[d]
541
+ new(
542
+ key: d.fetch("key"),
543
+ plaintext: d.fetch("plaintext"),
544
+ )
545
+ end
546
+
547
+ def self.from_json!(json)
548
+ from_dynamic!(JSON.parse(json))
549
+ end
550
+
551
+ def to_dynamic
552
+ {
553
+ "key" => key,
554
+ "plaintext" => plaintext,
555
+ }
556
+ end
557
+
558
+ def to_json(options = nil)
559
+ JSON.generate(to_dynamic, options)
560
+ end
561
+ end
562
+
563
+ class GcpIamAuthLoginClass < Dry::Struct
564
+ attribute :identity_id, Types::String
565
+
566
+ # The path to the GCP Service Account key file.
567
+ #
568
+ # You can generate this key file by going to the GCP Console -> IAM & Admin -> Service
569
+ # Accounts -> *Select your service account* -> Keys tab -> Add key.
570
+ # Note: The key must be in JSON format.
571
+ attribute :service_account_key_file_path, Types::String
572
+
573
+ def self.from_dynamic!(d)
574
+ d = Types::Hash[d]
575
+ new(
576
+ identity_id: d.fetch("identityId"),
577
+ service_account_key_file_path: d.fetch("serviceAccountKeyFilePath"),
578
+ )
579
+ end
580
+
581
+ def self.from_json!(json)
582
+ from_dynamic!(JSON.parse(json))
583
+ end
584
+
585
+ def to_dynamic
586
+ {
587
+ "identityId" => identity_id,
588
+ "serviceAccountKeyFilePath" => service_account_key_file_path,
589
+ }
590
+ end
591
+
592
+ def to_json(options = nil)
593
+ JSON.generate(to_dynamic, options)
594
+ end
595
+ end
596
+
597
+ class GcpIDTokenAuthLoginClass < Dry::Struct
598
+ attribute :identity_id, Types::String
599
+
600
+ def self.from_dynamic!(d)
601
+ d = Types::Hash[d]
602
+ new(
603
+ identity_id: d.fetch("identityId"),
604
+ )
605
+ end
606
+
607
+ def self.from_json!(json)
608
+ from_dynamic!(JSON.parse(json))
609
+ end
610
+
611
+ def to_dynamic
612
+ {
613
+ "identityId" => identity_id,
614
+ }
615
+ end
616
+
617
+ def to_json(options = nil)
618
+ JSON.generate(to_dynamic, options)
619
+ end
620
+ end
621
+
622
+ class GetSecretOptions < Dry::Struct
623
+ attribute :environment, Types::String
624
+ attribute :include_imports, Types::Bool.optional.optional
625
+ attribute :path, Types::String.optional.optional
626
+ attribute :project_id, Types::String
627
+ attribute :secret_name, Types::String
628
+ attribute :get_secret_options_type, Types::String.optional.optional
629
+
630
+ def self.from_dynamic!(d)
631
+ d = Types::Hash[d]
632
+ new(
633
+ environment: d.fetch("environment"),
634
+ include_imports: d["includeImports"],
635
+ path: d["path"],
636
+ project_id: d.fetch("projectId"),
637
+ secret_name: d.fetch("secretName"),
638
+ get_secret_options_type: d["type"],
639
+ )
640
+ end
641
+
642
+ def self.from_json!(json)
643
+ from_dynamic!(JSON.parse(json))
644
+ end
645
+
646
+ def to_dynamic
647
+ {
648
+ "environment" => environment,
649
+ "includeImports" => include_imports,
650
+ "path" => path,
651
+ "projectId" => project_id,
652
+ "secretName" => secret_name,
653
+ "type" => get_secret_options_type,
654
+ }
655
+ end
656
+
657
+ def to_json(options = nil)
658
+ JSON.generate(to_dynamic, options)
659
+ end
660
+ end
661
+
662
+ class KubernetesAuthLoginClass < Dry::Struct
663
+
664
+ # The Infisical Identity ID that you want to authenticate to Infisical with.
665
+ attribute :identity_id, Types::String
666
+
667
+ # The path to the Kubernetes Service Account token file.
668
+ #
669
+ # If no path is provided, it will default to
670
+ # /var/run/secrets/kubernetes.io/serviceaccount/token.
671
+ attribute :service_account_token_path, Types::String.optional.optional
672
+
673
+ def self.from_dynamic!(d)
674
+ d = Types::Hash[d]
675
+ new(
676
+ identity_id: d.fetch("identityId"),
677
+ service_account_token_path: d["serviceAccountTokenPath"],
678
+ )
679
+ end
680
+
681
+ def self.from_json!(json)
682
+ from_dynamic!(JSON.parse(json))
683
+ end
684
+
685
+ def to_dynamic
686
+ {
687
+ "identityId" => identity_id,
688
+ "serviceAccountTokenPath" => service_account_token_path,
689
+ }
690
+ end
691
+
692
+ def to_json(options = nil)
693
+ JSON.generate(to_dynamic, options)
694
+ end
695
+ end
696
+
697
+ class ListSecretsOptions < Dry::Struct
698
+ attribute :attach_to_process_env, Types::Bool.optional.optional
699
+ attribute :environment, Types::String
700
+ attribute :expand_secret_references, Types::Bool.optional.optional
701
+ attribute :include_imports, Types::Bool.optional.optional
702
+ attribute :path, Types::String.optional.optional
703
+ attribute :project_id, Types::String
704
+ attribute :recursive, Types::Bool.optional.optional
705
+
706
+ def self.from_dynamic!(d)
707
+ d = Types::Hash[d]
708
+ new(
709
+ attach_to_process_env: d["attachToProcessEnv"],
710
+ environment: d.fetch("environment"),
711
+ expand_secret_references: d["expandSecretReferences"],
712
+ include_imports: d["includeImports"],
713
+ path: d["path"],
714
+ project_id: d.fetch("projectId"),
715
+ recursive: d["recursive"],
716
+ )
717
+ end
718
+
719
+ def self.from_json!(json)
720
+ from_dynamic!(JSON.parse(json))
721
+ end
722
+
723
+ def to_dynamic
724
+ {
725
+ "attachToProcessEnv" => attach_to_process_env,
726
+ "environment" => environment,
727
+ "expandSecretReferences" => expand_secret_references,
728
+ "includeImports" => include_imports,
729
+ "path" => path,
730
+ "projectId" => project_id,
731
+ "recursive" => recursive,
732
+ }
733
+ end
734
+
735
+ def to_json(options = nil)
736
+ JSON.generate(to_dynamic, options)
737
+ end
738
+ end
739
+
740
+ class UniversalAuthLoginClass < Dry::Struct
741
+ attribute :client_id, Types::String
742
+ attribute :client_secret, Types::String
743
+
744
+ def self.from_dynamic!(d)
745
+ d = Types::Hash[d]
746
+ new(
747
+ client_id: d.fetch("clientId"),
748
+ client_secret: d.fetch("clientSecret"),
749
+ )
750
+ end
751
+
752
+ def self.from_json!(json)
753
+ from_dynamic!(JSON.parse(json))
754
+ end
755
+
756
+ def to_dynamic
757
+ {
758
+ "clientId" => client_id,
759
+ "clientSecret" => client_secret,
760
+ }
761
+ end
762
+
763
+ def to_json(options = nil)
764
+ JSON.generate(to_dynamic, options)
765
+ end
766
+ end
767
+
768
+ class UpdateSecretOptions < Dry::Struct
769
+ attribute :environment, Types::String
770
+ attribute :path, Types::String.optional.optional
771
+ attribute :project_id, Types::String
772
+ attribute :secret_name, Types::String
773
+ attribute :secret_value, Types::String
774
+ attribute :skip_multiline_encoding, Types::Bool.optional.optional
775
+ attribute :update_secret_options_type, Types::String.optional.optional
776
+
777
+ def self.from_dynamic!(d)
778
+ d = Types::Hash[d]
779
+ new(
780
+ environment: d.fetch("environment"),
781
+ path: d["path"],
782
+ project_id: d.fetch("projectId"),
783
+ secret_name: d.fetch("secretName"),
784
+ secret_value: d.fetch("secretValue"),
785
+ skip_multiline_encoding: d["skipMultilineEncoding"],
786
+ update_secret_options_type: d["type"],
787
+ )
788
+ end
789
+
790
+ def self.from_json!(json)
791
+ from_dynamic!(JSON.parse(json))
792
+ end
793
+
794
+ def to_dynamic
795
+ {
796
+ "environment" => environment,
797
+ "path" => path,
798
+ "projectId" => project_id,
799
+ "secretName" => secret_name,
800
+ "secretValue" => secret_value,
801
+ "skipMultilineEncoding" => skip_multiline_encoding,
802
+ "type" => update_secret_options_type,
803
+ }
804
+ end
805
+
806
+ def to_json(options = nil)
807
+ JSON.generate(to_dynamic, options)
808
+ end
809
+ end
810
+
811
+ class Command < Dry::Struct
812
+ attribute :get_secret, GetSecretOptions.optional
813
+ attribute :list_secrets, ListSecretsOptions.optional
814
+ attribute :create_secret, CreateSecretOptions.optional
815
+ attribute :update_secret, UpdateSecretOptions.optional
816
+ attribute :delete_secret, DeleteSecretOptions.optional
817
+ attribute :create_symmetric_key, ArbitraryOptions.optional
818
+ attribute :encrypt_symmetric, EncryptSymmetricOptions.optional
819
+ attribute :decrypt_symmetric, DecryptSymmetricOptions.optional
820
+ attribute :universal_auth_login, UniversalAuthLoginClass.optional
821
+ attribute :kubernetes_auth_login, KubernetesAuthLoginClass.optional
822
+ attribute :azure_auth_login, AzureAuthLoginClass.optional
823
+ attribute :gcp_id_token_auth_login, GcpIDTokenAuthLoginClass.optional
824
+ attribute :gcp_iam_auth_login, GcpIamAuthLoginClass.optional
825
+ attribute :aws_iam_auth_login, AwsIamAuthLoginClass.optional
826
+
827
+ def self.from_dynamic!(d)
828
+ d = Types::Hash[d]
829
+ new(
830
+ get_secret: d["getSecret"] ? GetSecretOptions.from_dynamic!(d["getSecret"]) : nil,
831
+ list_secrets: d["listSecrets"] ? ListSecretsOptions.from_dynamic!(d["listSecrets"]) : nil,
832
+ create_secret: d["createSecret"] ? CreateSecretOptions.from_dynamic!(d["createSecret"]) : nil,
833
+ update_secret: d["updateSecret"] ? UpdateSecretOptions.from_dynamic!(d["updateSecret"]) : nil,
834
+ delete_secret: d["deleteSecret"] ? DeleteSecretOptions.from_dynamic!(d["deleteSecret"]) : nil,
835
+ create_symmetric_key: d["createSymmetricKey"] ? ArbitraryOptions.from_dynamic!(d["createSymmetricKey"]) : nil,
836
+ encrypt_symmetric: d["encryptSymmetric"] ? EncryptSymmetricOptions.from_dynamic!(d["encryptSymmetric"]) : nil,
837
+ decrypt_symmetric: d["decryptSymmetric"] ? DecryptSymmetricOptions.from_dynamic!(d["decryptSymmetric"]) : nil,
838
+ universal_auth_login: d["universalAuthLogin"] ? UniversalAuthLoginClass.from_dynamic!(d["universalAuthLogin"]) : nil,
839
+ kubernetes_auth_login: d["kubernetesAuthLogin"] ? KubernetesAuthLoginClass.from_dynamic!(d["kubernetesAuthLogin"]) : nil,
840
+ azure_auth_login: d["azureAuthLogin"] ? AzureAuthLoginClass.from_dynamic!(d["azureAuthLogin"]) : nil,
841
+ gcp_id_token_auth_login: d["gcpIdTokenAuthLogin"] ? GcpIDTokenAuthLoginClass.from_dynamic!(d["gcpIdTokenAuthLogin"]) : nil,
842
+ gcp_iam_auth_login: d["gcpIamAuthLogin"] ? GcpIamAuthLoginClass.from_dynamic!(d["gcpIamAuthLogin"]) : nil,
843
+ aws_iam_auth_login: d["awsIamAuthLogin"] ? AwsIamAuthLoginClass.from_dynamic!(d["awsIamAuthLogin"]) : nil,
844
+ )
845
+ end
846
+
847
+ def self.from_json!(json)
848
+ from_dynamic!(JSON.parse(json))
849
+ end
850
+
851
+ def to_dynamic
852
+ {
853
+ "getSecret" => get_secret&.to_dynamic,
854
+ "listSecrets" => list_secrets&.to_dynamic,
855
+ "createSecret" => create_secret&.to_dynamic,
856
+ "updateSecret" => update_secret&.to_dynamic,
857
+ "deleteSecret" => delete_secret&.to_dynamic,
858
+ "createSymmetricKey" => create_symmetric_key&.to_dynamic,
859
+ "encryptSymmetric" => encrypt_symmetric&.to_dynamic,
860
+ "decryptSymmetric" => decrypt_symmetric&.to_dynamic,
861
+ "universalAuthLogin" => universal_auth_login&.to_dynamic,
862
+ "kubernetesAuthLogin" => kubernetes_auth_login&.to_dynamic,
863
+ "azureAuthLogin" => azure_auth_login&.to_dynamic,
864
+ "gcpIdTokenAuthLogin" => gcp_id_token_auth_login&.to_dynamic,
865
+ "gcpIamAuthLogin" => gcp_iam_auth_login&.to_dynamic,
866
+ "awsIamAuthLogin" => aws_iam_auth_login&.to_dynamic,
867
+ }
868
+ end
869
+
870
+ def to_json(options = nil)
871
+ JSON.generate(to_dynamic, options)
872
+ end
873
+ end
874
+
875
+ class AccessTokenSuccessResponse < Dry::Struct
876
+ attribute :access_token, Types::String
877
+ attribute :access_token_max_ttl, Types::Integer
878
+ attribute :expires_in, Types::Integer
879
+ attribute :token_type, Types::String
880
+
881
+ def self.from_dynamic!(d)
882
+ d = Types::Hash[d]
883
+ new(
884
+ access_token: d.fetch("accessToken"),
885
+ access_token_max_ttl: d.fetch("accessTokenMaxTTL"),
886
+ expires_in: d.fetch("expiresIn"),
887
+ token_type: d.fetch("tokenType"),
888
+ )
889
+ end
890
+
891
+ def self.from_json!(json)
892
+ from_dynamic!(JSON.parse(json))
893
+ end
894
+
895
+ def to_dynamic
896
+ {
897
+ "accessToken" => access_token,
898
+ "accessTokenMaxTTL" => access_token_max_ttl,
899
+ "expiresIn" => expires_in,
900
+ "tokenType" => token_type,
901
+ }
902
+ end
903
+
904
+ def to_json(options = nil)
905
+ JSON.generate(to_dynamic, options)
906
+ end
907
+ end
908
+
909
+ class ResponseForAccessTokenSuccessResponse < Dry::Struct
910
+
911
+ # The response data. Populated if `success` is true.
912
+ attribute :data, AccessTokenSuccessResponse.optional.optional
913
+
914
+ # A message for any error that may occur. Populated if `success` is false.
915
+ attribute :error_message, Types::String.optional.optional
916
+
917
+ # Whether or not the SDK request succeeded.
918
+ attribute :success, Types::Bool
919
+
920
+ def self.from_dynamic!(d)
921
+ d = Types::Hash[d]
922
+ new(
923
+ data: d["data"] ? AccessTokenSuccessResponse.from_dynamic!(d["data"]) : nil,
924
+ error_message: d["errorMessage"],
925
+ success: d.fetch("success"),
926
+ )
927
+ end
928
+
929
+ def self.from_json!(json)
930
+ from_dynamic!(JSON.parse(json))
931
+ end
932
+
933
+ def to_dynamic
934
+ {
935
+ "data" => data&.to_dynamic,
936
+ "errorMessage" => error_message,
937
+ "success" => success,
938
+ }
939
+ end
940
+
941
+ def to_json(options = nil)
942
+ JSON.generate(to_dynamic, options)
943
+ end
944
+ end
945
+
946
+ class CreateSecretResponseSecret < Dry::Struct
947
+ attribute :environment, Types::String
948
+ attribute :is_fallback, Types::Bool.optional
949
+ attribute :secret_comment, Types::String
950
+ attribute :secret_key, Types::String
951
+
952
+ # The path of the secret.
953
+ #
954
+ # Note that this will only be present when using the `list secrets` method.
955
+ attribute :secret_path, Types::String.optional.optional
956
+
957
+ attribute :secret_value, Types::String
958
+ attribute :secret_type, Types::String
959
+ attribute :version, Types::Integer
960
+ attribute :workspace, Types::String
961
+
962
+ def self.from_dynamic!(d)
963
+ d = Types::Hash[d]
964
+ new(
965
+ environment: d.fetch("environment"),
966
+ is_fallback: d["isFallback"],
967
+ secret_comment: d.fetch("secretComment"),
968
+ secret_key: d.fetch("secretKey"),
969
+ secret_path: d["secretPath"],
970
+ secret_value: d.fetch("secretValue"),
971
+ secret_type: d.fetch("type"),
972
+ version: d.fetch("version"),
973
+ workspace: d.fetch("workspace"),
974
+ )
975
+ end
976
+
977
+ def self.from_json!(json)
978
+ from_dynamic!(JSON.parse(json))
979
+ end
980
+
981
+ def to_dynamic
982
+ {
983
+ "environment" => environment,
984
+ "isFallback" => is_fallback,
985
+ "secretComment" => secret_comment,
986
+ "secretKey" => secret_key,
987
+ "secretPath" => secret_path,
988
+ "secretValue" => secret_value,
989
+ "type" => secret_type,
990
+ "version" => version,
991
+ "workspace" => workspace,
992
+ }
993
+ end
994
+
995
+ def to_json(options = nil)
996
+ JSON.generate(to_dynamic, options)
997
+ end
998
+ end
999
+
1000
+ class CreateSecretResponse < Dry::Struct
1001
+ attribute :secret, CreateSecretResponseSecret
1002
+
1003
+ def self.from_dynamic!(d)
1004
+ d = Types::Hash[d]
1005
+ new(
1006
+ secret: CreateSecretResponseSecret.from_dynamic!(d.fetch("secret")),
1007
+ )
1008
+ end
1009
+
1010
+ def self.from_json!(json)
1011
+ from_dynamic!(JSON.parse(json))
1012
+ end
1013
+
1014
+ def to_dynamic
1015
+ {
1016
+ "secret" => secret.to_dynamic,
1017
+ }
1018
+ end
1019
+
1020
+ def to_json(options = nil)
1021
+ JSON.generate(to_dynamic, options)
1022
+ end
1023
+ end
1024
+
1025
+ class ResponseForCreateSecretResponse < Dry::Struct
1026
+
1027
+ # The response data. Populated if `success` is true.
1028
+ attribute :data, CreateSecretResponse.optional.optional
1029
+
1030
+ # A message for any error that may occur. Populated if `success` is false.
1031
+ attribute :error_message, Types::String.optional.optional
1032
+
1033
+ # Whether or not the SDK request succeeded.
1034
+ attribute :success, Types::Bool
1035
+
1036
+ def self.from_dynamic!(d)
1037
+ d = Types::Hash[d]
1038
+ new(
1039
+ data: d["data"] ? CreateSecretResponse.from_dynamic!(d["data"]) : nil,
1040
+ error_message: d["errorMessage"],
1041
+ success: d.fetch("success"),
1042
+ )
1043
+ end
1044
+
1045
+ def self.from_json!(json)
1046
+ from_dynamic!(JSON.parse(json))
1047
+ end
1048
+
1049
+ def to_dynamic
1050
+ {
1051
+ "data" => data&.to_dynamic,
1052
+ "errorMessage" => error_message,
1053
+ "success" => success,
1054
+ }
1055
+ end
1056
+
1057
+ def to_json(options = nil)
1058
+ JSON.generate(to_dynamic, options)
1059
+ end
1060
+ end
1061
+
1062
+ class CreateSymmetricKeyResponse < Dry::Struct
1063
+ attribute :key, Types::String
1064
+
1065
+ def self.from_dynamic!(d)
1066
+ d = Types::Hash[d]
1067
+ new(
1068
+ key: d.fetch("key"),
1069
+ )
1070
+ end
1071
+
1072
+ def self.from_json!(json)
1073
+ from_dynamic!(JSON.parse(json))
1074
+ end
1075
+
1076
+ def to_dynamic
1077
+ {
1078
+ "key" => key,
1079
+ }
1080
+ end
1081
+
1082
+ def to_json(options = nil)
1083
+ JSON.generate(to_dynamic, options)
1084
+ end
1085
+ end
1086
+
1087
+ class ResponseForCreateSymmetricKeyResponse < Dry::Struct
1088
+
1089
+ # The response data. Populated if `success` is true.
1090
+ attribute :data, CreateSymmetricKeyResponse.optional.optional
1091
+
1092
+ # A message for any error that may occur. Populated if `success` is false.
1093
+ attribute :error_message, Types::String.optional.optional
1094
+
1095
+ # Whether or not the SDK request succeeded.
1096
+ attribute :success, Types::Bool
1097
+
1098
+ def self.from_dynamic!(d)
1099
+ d = Types::Hash[d]
1100
+ new(
1101
+ data: d["data"] ? CreateSymmetricKeyResponse.from_dynamic!(d["data"]) : nil,
1102
+ error_message: d["errorMessage"],
1103
+ success: d.fetch("success"),
1104
+ )
1105
+ end
1106
+
1107
+ def self.from_json!(json)
1108
+ from_dynamic!(JSON.parse(json))
1109
+ end
1110
+
1111
+ def to_dynamic
1112
+ {
1113
+ "data" => data&.to_dynamic,
1114
+ "errorMessage" => error_message,
1115
+ "success" => success,
1116
+ }
1117
+ end
1118
+
1119
+ def to_json(options = nil)
1120
+ JSON.generate(to_dynamic, options)
1121
+ end
1122
+ end
1123
+
1124
+ class DecryptSymmetricResponse < Dry::Struct
1125
+ attribute :decrypted, Types::String
1126
+
1127
+ def self.from_dynamic!(d)
1128
+ d = Types::Hash[d]
1129
+ new(
1130
+ decrypted: d.fetch("decrypted"),
1131
+ )
1132
+ end
1133
+
1134
+ def self.from_json!(json)
1135
+ from_dynamic!(JSON.parse(json))
1136
+ end
1137
+
1138
+ def to_dynamic
1139
+ {
1140
+ "decrypted" => decrypted,
1141
+ }
1142
+ end
1143
+
1144
+ def to_json(options = nil)
1145
+ JSON.generate(to_dynamic, options)
1146
+ end
1147
+ end
1148
+
1149
+ class ResponseForDecryptSymmetricResponse < Dry::Struct
1150
+
1151
+ # The response data. Populated if `success` is true.
1152
+ attribute :data, DecryptSymmetricResponse.optional.optional
1153
+
1154
+ # A message for any error that may occur. Populated if `success` is false.
1155
+ attribute :error_message, Types::String.optional.optional
1156
+
1157
+ # Whether or not the SDK request succeeded.
1158
+ attribute :success, Types::Bool
1159
+
1160
+ def self.from_dynamic!(d)
1161
+ d = Types::Hash[d]
1162
+ new(
1163
+ data: d["data"] ? DecryptSymmetricResponse.from_dynamic!(d["data"]) : nil,
1164
+ error_message: d["errorMessage"],
1165
+ success: d.fetch("success"),
1166
+ )
1167
+ end
1168
+
1169
+ def self.from_json!(json)
1170
+ from_dynamic!(JSON.parse(json))
1171
+ end
1172
+
1173
+ def to_dynamic
1174
+ {
1175
+ "data" => data&.to_dynamic,
1176
+ "errorMessage" => error_message,
1177
+ "success" => success,
1178
+ }
1179
+ end
1180
+
1181
+ def to_json(options = nil)
1182
+ JSON.generate(to_dynamic, options)
1183
+ end
1184
+ end
1185
+
1186
+ class DeleteSecretResponseSecret < Dry::Struct
1187
+ attribute :environment, Types::String
1188
+ attribute :is_fallback, Types::Bool.optional
1189
+ attribute :secret_comment, Types::String
1190
+ attribute :secret_key, Types::String
1191
+
1192
+ # The path of the secret.
1193
+ #
1194
+ # Note that this will only be present when using the `list secrets` method.
1195
+ attribute :secret_path, Types::String.optional.optional
1196
+
1197
+ attribute :secret_value, Types::String
1198
+ attribute :secret_type, Types::String
1199
+ attribute :version, Types::Integer
1200
+ attribute :workspace, Types::String
1201
+
1202
+ def self.from_dynamic!(d)
1203
+ d = Types::Hash[d]
1204
+ new(
1205
+ environment: d.fetch("environment"),
1206
+ is_fallback: d["isFallback"],
1207
+ secret_comment: d.fetch("secretComment"),
1208
+ secret_key: d.fetch("secretKey"),
1209
+ secret_path: d["secretPath"],
1210
+ secret_value: d.fetch("secretValue"),
1211
+ secret_type: d.fetch("type"),
1212
+ version: d.fetch("version"),
1213
+ workspace: d.fetch("workspace"),
1214
+ )
1215
+ end
1216
+
1217
+ def self.from_json!(json)
1218
+ from_dynamic!(JSON.parse(json))
1219
+ end
1220
+
1221
+ def to_dynamic
1222
+ {
1223
+ "environment" => environment,
1224
+ "isFallback" => is_fallback,
1225
+ "secretComment" => secret_comment,
1226
+ "secretKey" => secret_key,
1227
+ "secretPath" => secret_path,
1228
+ "secretValue" => secret_value,
1229
+ "type" => secret_type,
1230
+ "version" => version,
1231
+ "workspace" => workspace,
1232
+ }
1233
+ end
1234
+
1235
+ def to_json(options = nil)
1236
+ JSON.generate(to_dynamic, options)
1237
+ end
1238
+ end
1239
+
1240
+ class DeleteSecretResponse < Dry::Struct
1241
+ attribute :secret, DeleteSecretResponseSecret
1242
+
1243
+ def self.from_dynamic!(d)
1244
+ d = Types::Hash[d]
1245
+ new(
1246
+ secret: DeleteSecretResponseSecret.from_dynamic!(d.fetch("secret")),
1247
+ )
1248
+ end
1249
+
1250
+ def self.from_json!(json)
1251
+ from_dynamic!(JSON.parse(json))
1252
+ end
1253
+
1254
+ def to_dynamic
1255
+ {
1256
+ "secret" => secret.to_dynamic,
1257
+ }
1258
+ end
1259
+
1260
+ def to_json(options = nil)
1261
+ JSON.generate(to_dynamic, options)
1262
+ end
1263
+ end
1264
+
1265
+ class ResponseForDeleteSecretResponse < Dry::Struct
1266
+
1267
+ # The response data. Populated if `success` is true.
1268
+ attribute :data, DeleteSecretResponse.optional.optional
1269
+
1270
+ # A message for any error that may occur. Populated if `success` is false.
1271
+ attribute :error_message, Types::String.optional.optional
1272
+
1273
+ # Whether or not the SDK request succeeded.
1274
+ attribute :success, Types::Bool
1275
+
1276
+ def self.from_dynamic!(d)
1277
+ d = Types::Hash[d]
1278
+ new(
1279
+ data: d["data"] ? DeleteSecretResponse.from_dynamic!(d["data"]) : nil,
1280
+ error_message: d["errorMessage"],
1281
+ success: d.fetch("success"),
1282
+ )
1283
+ end
1284
+
1285
+ def self.from_json!(json)
1286
+ from_dynamic!(JSON.parse(json))
1287
+ end
1288
+
1289
+ def to_dynamic
1290
+ {
1291
+ "data" => data&.to_dynamic,
1292
+ "errorMessage" => error_message,
1293
+ "success" => success,
1294
+ }
1295
+ end
1296
+
1297
+ def to_json(options = nil)
1298
+ JSON.generate(to_dynamic, options)
1299
+ end
1300
+ end
1301
+
1302
+ class EncryptSymmetricResponse < Dry::Struct
1303
+ attribute :ciphertext, Types::String
1304
+ attribute :iv, Types::String
1305
+ attribute :tag, Types::String
1306
+
1307
+ def self.from_dynamic!(d)
1308
+ d = Types::Hash[d]
1309
+ new(
1310
+ ciphertext: d.fetch("ciphertext"),
1311
+ iv: d.fetch("iv"),
1312
+ tag: d.fetch("tag"),
1313
+ )
1314
+ end
1315
+
1316
+ def self.from_json!(json)
1317
+ from_dynamic!(JSON.parse(json))
1318
+ end
1319
+
1320
+ def to_dynamic
1321
+ {
1322
+ "ciphertext" => ciphertext,
1323
+ "iv" => iv,
1324
+ "tag" => tag,
1325
+ }
1326
+ end
1327
+
1328
+ def to_json(options = nil)
1329
+ JSON.generate(to_dynamic, options)
1330
+ end
1331
+ end
1332
+
1333
+ class ResponseForEncryptSymmetricResponse < Dry::Struct
1334
+
1335
+ # The response data. Populated if `success` is true.
1336
+ attribute :data, EncryptSymmetricResponse.optional.optional
1337
+
1338
+ # A message for any error that may occur. Populated if `success` is false.
1339
+ attribute :error_message, Types::String.optional.optional
1340
+
1341
+ # Whether or not the SDK request succeeded.
1342
+ attribute :success, Types::Bool
1343
+
1344
+ def self.from_dynamic!(d)
1345
+ d = Types::Hash[d]
1346
+ new(
1347
+ data: d["data"] ? EncryptSymmetricResponse.from_dynamic!(d["data"]) : nil,
1348
+ error_message: d["errorMessage"],
1349
+ success: d.fetch("success"),
1350
+ )
1351
+ end
1352
+
1353
+ def self.from_json!(json)
1354
+ from_dynamic!(JSON.parse(json))
1355
+ end
1356
+
1357
+ def to_dynamic
1358
+ {
1359
+ "data" => data&.to_dynamic,
1360
+ "errorMessage" => error_message,
1361
+ "success" => success,
1362
+ }
1363
+ end
1364
+
1365
+ def to_json(options = nil)
1366
+ JSON.generate(to_dynamic, options)
1367
+ end
1368
+ end
1369
+
1370
+ class GetSecretResponseSecret < Dry::Struct
1371
+ attribute :environment, Types::String
1372
+ attribute :is_fallback, Types::Bool.optional
1373
+ attribute :secret_comment, Types::String
1374
+ attribute :secret_key, Types::String
1375
+
1376
+ # The path of the secret.
1377
+ #
1378
+ # Note that this will only be present when using the `list secrets` method.
1379
+ attribute :secret_path, Types::String.optional.optional
1380
+
1381
+ attribute :secret_value, Types::String
1382
+ attribute :secret_type, Types::String
1383
+ attribute :version, Types::Integer
1384
+ attribute :workspace, Types::String
1385
+
1386
+ def self.from_dynamic!(d)
1387
+ d = Types::Hash[d]
1388
+ new(
1389
+ environment: d.fetch("environment"),
1390
+ is_fallback: d["isFallback"],
1391
+ secret_comment: d.fetch("secretComment"),
1392
+ secret_key: d.fetch("secretKey"),
1393
+ secret_path: d["secretPath"],
1394
+ secret_value: d.fetch("secretValue"),
1395
+ secret_type: d.fetch("type"),
1396
+ version: d.fetch("version"),
1397
+ workspace: d.fetch("workspace"),
1398
+ )
1399
+ end
1400
+
1401
+ def self.from_json!(json)
1402
+ from_dynamic!(JSON.parse(json))
1403
+ end
1404
+
1405
+ def to_dynamic
1406
+ {
1407
+ "environment" => environment,
1408
+ "isFallback" => is_fallback,
1409
+ "secretComment" => secret_comment,
1410
+ "secretKey" => secret_key,
1411
+ "secretPath" => secret_path,
1412
+ "secretValue" => secret_value,
1413
+ "type" => secret_type,
1414
+ "version" => version,
1415
+ "workspace" => workspace,
1416
+ }
1417
+ end
1418
+
1419
+ def to_json(options = nil)
1420
+ JSON.generate(to_dynamic, options)
1421
+ end
1422
+ end
1423
+
1424
+ class GetSecretResponse < Dry::Struct
1425
+ attribute :secret, GetSecretResponseSecret
1426
+
1427
+ def self.from_dynamic!(d)
1428
+ d = Types::Hash[d]
1429
+ new(
1430
+ secret: GetSecretResponseSecret.from_dynamic!(d.fetch("secret")),
1431
+ )
1432
+ end
1433
+
1434
+ def self.from_json!(json)
1435
+ from_dynamic!(JSON.parse(json))
1436
+ end
1437
+
1438
+ def to_dynamic
1439
+ {
1440
+ "secret" => secret.to_dynamic,
1441
+ }
1442
+ end
1443
+
1444
+ def to_json(options = nil)
1445
+ JSON.generate(to_dynamic, options)
1446
+ end
1447
+ end
1448
+
1449
+ class ResponseForGetSecretResponse < Dry::Struct
1450
+
1451
+ # The response data. Populated if `success` is true.
1452
+ attribute :data, GetSecretResponse.optional.optional
1453
+
1454
+ # A message for any error that may occur. Populated if `success` is false.
1455
+ attribute :error_message, Types::String.optional.optional
1456
+
1457
+ # Whether or not the SDK request succeeded.
1458
+ attribute :success, Types::Bool
1459
+
1460
+ def self.from_dynamic!(d)
1461
+ d = Types::Hash[d]
1462
+ new(
1463
+ data: d["data"] ? GetSecretResponse.from_dynamic!(d["data"]) : nil,
1464
+ error_message: d["errorMessage"],
1465
+ success: d.fetch("success"),
1466
+ )
1467
+ end
1468
+
1469
+ def self.from_json!(json)
1470
+ from_dynamic!(JSON.parse(json))
1471
+ end
1472
+
1473
+ def to_dynamic
1474
+ {
1475
+ "data" => data&.to_dynamic,
1476
+ "errorMessage" => error_message,
1477
+ "success" => success,
1478
+ }
1479
+ end
1480
+
1481
+ def to_json(options = nil)
1482
+ JSON.generate(to_dynamic, options)
1483
+ end
1484
+ end
1485
+
1486
+ class SecretElement < Dry::Struct
1487
+ attribute :environment, Types::String
1488
+ attribute :is_fallback, Types::Bool.optional
1489
+ attribute :secret_comment, Types::String
1490
+ attribute :secret_key, Types::String
1491
+
1492
+ # The path of the secret.
1493
+ #
1494
+ # Note that this will only be present when using the `list secrets` method.
1495
+ attribute :secret_path, Types::String.optional.optional
1496
+
1497
+ attribute :secret_value, Types::String
1498
+ attribute :secret_type, Types::String
1499
+ attribute :version, Types::Integer
1500
+ attribute :workspace, Types::String
1501
+
1502
+ def self.from_dynamic!(d)
1503
+ d = Types::Hash[d]
1504
+ new(
1505
+ environment: d.fetch("environment"),
1506
+ is_fallback: d["isFallback"],
1507
+ secret_comment: d.fetch("secretComment"),
1508
+ secret_key: d.fetch("secretKey"),
1509
+ secret_path: d["secretPath"],
1510
+ secret_value: d.fetch("secretValue"),
1511
+ secret_type: d.fetch("type"),
1512
+ version: d.fetch("version"),
1513
+ workspace: d.fetch("workspace"),
1514
+ )
1515
+ end
1516
+
1517
+ def self.from_json!(json)
1518
+ from_dynamic!(JSON.parse(json))
1519
+ end
1520
+
1521
+ def to_dynamic
1522
+ {
1523
+ "environment" => environment,
1524
+ "isFallback" => is_fallback,
1525
+ "secretComment" => secret_comment,
1526
+ "secretKey" => secret_key,
1527
+ "secretPath" => secret_path,
1528
+ "secretValue" => secret_value,
1529
+ "type" => secret_type,
1530
+ "version" => version,
1531
+ "workspace" => workspace,
1532
+ }
1533
+ end
1534
+
1535
+ def to_json(options = nil)
1536
+ JSON.generate(to_dynamic, options)
1537
+ end
1538
+ end
1539
+
1540
+ class ListSecretsResponse < Dry::Struct
1541
+ attribute :secrets, Types.Array(SecretElement)
1542
+
1543
+ def self.from_dynamic!(d)
1544
+ d = Types::Hash[d]
1545
+ new(
1546
+ secrets: d.fetch("secrets").map { |x| SecretElement.from_dynamic!(x) },
1547
+ )
1548
+ end
1549
+
1550
+ def self.from_json!(json)
1551
+ from_dynamic!(JSON.parse(json))
1552
+ end
1553
+
1554
+ def to_dynamic
1555
+ {
1556
+ "secrets" => secrets.map { |x| x.to_dynamic },
1557
+ }
1558
+ end
1559
+
1560
+ def to_json(options = nil)
1561
+ JSON.generate(to_dynamic, options)
1562
+ end
1563
+ end
1564
+
1565
+ class ResponseForListSecretsResponse < Dry::Struct
1566
+
1567
+ # The response data. Populated if `success` is true.
1568
+ attribute :data, ListSecretsResponse.optional.optional
1569
+
1570
+ # A message for any error that may occur. Populated if `success` is false.
1571
+ attribute :error_message, Types::String.optional.optional
1572
+
1573
+ # Whether or not the SDK request succeeded.
1574
+ attribute :success, Types::Bool
1575
+
1576
+ def self.from_dynamic!(d)
1577
+ d = Types::Hash[d]
1578
+ new(
1579
+ data: d["data"] ? ListSecretsResponse.from_dynamic!(d["data"]) : nil,
1580
+ error_message: d["errorMessage"],
1581
+ success: d.fetch("success"),
1582
+ )
1583
+ end
1584
+
1585
+ def self.from_json!(json)
1586
+ from_dynamic!(JSON.parse(json))
1587
+ end
1588
+
1589
+ def to_dynamic
1590
+ {
1591
+ "data" => data&.to_dynamic,
1592
+ "errorMessage" => error_message,
1593
+ "success" => success,
1594
+ }
1595
+ end
1596
+
1597
+ def to_json(options = nil)
1598
+ JSON.generate(to_dynamic, options)
1599
+ end
1600
+ end
1601
+
1602
+ class UpdateSecretResponseSecret < Dry::Struct
1603
+ attribute :environment, Types::String
1604
+ attribute :is_fallback, Types::Bool.optional
1605
+ attribute :secret_comment, Types::String
1606
+ attribute :secret_key, Types::String
1607
+
1608
+ # The path of the secret.
1609
+ #
1610
+ # Note that this will only be present when using the `list secrets` method.
1611
+ attribute :secret_path, Types::String.optional.optional
1612
+
1613
+ attribute :secret_value, Types::String
1614
+ attribute :secret_type, Types::String
1615
+ attribute :version, Types::Integer
1616
+ attribute :workspace, Types::String
1617
+
1618
+ def self.from_dynamic!(d)
1619
+ d = Types::Hash[d]
1620
+ new(
1621
+ environment: d.fetch("environment"),
1622
+ is_fallback: d["isFallback"],
1623
+ secret_comment: d.fetch("secretComment"),
1624
+ secret_key: d.fetch("secretKey"),
1625
+ secret_path: d["secretPath"],
1626
+ secret_value: d.fetch("secretValue"),
1627
+ secret_type: d.fetch("type"),
1628
+ version: d.fetch("version"),
1629
+ workspace: d.fetch("workspace"),
1630
+ )
1631
+ end
1632
+
1633
+ def self.from_json!(json)
1634
+ from_dynamic!(JSON.parse(json))
1635
+ end
1636
+
1637
+ def to_dynamic
1638
+ {
1639
+ "environment" => environment,
1640
+ "isFallback" => is_fallback,
1641
+ "secretComment" => secret_comment,
1642
+ "secretKey" => secret_key,
1643
+ "secretPath" => secret_path,
1644
+ "secretValue" => secret_value,
1645
+ "type" => secret_type,
1646
+ "version" => version,
1647
+ "workspace" => workspace,
1648
+ }
1649
+ end
1650
+
1651
+ def to_json(options = nil)
1652
+ JSON.generate(to_dynamic, options)
1653
+ end
1654
+ end
1655
+
1656
+ class UpdateSecretResponse < Dry::Struct
1657
+ attribute :secret, UpdateSecretResponseSecret
1658
+
1659
+ def self.from_dynamic!(d)
1660
+ d = Types::Hash[d]
1661
+ new(
1662
+ secret: UpdateSecretResponseSecret.from_dynamic!(d.fetch("secret")),
1663
+ )
1664
+ end
1665
+
1666
+ def self.from_json!(json)
1667
+ from_dynamic!(JSON.parse(json))
1668
+ end
1669
+
1670
+ def to_dynamic
1671
+ {
1672
+ "secret" => secret.to_dynamic,
1673
+ }
1674
+ end
1675
+
1676
+ def to_json(options = nil)
1677
+ JSON.generate(to_dynamic, options)
1678
+ end
1679
+ end
1680
+
1681
+ class ResponseForUpdateSecretResponse < Dry::Struct
1682
+
1683
+ # The response data. Populated if `success` is true.
1684
+ attribute :data, UpdateSecretResponse.optional.optional
1685
+
1686
+ # A message for any error that may occur. Populated if `success` is false.
1687
+ attribute :error_message, Types::String.optional.optional
1688
+
1689
+ # Whether or not the SDK request succeeded.
1690
+ attribute :success, Types::Bool
1691
+
1692
+ def self.from_dynamic!(d)
1693
+ d = Types::Hash[d]
1694
+ new(
1695
+ data: d["data"] ? UpdateSecretResponse.from_dynamic!(d["data"]) : nil,
1696
+ error_message: d["errorMessage"],
1697
+ success: d.fetch("success"),
1698
+ )
1699
+ end
1700
+
1701
+ def self.from_json!(json)
1702
+ from_dynamic!(JSON.parse(json))
1703
+ end
1704
+
1705
+ def to_dynamic
1706
+ {
1707
+ "data" => data&.to_dynamic,
1708
+ "errorMessage" => error_message,
1709
+ "success" => success,
1710
+ }
1711
+ end
1712
+
1713
+ def to_json(options = nil)
1714
+ JSON.generate(to_dynamic, options)
1715
+ end
1716
+ end
1717
+