comet_backup_ruby_sdk 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +25 -0
- data/Gemfile +15 -0
- data/LICENSE +7 -0
- data/README.md +81 -0
- data/Rakefile +22 -0
- data/comet_backup_ruby_sdk.gemspec +35 -0
- data/lib/comet/api_response_error.rb +27 -0
- data/lib/comet/comet_server.rb +2926 -0
- data/lib/comet/definitions.rb +550 -0
- data/lib/comet/models/add_bucket_response_message.rb +92 -0
- data/lib/comet/models/admin_account_properties_response.rb +76 -0
- data/lib/comet/models/admin_resource_response.rb +84 -0
- data/lib/comet/models/admin_security_options.rb +139 -0
- data/lib/comet/models/admin_u2fregistration.rb +84 -0
- data/lib/comet/models/admin_user_permissions.rb +102 -0
- data/lib/comet/models/available_download.rb +84 -0
- data/lib/comet/models/azure_destination_location.rb +102 -0
- data/lib/comet/models/b2destination_location.rb +110 -0
- data/lib/comet/models/b2storage_extra_info.rb +77 -0
- data/lib/comet/models/b2transaction_totals.rb +80 -0
- data/lib/comet/models/backup_job_advanced_options.rb +98 -0
- data/lib/comet/models/backup_job_detail.rb +199 -0
- data/lib/comet/models/backup_job_progress.rb +92 -0
- data/lib/comet/models/backup_rule_config.rb +188 -0
- data/lib/comet/models/backup_rule_event_triggers.rb +78 -0
- data/lib/comet/models/branding_options.rb +283 -0
- data/lib/comet/models/branding_properties.rb +245 -0
- data/lib/comet/models/browse_disk_drives_response.rb +91 -0
- data/lib/comet/models/browse_edbresponse.rb +91 -0
- data/lib/comet/models/browse_hvresponse.rb +91 -0
- data/lib/comet/models/browse_vssresponse.rb +91 -0
- data/lib/comet/models/bucket_properties.rb +89 -0
- data/lib/comet/models/bucket_usage_info.rb +91 -0
- data/lib/comet/models/comet_apiresponse_message.rb +76 -0
- data/lib/comet/models/comet_destination_location.rb +86 -0
- data/lib/comet/models/constellation_check_report.rb +89 -0
- data/lib/comet/models/constellation_stats.rb +86 -0
- data/lib/comet/models/constellation_status_apiresponse.rb +109 -0
- data/lib/comet/models/content_measurement.rb +89 -0
- data/lib/comet/models/content_measurement_component.rb +84 -0
- data/lib/comet/models/create_group_policy_response.rb +84 -0
- data/lib/comet/models/default_email_report_policy.rb +83 -0
- data/lib/comet/models/destination_config.rb +465 -0
- data/lib/comet/models/destination_location.rb +365 -0
- data/lib/comet/models/destination_statistics.rb +102 -0
- data/lib/comet/models/device_config.rb +96 -0
- data/lib/comet/models/disk_drive.rb +153 -0
- data/lib/comet/models/dispatcher_admin_sources_response.rb +92 -0
- data/lib/comet/models/dispatcher_stored_objects_response.rb +91 -0
- data/lib/comet/models/dispatcher_vault_snapshots_response.rb +91 -0
- data/lib/comet/models/edbfile_info.rb +92 -0
- data/lib/comet/models/email_options.rb +140 -0
- data/lib/comet/models/email_report_config.rb +90 -0
- data/lib/comet/models/email_report_generated_preview.rb +100 -0
- data/lib/comet/models/extra_file_exclusion.rb +82 -0
- data/lib/comet/models/ftpdestination_location.rb +124 -0
- data/lib/comet/models/get_group_policy_response.rb +91 -0
- data/lib/comet/models/get_profile_and_hash_response_message.rb +91 -0
- data/lib/comet/models/get_profile_hash_response_message.rb +84 -0
- data/lib/comet/models/group_policy.rb +83 -0
- data/lib/comet/models/hyper_vmachine_info.rb +78 -0
- data/lib/comet/models/live_user_connection.rb +125 -0
- data/lib/comet/models/local_destination_location.rb +92 -0
- data/lib/comet/models/mac_oscode_sign_properties.rb +113 -0
- data/lib/comet/models/mongo_dbconnection.rb +211 -0
- data/lib/comet/models/new_bucket_detail.rb +78 -0
- data/lib/comet/models/news_entry.rb +76 -0
- data/lib/comet/models/osinfo.rb +92 -0
- data/lib/comet/models/partition.rb +148 -0
- data/lib/comet/models/private_branding_properties.rb +185 -0
- data/lib/comet/models/protected_item_engine_type_policy.rb +84 -0
- data/lib/comet/models/public_branding_properties.rb +122 -0
- data/lib/comet/models/remote_server_address.rb +135 -0
- data/lib/comet/models/remote_storage_option.rb +147 -0
- data/lib/comet/models/replicator_state_apiresponse.rb +138 -0
- data/lib/comet/models/request_storage_vault_response_message.rb +84 -0
- data/lib/comet/models/restore_job_advanced_options.rb +104 -0
- data/lib/comet/models/retention_policy.rb +83 -0
- data/lib/comet/models/retention_range.rb +110 -0
- data/lib/comet/models/s3destination_location.rb +114 -0
- data/lib/comet/models/schedule_config.rb +82 -0
- data/lib/comet/models/search_clause.rb +111 -0
- data/lib/comet/models/server_config_options_branding_fragment.rb +69 -0
- data/lib/comet/models/server_config_options_software_build_role_fragment.rb +69 -0
- data/lib/comet/models/server_meta_version_info.rb +208 -0
- data/lib/comet/models/session_key_regenerated_response.rb +92 -0
- data/lib/comet/models/sftpdestination_location.rb +122 -0
- data/lib/comet/models/size_measurement.rb +80 -0
- data/lib/comet/models/software_build_role_options.rb +74 -0
- data/lib/comet/models/software_update_news_response.rb +102 -0
- data/lib/comet/models/source_basic_info.rb +93 -0
- data/lib/comet/models/source_config.rb +172 -0
- data/lib/comet/models/source_statistics.rb +69 -0
- data/lib/comet/models/spanned_destination_location.rb +77 -0
- data/lib/comet/models/spanned_storage_extra_info.rb +77 -0
- data/lib/comet/models/sshconnection.rb +114 -0
- data/lib/comet/models/stat_result.rb +86 -0
- data/lib/comet/models/storage_free_space_info.rb +98 -0
- data/lib/comet/models/storage_vault_provider_policy.rb +82 -0
- data/lib/comet/models/stored_object.rb +130 -0
- data/lib/comet/models/streamable_event.rb +74 -0
- data/lib/comet/models/swift_destination_location.rb +192 -0
- data/lib/comet/models/test_response.rb +82 -0
- data/lib/comet/models/totp_regenerated_response.rb +100 -0
- data/lib/comet/models/u2fregister_request.rb +78 -0
- data/lib/comet/models/u2fregistered_key.rb +86 -0
- data/lib/comet/models/u2fregistration_challenge_response.rb +122 -0
- data/lib/comet/models/u2fsign_request.rb +101 -0
- data/lib/comet/models/u2fsign_response.rb +94 -0
- data/lib/comet/models/uninstall_config.rb +74 -0
- data/lib/comet/models/update_campaign_device_status.rb +68 -0
- data/lib/comet/models/update_campaign_options.rb +86 -0
- data/lib/comet/models/update_campaign_properties.rb +100 -0
- data/lib/comet/models/update_campaign_status.rb +115 -0
- data/lib/comet/models/update_campaign_status_device_entry.rb +84 -0
- data/lib/comet/models/user_custom_email_settings.rb +77 -0
- data/lib/comet/models/user_on_server.rb +76 -0
- data/lib/comet/models/user_policy.rb +304 -0
- data/lib/comet/models/user_profile_config.rb +300 -0
- data/lib/comet/models/user_profile_fragment.rb +70 -0
- data/lib/comet/models/vault_snapshot.rb +84 -0
- data/lib/comet/models/vsscomponent.rb +92 -0
- data/lib/comet/models/vsswriter_info.rb +85 -0
- data/lib/comet/models/web_interface_branding_properties.rb +100 -0
- data/lib/comet/models/webhook_option.rb +84 -0
- data/lib/comet/models/win_smbauth.rb +92 -0
- data/lib/comet/models/windows_code_sign_properties.rb +130 -0
- data/lib/comet_backup_ruby_sdk.rb +130 -0
- metadata +227 -0
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env ruby --enable-frozen-string-literal
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020-2020 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
#
|
8
|
+
# frozen_string_literal: true
|
9
|
+
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# AddBucketResponseMessage is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AddBucketResponseMessage
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [String] new_bucket_id
|
24
|
+
attr_accessor :new_bucket_id
|
25
|
+
|
26
|
+
# @type [String] new_bucket_key
|
27
|
+
attr_accessor :new_bucket_key
|
28
|
+
|
29
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
30
|
+
attr_accessor :unknown_json_fields
|
31
|
+
|
32
|
+
def initialize
|
33
|
+
@unknown_json_fields = {}
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param [String] json_string The complete object in JSON format
|
37
|
+
def from_json(json_string)
|
38
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
39
|
+
|
40
|
+
from_hash(JSON.parse(json_string))
|
41
|
+
end
|
42
|
+
|
43
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
44
|
+
def from_hash(obj)
|
45
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
46
|
+
|
47
|
+
obj.each do |k, v|
|
48
|
+
case k
|
49
|
+
when 'Status'
|
50
|
+
@status = v
|
51
|
+
when 'Message'
|
52
|
+
raise TypeError 'expected string' unless v.is_a? String
|
53
|
+
|
54
|
+
@message = v
|
55
|
+
when 'NewBucketID'
|
56
|
+
raise TypeError 'expected string' unless v.is_a? String
|
57
|
+
|
58
|
+
@new_bucket_id = v
|
59
|
+
when 'NewBucketKey'
|
60
|
+
raise TypeError 'expected string' unless v.is_a? String
|
61
|
+
|
62
|
+
@new_bucket_key = v
|
63
|
+
else
|
64
|
+
@unknown_json_fields[k] = v
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [Hash] The complete object as a Ruby hash
|
70
|
+
def to_hash
|
71
|
+
ret = {}
|
72
|
+
ret['Status'] = @status
|
73
|
+
ret['Message'] = @message
|
74
|
+
ret['NewBucketID'] = @new_bucket_id
|
75
|
+
ret['NewBucketKey'] = @new_bucket_key
|
76
|
+
@unknown_json_fields.each do |k, v|
|
77
|
+
ret[k] = v
|
78
|
+
end
|
79
|
+
ret
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [Hash] The complete object as a Ruby hash
|
83
|
+
def to_h
|
84
|
+
to_hash
|
85
|
+
end
|
86
|
+
|
87
|
+
# @return [String] The complete object as a JSON string
|
88
|
+
def to_json(options = {})
|
89
|
+
to_hash.to_json(options)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby --enable-frozen-string-literal
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020-2020 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
#
|
8
|
+
# frozen_string_literal: true
|
9
|
+
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# AdminAccountPropertiesResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AdminAccountPropertiesResponse
|
16
|
+
|
17
|
+
# @type [Comet::AdminUserPermissions] permissions
|
18
|
+
attr_accessor :permissions
|
19
|
+
|
20
|
+
# @type [Comet::AdminSecurityOptions] security
|
21
|
+
attr_accessor :security
|
22
|
+
|
23
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
24
|
+
attr_accessor :unknown_json_fields
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
@unknown_json_fields = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
# @param [String] json_string The complete object in JSON format
|
31
|
+
def from_json(json_string)
|
32
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
33
|
+
|
34
|
+
from_hash(JSON.parse(json_string))
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
38
|
+
def from_hash(obj)
|
39
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
40
|
+
|
41
|
+
obj.each do |k, v|
|
42
|
+
case k
|
43
|
+
when 'Permissions'
|
44
|
+
@permissions = Comet::AdminUserPermissions.new
|
45
|
+
@permissions.from_hash(v)
|
46
|
+
when 'Security'
|
47
|
+
@security = Comet::AdminSecurityOptions.new
|
48
|
+
@security.from_hash(v)
|
49
|
+
else
|
50
|
+
@unknown_json_fields[k] = v
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
# @return [Hash] The complete object as a Ruby hash
|
56
|
+
def to_hash
|
57
|
+
ret = {}
|
58
|
+
ret['Permissions'] = @permissions
|
59
|
+
ret['Security'] = @security
|
60
|
+
@unknown_json_fields.each do |k, v|
|
61
|
+
ret[k] = v
|
62
|
+
end
|
63
|
+
ret
|
64
|
+
end
|
65
|
+
|
66
|
+
# @return [Hash] The complete object as a Ruby hash
|
67
|
+
def to_h
|
68
|
+
to_hash
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [String] The complete object as a JSON string
|
72
|
+
def to_json(options = {})
|
73
|
+
to_hash.to_json(options)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby --enable-frozen-string-literal
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020-2020 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
#
|
8
|
+
# frozen_string_literal: true
|
9
|
+
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# AdminResourceResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AdminResourceResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [String] resource_hash
|
24
|
+
attr_accessor :resource_hash
|
25
|
+
|
26
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
27
|
+
attr_accessor :unknown_json_fields
|
28
|
+
|
29
|
+
def initialize
|
30
|
+
@unknown_json_fields = {}
|
31
|
+
end
|
32
|
+
|
33
|
+
# @param [String] json_string The complete object in JSON format
|
34
|
+
def from_json(json_string)
|
35
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
36
|
+
|
37
|
+
from_hash(JSON.parse(json_string))
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
41
|
+
def from_hash(obj)
|
42
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
43
|
+
|
44
|
+
obj.each do |k, v|
|
45
|
+
case k
|
46
|
+
when 'Status'
|
47
|
+
@status = v
|
48
|
+
when 'Message'
|
49
|
+
raise TypeError 'expected string' unless v.is_a? String
|
50
|
+
|
51
|
+
@message = v
|
52
|
+
when 'ResourceHash'
|
53
|
+
raise TypeError 'expected string' unless v.is_a? String
|
54
|
+
|
55
|
+
@resource_hash = v
|
56
|
+
else
|
57
|
+
@unknown_json_fields[k] = v
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [Hash] The complete object as a Ruby hash
|
63
|
+
def to_hash
|
64
|
+
ret = {}
|
65
|
+
ret['Status'] = @status
|
66
|
+
ret['Message'] = @message
|
67
|
+
ret['ResourceHash'] = @resource_hash
|
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
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/usr/bin/env ruby --enable-frozen-string-literal
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020-2020 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
#
|
8
|
+
# frozen_string_literal: true
|
9
|
+
|
10
|
+
require 'json'
|
11
|
+
|
12
|
+
module Comet
|
13
|
+
|
14
|
+
# AdminSecurityOptions is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AdminSecurityOptions
|
16
|
+
|
17
|
+
# @type [Number] password_format
|
18
|
+
attr_accessor :password_format
|
19
|
+
|
20
|
+
# @type [String] password
|
21
|
+
attr_accessor :password
|
22
|
+
|
23
|
+
# @type [Boolean] allow_password_login
|
24
|
+
attr_accessor :allow_password_login
|
25
|
+
|
26
|
+
# @type [Boolean] allow_password_and_totplogin
|
27
|
+
attr_accessor :allow_password_and_totplogin
|
28
|
+
|
29
|
+
# @type [Boolean] allow_password_and_u2flogin
|
30
|
+
attr_accessor :allow_password_and_u2flogin
|
31
|
+
|
32
|
+
# @type [Array<Comet::AdminU2FRegistration>] u2fregistrations
|
33
|
+
attr_accessor :u2fregistrations
|
34
|
+
|
35
|
+
# @type [Number] totpkey_encryption_format
|
36
|
+
attr_accessor :totpkey_encryption_format
|
37
|
+
|
38
|
+
# @type [String] totpkey
|
39
|
+
attr_accessor :totpkey
|
40
|
+
|
41
|
+
# @type [String] ipwhitelist
|
42
|
+
attr_accessor :ipwhitelist
|
43
|
+
|
44
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
45
|
+
attr_accessor :unknown_json_fields
|
46
|
+
|
47
|
+
def initialize
|
48
|
+
@u2fregistrations = []
|
49
|
+
@unknown_json_fields = {}
|
50
|
+
end
|
51
|
+
|
52
|
+
# @param [String] json_string The complete object in JSON format
|
53
|
+
def from_json(json_string)
|
54
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
55
|
+
|
56
|
+
from_hash(JSON.parse(json_string))
|
57
|
+
end
|
58
|
+
|
59
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
60
|
+
def from_hash(obj)
|
61
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
62
|
+
|
63
|
+
obj.each do |k, v|
|
64
|
+
case k
|
65
|
+
when 'PasswordFormat'
|
66
|
+
@password_format = v
|
67
|
+
when 'Password'
|
68
|
+
raise TypeError 'expected string' unless v.is_a? String
|
69
|
+
|
70
|
+
@password = v
|
71
|
+
when 'AllowPasswordLogin'
|
72
|
+
@allow_password_login = v
|
73
|
+
when 'AllowPasswordAndTOTPLogin'
|
74
|
+
@allow_password_and_totplogin = v
|
75
|
+
when 'AllowPasswordAndU2FLogin'
|
76
|
+
@allow_password_and_u2flogin = v
|
77
|
+
when 'U2FRegistrations'
|
78
|
+
if v.nil?
|
79
|
+
@u2fregistrations = []
|
80
|
+
else
|
81
|
+
@u2fregistrations = Array.new(v.length)
|
82
|
+
v.each_with_index do |v1, i1|
|
83
|
+
@u2fregistrations[i1] = Comet::AdminU2FRegistration.new
|
84
|
+
@u2fregistrations[i1].from_hash(v1)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
when 'TOTPKeyEncryptionFormat'
|
88
|
+
@totpkey_encryption_format = v
|
89
|
+
when 'TOTPKey'
|
90
|
+
raise TypeError 'expected string' unless v.is_a? String
|
91
|
+
|
92
|
+
@totpkey = v
|
93
|
+
when 'IPWhitelist'
|
94
|
+
raise TypeError 'expected string' unless v.is_a? String
|
95
|
+
|
96
|
+
@ipwhitelist = v
|
97
|
+
else
|
98
|
+
@unknown_json_fields[k] = v
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# @return [Hash] The complete object as a Ruby hash
|
104
|
+
def to_hash
|
105
|
+
ret = {}
|
106
|
+
ret['PasswordFormat'] = @password_format
|
107
|
+
ret['Password'] = @password
|
108
|
+
ret['AllowPasswordLogin'] = @allow_password_login
|
109
|
+
ret['AllowPasswordAndTOTPLogin'] = @allow_password_and_totplogin
|
110
|
+
ret['AllowPasswordAndU2FLogin'] = @allow_password_and_u2flogin
|
111
|
+
unless @u2fregistrations.nil?
|
112
|
+
ret['U2FRegistrations'] = @u2fregistrations
|
113
|
+
end
|
114
|
+
unless @totpkey_encryption_format.nil?
|
115
|
+
ret['TOTPKeyEncryptionFormat'] = @totpkey_encryption_format
|
116
|
+
end
|
117
|
+
unless @totpkey.nil?
|
118
|
+
ret['TOTPKey'] = @totpkey
|
119
|
+
end
|
120
|
+
unless @ipwhitelist.nil?
|
121
|
+
ret['IPWhitelist'] = @ipwhitelist
|
122
|
+
end
|
123
|
+
@unknown_json_fields.each do |k, v|
|
124
|
+
ret[k] = v
|
125
|
+
end
|
126
|
+
ret
|
127
|
+
end
|
128
|
+
|
129
|
+
# @return [Hash] The complete object as a Ruby hash
|
130
|
+
def to_h
|
131
|
+
to_hash
|
132
|
+
end
|
133
|
+
|
134
|
+
# @return [String] The complete object as a JSON string
|
135
|
+
def to_json(options = {})
|
136
|
+
to_hash.to_json(options)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
#!/usr/bin/env ruby --enable-frozen-string-literal
|
2
|
+
#
|
3
|
+
# Copyright (c) 2020-2020 Comet Licensing Ltd.
|
4
|
+
# Please see the LICENSE file for usage information.
|
5
|
+
#
|
6
|
+
# SPDX-License-Identifier: MIT
|
7
|
+
#
|
8
|
+
# frozen_string_literal: true
|
9
|
+
|
10
|
+
require 'base64'
|
11
|
+
require 'json'
|
12
|
+
|
13
|
+
module Comet
|
14
|
+
|
15
|
+
# AdminU2FRegistration is a typed class wrapper around the underlying Comet Server API data structure.
|
16
|
+
class AdminU2FRegistration
|
17
|
+
|
18
|
+
# @type [String] description
|
19
|
+
attr_accessor :description
|
20
|
+
|
21
|
+
# @type [Number] register_time
|
22
|
+
attr_accessor :register_time
|
23
|
+
|
24
|
+
# @type [Array<Object>] registration
|
25
|
+
attr_accessor :registration
|
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
|
+
@registration = []
|
32
|
+
@unknown_json_fields = {}
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param [String] json_string The complete object in JSON format
|
36
|
+
def from_json(json_string)
|
37
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
38
|
+
|
39
|
+
from_hash(JSON.parse(json_string))
|
40
|
+
end
|
41
|
+
|
42
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
43
|
+
def from_hash(obj)
|
44
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
45
|
+
|
46
|
+
obj.each do |k, v|
|
47
|
+
case k
|
48
|
+
when 'Description'
|
49
|
+
raise TypeError 'expected string' unless v.is_a? String
|
50
|
+
|
51
|
+
@description = v
|
52
|
+
when 'RegisterTime'
|
53
|
+
@register_time = v
|
54
|
+
when 'Registration'
|
55
|
+
@registration = Base64.decode64(v)
|
56
|
+
else
|
57
|
+
@unknown_json_fields[k] = v
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# @return [Hash] The complete object as a Ruby hash
|
63
|
+
def to_hash
|
64
|
+
ret = {}
|
65
|
+
ret['Description'] = @description
|
66
|
+
ret['RegisterTime'] = @register_time
|
67
|
+
ret['Registration'] = Base64.strict_encode64(@registration)
|
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
|