comet_backup_ruby_sdk 2.9.0 → 2.11.0
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.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/.rubocop.yml +0 -0
- data/CHANGELOG.md +16 -0
- data/Gemfile +0 -0
- data/Gemfile.lock +1 -1
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +137 -1
- data/lib/comet/definitions.rb +47 -9
- data/lib/comet/models/admin_account_properties_response.rb +1 -0
- data/lib/comet/models/admin_security_options.rb +4 -0
- data/lib/comet/models/admin_u2fregistration.rb +2 -0
- data/lib/comet/models/admin_user_permissions.rb +81 -0
- data/lib/comet/models/admin_web_authn_registration.rb +2 -0
- data/lib/comet/models/allowed_admin_user.rb +4 -0
- data/lib/comet/models/authentication_role_options.rb +2 -0
- data/lib/comet/models/branding_options.rb +6 -1
- data/lib/comet/models/branding_properties.rb +6 -1
- data/lib/comet/models/bucket_properties.rb +2 -0
- data/lib/comet/models/constellation_stats.rb +5 -0
- data/lib/comet/models/device_config.rb +12 -0
- data/lib/comet/models/email_reporting_option.rb +2 -0
- data/lib/comet/models/external_authentication_source.rb +10 -0
- data/lib/comet/models/external_authentication_source_display.rb +82 -0
- data/lib/comet/models/external_authentication_source_response.rb +99 -0
- data/lib/comet/models/external_ldapauthentication_source_server.rb +1 -0
- data/lib/comet/models/external_ldapauthentication_source_settings.rb +1 -0
- data/lib/comet/models/install_token.rb +5 -0
- data/lib/comet/models/mac_oscode_sign_properties.rb +6 -0
- data/lib/comet/models/mssqlconnection.rb +3 -0
- data/lib/comet/models/news_entry.rb +1 -0
- data/lib/comet/models/oidc_claim.rb +84 -0
- data/lib/comet/models/oidc_config.rb +203 -0
- data/lib/comet/models/osinfo.rb +30 -0
- data/lib/comet/models/partition.rb +5 -0
- data/lib/comet/models/private_branding_properties.rb +6 -1
- data/lib/comet/models/psaconfig.rb +4 -0
- data/lib/comet/models/remote_server_address.rb +10 -0
- data/lib/comet/models/remote_storage_option.rb +10 -0
- data/lib/comet/models/replica_server.rb +10 -0
- data/lib/comet/models/restore_job_advanced_options.rb +19 -0
- data/lib/comet/models/retention_range.rb +8 -0
- data/lib/comet/models/search_clause.rb +16 -0
- data/lib/comet/models/self_backup_export_options.rb +1 -0
- data/lib/comet/models/self_backup_target.rb +1 -0
- data/lib/comet/models/server_config_options.rb +1 -0
- data/lib/comet/models/server_meta_branding_properties.rb +19 -0
- data/lib/comet/models/server_meta_version_info.rb +2 -0
- data/lib/comet/models/session_key_regenerated_response.rb +2 -0
- data/lib/comet/models/single_field_source.rb +1 -0
- data/lib/comet/models/software_update_news_response.rb +4 -0
- data/lib/comet/models/source_basic_info.rb +2 -0
- data/lib/comet/models/source_config.rb +20 -0
- data/lib/comet/models/storage_role_options.rb +1 -0
- data/lib/comet/models/totp_regenerated_response.rb +3 -0
- data/lib/comet/models/update_campaign_device_status.rb +1 -0
- data/lib/comet/models/update_campaign_properties.rb +1 -0
- data/lib/comet/models/update_campaign_status.rb +1 -0
- data/lib/comet/models/update_campaign_status_device_entry.rb +1 -0
- data/lib/comet/models/user_policy.rb +6 -0
- data/lib/comet/models/vault_snapshot.rb +1 -0
- data/lib/comet/models/vsscomponent.rb +1 -0
- data/lib/comet/models/web_authn_credential.rb +2 -0
- data/lib/comet/models/web_authn_credential_descriptor.rb +1 -0
- data/lib/comet/models/web_authn_public_key_credential_creation_options.rb +1 -0
- data/lib/comet/models/web_authn_public_key_credential_request_options.rb +1 -0
- data/lib/comet/models/web_authn_user_entity.rb +1 -0
- data/lib/comet/models/windows_code_sign_properties.rb +5 -1
- data/lib/comet_backup_ruby_sdk.rb +4 -0
- metadata +6 -2
@@ -36,6 +36,7 @@ module Comet
|
|
36
36
|
# @type [Boolean] hide_background_logo
|
37
37
|
attr_accessor :hide_background_logo
|
38
38
|
|
39
|
+
# One of the CLIENTBRANDINGBUILD_ constants
|
39
40
|
# @type [Number] build_mode
|
40
41
|
attr_accessor :build_mode
|
41
42
|
|
@@ -63,12 +64,14 @@ module Comet
|
|
63
64
|
# @type [String] package_identifier
|
64
65
|
attr_accessor :package_identifier
|
65
66
|
|
67
|
+
# One of the WINDOWSCODESIGN_METHOD_ constants
|
66
68
|
# @type [Number] windows_code_sign_method
|
67
69
|
attr_accessor :windows_code_sign_method
|
68
70
|
|
69
71
|
# @type [String] windows_code_sign_pkcs12file_path
|
70
72
|
attr_accessor :windows_code_sign_pkcs12file_path
|
71
73
|
|
74
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
72
75
|
# @type [Number] windows_code_sign_pkcs12password_format
|
73
76
|
attr_accessor :windows_code_sign_pkcs12password_format
|
74
77
|
|
@@ -81,13 +84,14 @@ module Comet
|
|
81
84
|
# @type [String] windows_code_sign_pkcs11module
|
82
85
|
attr_accessor :windows_code_sign_pkcs11module
|
83
86
|
|
87
|
+
# This field was deprecated between 23.3.0 and 23.6.x, but is now used again.
|
84
88
|
# @type [String] windows_code_sign_pkcs11certfile
|
85
|
-
# @deprecated This member has been deprecated since Comet version 22.12.7
|
86
89
|
attr_accessor :windows_code_sign_pkcs11certfile
|
87
90
|
|
88
91
|
# @type [String] windows_code_sign_pkcs11key_id
|
89
92
|
attr_accessor :windows_code_sign_pkcs11key_id
|
90
93
|
|
94
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
91
95
|
# @type [Number] windows_code_sign_pkcs11password_format
|
92
96
|
attr_accessor :windows_code_sign_pkcs11password_format
|
93
97
|
|
@@ -103,6 +107,7 @@ module Comet
|
|
103
107
|
# @type [String] windows_code_sign_azure_app_id
|
104
108
|
attr_accessor :windows_code_sign_azure_app_id
|
105
109
|
|
110
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
106
111
|
# @type [Number] windows_code_sign_azure_app_secret_format
|
107
112
|
attr_accessor :windows_code_sign_azure_app_secret_format
|
108
113
|
|
@@ -15,9 +15,11 @@ module Comet
|
|
15
15
|
# @type [String] organization_id
|
16
16
|
attr_accessor :organization_id
|
17
17
|
|
18
|
+
# Unix timestamp, in seconds.
|
18
19
|
# @type [Number] create_time
|
19
20
|
attr_accessor :create_time
|
20
21
|
|
22
|
+
# One of the PASSWORD_FORMAT_ constants
|
21
23
|
# @type [Number] read_write_key_format
|
22
24
|
attr_accessor :read_write_key_format
|
23
25
|
|
@@ -12,12 +12,17 @@ module Comet
|
|
12
12
|
# ConstellationStats is a typed class wrapper around the underlying Comet Server API data structure.
|
13
13
|
class ConstellationStats
|
14
14
|
|
15
|
+
# Unix timestamp, in seconds.
|
15
16
|
# @type [Number] last_check_start
|
16
17
|
attr_accessor :last_check_start
|
17
18
|
|
19
|
+
# The total number of Constellation bucket report scans that have been performed since this Comet
|
20
|
+
# Server was last restarted
|
18
21
|
# @type [Number] total_checks_started
|
19
22
|
attr_accessor :total_checks_started
|
20
23
|
|
24
|
+
# The total number of buckets that Constellation has successfully deleted since this Comet Server
|
25
|
+
# was last restarted
|
21
26
|
# @type [Number] total_buckets_deleted
|
22
27
|
attr_accessor :total_buckets_deleted
|
23
28
|
|
@@ -32,6 +32,10 @@ module Comet
|
|
32
32
|
# @type [String] device_timezone
|
33
33
|
attr_accessor :device_timezone
|
34
34
|
|
35
|
+
# This field is available in Comet 23.6.0 and later.
|
36
|
+
# @type [String] client_version
|
37
|
+
attr_accessor :client_version
|
38
|
+
|
35
39
|
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
36
40
|
attr_accessor :unknown_json_fields
|
37
41
|
|
@@ -45,6 +49,7 @@ module Comet
|
|
45
49
|
@platform_version = Comet::OSInfo.new
|
46
50
|
@sources = {}
|
47
51
|
@device_timezone = ''
|
52
|
+
@client_version = ''
|
48
53
|
@unknown_json_fields = {}
|
49
54
|
end
|
50
55
|
|
@@ -86,6 +91,10 @@ module Comet
|
|
86
91
|
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
87
92
|
|
88
93
|
@device_timezone = v
|
94
|
+
when 'ClientVersion'
|
95
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
96
|
+
|
97
|
+
@client_version = v
|
89
98
|
else
|
90
99
|
@unknown_json_fields[k] = v
|
91
100
|
end
|
@@ -108,6 +117,9 @@ module Comet
|
|
108
117
|
unless @device_timezone.nil?
|
109
118
|
ret['DeviceTimezone'] = @device_timezone
|
110
119
|
end
|
120
|
+
unless @client_version.nil?
|
121
|
+
ret['ClientVersion'] = @client_version
|
122
|
+
end
|
111
123
|
@unknown_json_fields.each do |k, v|
|
112
124
|
ret[k] = v
|
113
125
|
end
|
@@ -15,9 +15,11 @@ module Comet
|
|
15
15
|
# @type [Comet::EmailReportConfig] email_report_config
|
16
16
|
attr_accessor :email_report_config
|
17
17
|
|
18
|
+
# A supported language code (e.g. "en_US" or the DEFAULT_LANGUAGE constant)
|
18
19
|
# @type [String] language_code
|
19
20
|
attr_accessor :language_code
|
20
21
|
|
22
|
+
# The timezone in IANA format (e.g. "Pacific/Auckland" or the DEFAULT_TIMEZONE constant)
|
21
23
|
# @type [String] local_timezone
|
22
24
|
attr_accessor :local_timezone
|
23
25
|
|
@@ -30,6 +30,9 @@ module Comet
|
|
30
30
|
# @type [Comet::ExternalLDAPAuthenticationSourceSettings] ldap
|
31
31
|
attr_accessor :ldap
|
32
32
|
|
33
|
+
# @type [Comet::OidcConfig] oidc
|
34
|
+
attr_accessor :oidc
|
35
|
+
|
33
36
|
# @type [Comet::B2VirtualStorageRoleSettings] b2
|
34
37
|
attr_accessor :b2
|
35
38
|
|
@@ -66,6 +69,7 @@ module Comet
|
|
66
69
|
@username = ''
|
67
70
|
@password = ''
|
68
71
|
@ldap = Comet::ExternalLDAPAuthenticationSourceSettings.new
|
72
|
+
@oidc = Comet::OidcConfig.new
|
69
73
|
@b2 = Comet::B2VirtualStorageRoleSettings.new
|
70
74
|
@wasabi = Comet::WasabiVirtualStorageRoleSettings.new
|
71
75
|
@custom = Comet::CustomRemoteBucketSettings.new
|
@@ -112,6 +116,9 @@ module Comet
|
|
112
116
|
when 'LDAP'
|
113
117
|
@ldap = Comet::ExternalLDAPAuthenticationSourceSettings.new
|
114
118
|
@ldap.from_hash(v)
|
119
|
+
when 'OIDC'
|
120
|
+
@oidc = Comet::OidcConfig.new
|
121
|
+
@oidc.from_hash(v)
|
115
122
|
when 'B2'
|
116
123
|
@b2 = Comet::B2VirtualStorageRoleSettings.new
|
117
124
|
@b2.from_hash(v)
|
@@ -156,6 +163,9 @@ module Comet
|
|
156
163
|
unless @ldap.nil?
|
157
164
|
ret['LDAP'] = @ldap
|
158
165
|
end
|
166
|
+
unless @oidc.nil?
|
167
|
+
ret['OIDC'] = @oidc
|
168
|
+
end
|
159
169
|
unless @b2.nil?
|
160
170
|
ret['B2'] = @b2
|
161
171
|
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020-2023 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
module Comet
|
11
|
+
|
12
|
+
# ExternalAuthenticationSourceDisplay is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
class ExternalAuthenticationSourceDisplay
|
14
|
+
|
15
|
+
# @type [String] display_name
|
16
|
+
attr_accessor :display_name
|
17
|
+
|
18
|
+
# @type [String] login_start_url
|
19
|
+
attr_accessor :login_start_url
|
20
|
+
|
21
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
22
|
+
attr_accessor :unknown_json_fields
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
clear
|
26
|
+
end
|
27
|
+
|
28
|
+
def clear
|
29
|
+
@display_name = ''
|
30
|
+
@login_start_url = ''
|
31
|
+
@unknown_json_fields = {}
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param [String] json_string The complete object in JSON format
|
35
|
+
def from_json(json_string)
|
36
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
37
|
+
|
38
|
+
from_hash(JSON.parse(json_string))
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
42
|
+
def from_hash(obj)
|
43
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'DisplayName'
|
48
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
49
|
+
|
50
|
+
@display_name = v
|
51
|
+
when 'LoginStartURL'
|
52
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
53
|
+
|
54
|
+
@login_start_url = v
|
55
|
+
else
|
56
|
+
@unknown_json_fields[k] = v
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [Hash] The complete object as a Ruby hash
|
62
|
+
def to_hash
|
63
|
+
ret = {}
|
64
|
+
ret['DisplayName'] = @display_name
|
65
|
+
ret['LoginStartURL'] = @login_start_url
|
66
|
+
@unknown_json_fields.each do |k, v|
|
67
|
+
ret[k] = v
|
68
|
+
end
|
69
|
+
ret
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [Hash] The complete object as a Ruby hash
|
73
|
+
def to_h
|
74
|
+
to_hash
|
75
|
+
end
|
76
|
+
|
77
|
+
# @return [String] The complete object as a JSON string
|
78
|
+
def to_json(options = {})
|
79
|
+
to_hash.to_json(options)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020-2023 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
module Comet
|
11
|
+
|
12
|
+
# ExternalAuthenticationSourceResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
class ExternalAuthenticationSourceResponse
|
14
|
+
|
15
|
+
# @type [Number] status
|
16
|
+
attr_accessor :status
|
17
|
+
|
18
|
+
# @type [String] message
|
19
|
+
attr_accessor :message
|
20
|
+
|
21
|
+
# @type [String] id
|
22
|
+
attr_accessor :id
|
23
|
+
|
24
|
+
# @type [Comet::ExternalAuthenticationSource] source
|
25
|
+
attr_accessor :source
|
26
|
+
|
27
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
28
|
+
attr_accessor :unknown_json_fields
|
29
|
+
|
30
|
+
def initialize
|
31
|
+
clear
|
32
|
+
end
|
33
|
+
|
34
|
+
def clear
|
35
|
+
@status = 0
|
36
|
+
@message = ''
|
37
|
+
@id = ''
|
38
|
+
@source = Comet::ExternalAuthenticationSource.new
|
39
|
+
@unknown_json_fields = {}
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param [String] json_string The complete object in JSON format
|
43
|
+
def from_json(json_string)
|
44
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
45
|
+
|
46
|
+
from_hash(JSON.parse(json_string))
|
47
|
+
end
|
48
|
+
|
49
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
50
|
+
def from_hash(obj)
|
51
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
52
|
+
|
53
|
+
obj.each do |k, v|
|
54
|
+
case k
|
55
|
+
when 'Status'
|
56
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
57
|
+
|
58
|
+
@status = v
|
59
|
+
when 'Message'
|
60
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
61
|
+
|
62
|
+
@message = v
|
63
|
+
when 'ID'
|
64
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
65
|
+
|
66
|
+
@id = v
|
67
|
+
when 'Source'
|
68
|
+
@source = Comet::ExternalAuthenticationSource.new
|
69
|
+
@source.from_hash(v)
|
70
|
+
else
|
71
|
+
@unknown_json_fields[k] = v
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash] The complete object as a Ruby hash
|
77
|
+
def to_hash
|
78
|
+
ret = {}
|
79
|
+
ret['Status'] = @status
|
80
|
+
ret['Message'] = @message
|
81
|
+
ret['ID'] = @id
|
82
|
+
ret['Source'] = @source
|
83
|
+
@unknown_json_fields.each do |k, v|
|
84
|
+
ret[k] = v
|
85
|
+
end
|
86
|
+
ret
|
87
|
+
end
|
88
|
+
|
89
|
+
# @return [Hash] The complete object as a Ruby hash
|
90
|
+
def to_h
|
91
|
+
to_hash
|
92
|
+
end
|
93
|
+
|
94
|
+
# @return [String] The complete object as a JSON string
|
95
|
+
def to_json(options = {})
|
96
|
+
to_hash.to_json(options)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -15,18 +15,23 @@ module Comet
|
|
15
15
|
# @type [String] username
|
16
16
|
attr_accessor :username
|
17
17
|
|
18
|
+
# The URL of the Comet Server (Auth Role) for the target user to log in to.
|
18
19
|
# @type [String] server
|
19
20
|
attr_accessor :server
|
20
21
|
|
22
|
+
# The token for use with the "/TOKEN=" silent install flag.
|
21
23
|
# @type [String] token
|
22
24
|
attr_accessor :token
|
23
25
|
|
26
|
+
# Unix timestamp, in seconds.
|
24
27
|
# @type [Number] create_time
|
25
28
|
attr_accessor :create_time
|
26
29
|
|
30
|
+
# If the token has been used, it cannot be used again.
|
27
31
|
# @type [Boolean] used
|
28
32
|
attr_accessor :used
|
29
33
|
|
34
|
+
# Unix timestamp, in seconds.
|
30
35
|
# @type [Number] expire_time
|
31
36
|
attr_accessor :expire_time
|
32
37
|
|
@@ -22,9 +22,13 @@ module Comet
|
|
22
22
|
# @type [Comet::SSHConnection] sshserver
|
23
23
|
attr_accessor :sshserver
|
24
24
|
|
25
|
+
# "Developer ID Installer" certificate, either a local filepath or a resource:// URI. Used for
|
26
|
+
# signing the final flat *.pkg.
|
25
27
|
# @type [String] certificate_name
|
26
28
|
attr_accessor :certificate_name
|
27
29
|
|
30
|
+
# "Developer ID Application" certificate, either a local filepath or a resource:// URI. Used for
|
31
|
+
# signing internal binaries if Notary is enabled
|
28
32
|
# @type [String] app_certificate_name
|
29
33
|
attr_accessor :app_certificate_name
|
30
34
|
|
@@ -34,6 +38,7 @@ module Comet
|
|
34
38
|
# @type [String] apple_idpass
|
35
39
|
attr_accessor :apple_idpass
|
36
40
|
|
41
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
37
42
|
# @type [Number] apple_idpass_format
|
38
43
|
attr_accessor :apple_idpass_format
|
39
44
|
|
@@ -46,6 +51,7 @@ module Comet
|
|
46
51
|
# @type [String] pfx_file_password
|
47
52
|
attr_accessor :pfx_file_password
|
48
53
|
|
54
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
49
55
|
# @type [Number] pfx_file_password_format
|
50
56
|
attr_accessor :pfx_file_password_format
|
51
57
|
|
@@ -12,6 +12,7 @@ module Comet
|
|
12
12
|
# MSSQLConnection is a typed class wrapper around the underlying Comet Server API data structure.
|
13
13
|
class MSSQLConnection
|
14
14
|
|
15
|
+
# One of the MSSQL_AUTH_ constants (e.g. "windows" or "native")
|
15
16
|
# @type [String] type
|
16
17
|
attr_accessor :type
|
17
18
|
|
@@ -22,11 +23,13 @@ module Comet
|
|
22
23
|
attr_accessor :password
|
23
24
|
|
24
25
|
# @type [String] hostname
|
26
|
+
# @deprecated This member has been deprecated since Comet version Unused
|
25
27
|
attr_accessor :hostname
|
26
28
|
|
27
29
|
# @type [String] instance_name
|
28
30
|
attr_accessor :instance_name
|
29
31
|
|
32
|
+
# One of the MSSQL_METHOD_ constants, to control using x86_32 or x86_64 OLEDB drivers
|
30
33
|
# @type [String] method
|
31
34
|
attr_accessor :method
|
32
35
|
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2020-2023 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
|
8
|
+
require 'json'
|
9
|
+
|
10
|
+
module Comet
|
11
|
+
|
12
|
+
# OidcClaim is a typed class wrapper around the underlying Comet Server API data structure.
|
13
|
+
class OidcClaim
|
14
|
+
|
15
|
+
# @type [String] name
|
16
|
+
attr_accessor :name
|
17
|
+
|
18
|
+
# @type [String] value
|
19
|
+
attr_accessor :value
|
20
|
+
|
21
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
22
|
+
attr_accessor :unknown_json_fields
|
23
|
+
|
24
|
+
def initialize
|
25
|
+
clear
|
26
|
+
end
|
27
|
+
|
28
|
+
def clear
|
29
|
+
@name = ''
|
30
|
+
@value = ''
|
31
|
+
@unknown_json_fields = {}
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param [String] json_string The complete object in JSON format
|
35
|
+
def from_json(json_string)
|
36
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
37
|
+
|
38
|
+
from_hash(JSON.parse(json_string))
|
39
|
+
end
|
40
|
+
|
41
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
42
|
+
def from_hash(obj)
|
43
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'Name'
|
48
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
49
|
+
|
50
|
+
@name = v
|
51
|
+
when 'Value'
|
52
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
53
|
+
|
54
|
+
@value = v
|
55
|
+
else
|
56
|
+
@unknown_json_fields[k] = v
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [Hash] The complete object as a Ruby hash
|
62
|
+
def to_hash
|
63
|
+
ret = {}
|
64
|
+
ret['Name'] = @name
|
65
|
+
unless @value.nil?
|
66
|
+
ret['Value'] = @value
|
67
|
+
end
|
68
|
+
@unknown_json_fields.each do |k, v|
|
69
|
+
ret[k] = v
|
70
|
+
end
|
71
|
+
ret
|
72
|
+
end
|
73
|
+
|
74
|
+
# @return [Hash] The complete object as a Ruby hash
|
75
|
+
def to_h
|
76
|
+
to_hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# @return [String] The complete object as a JSON string
|
80
|
+
def to_json(options = {})
|
81
|
+
to_hash.to_json(options)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|