comet_backup_ruby_sdk 0.2.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +47 -0
- data/Gemfile.lock +43 -0
- data/README.md +20 -4
- data/RELEASING.md +10 -0
- data/comet_backup_ruby_sdk.gemspec +1 -1
- data/lib/comet/comet_server.rb +562 -254
- data/lib/comet/definitions.rb +19 -4
- data/lib/comet/models/add_bucket_response_message.rb +15 -5
- data/lib/comet/models/admin_account_properties_response.rb +17 -2
- data/lib/comet/models/admin_email_options.rb +84 -0
- data/lib/comet/models/admin_resource_response.rb +13 -4
- data/lib/comet/models/admin_security_options.rb +18 -5
- data/lib/comet/models/admin_u2fregistration.rb +11 -3
- data/lib/comet/models/admin_user_permissions.rb +6 -2
- data/lib/comet/models/available_download.rb +10 -4
- data/lib/comet/models/azure_destination_location.rb +16 -7
- data/lib/comet/models/b2destination_location.rb +17 -6
- data/lib/comet/models/b2storage_extra_info.rb +6 -2
- data/lib/comet/models/b2transaction_totals.rb +15 -2
- data/lib/comet/models/b2virtual_storage_role_settings.rb +93 -0
- data/lib/comet/models/backup_job_advanced_options.rb +12 -2
- data/lib/comet/models/backup_job_detail.rb +53 -10
- data/lib/comet/models/backup_job_progress.rb +21 -2
- data/lib/comet/models/backup_rule_config.rb +43 -7
- data/lib/comet/models/backup_rule_event_triggers.rb +6 -2
- data/lib/comet/models/branding_options.rb +59 -25
- data/lib/comet/models/branding_properties.rb +51 -21
- data/lib/comet/models/browse_disk_drives_response.rb +11 -3
- data/lib/comet/models/browse_edbresponse.rb +11 -3
- data/lib/comet/models/browse_hvresponse.rb +11 -3
- data/lib/comet/models/browse_vssresponse.rb +11 -3
- data/lib/comet/models/bucket_properties.rb +24 -3
- data/lib/comet/models/bucket_usage_info.rb +8 -2
- data/lib/comet/models/comet_apiresponse_message.rb +11 -3
- data/lib/comet/models/comet_destination_location.rb +12 -5
- data/lib/comet/models/constellation_check_report.rb +12 -2
- data/lib/comet/models/constellation_stats.rb +18 -2
- data/lib/comet/models/constellation_status_apiresponse.rb +9 -4
- data/lib/comet/models/content_measurement.rb +12 -2
- data/lib/comet/models/content_measurement_component.rb +10 -3
- data/lib/comet/models/create_group_policy_response.rb +13 -4
- data/lib/comet/models/default_email_report_policy.rb +6 -2
- data/lib/comet/models/destination_config.rb +123 -32
- data/lib/comet/models/destination_location.rb +78 -28
- data/lib/comet/models/destination_statistics.rb +16 -3
- data/lib/comet/models/device_config.rb +9 -3
- data/lib/comet/models/disk_drive.rb +34 -7
- data/lib/comet/models/dispatcher_admin_sources_response.rb +12 -4
- data/lib/comet/models/dispatcher_stored_objects_response.rb +11 -3
- data/lib/comet/models/dispatcher_vault_snapshots_response.rb +11 -3
- data/lib/comet/models/edbfile_info.rb +12 -5
- data/lib/comet/models/email_options.rb +21 -8
- data/lib/comet/models/email_report_config.rb +10 -2
- data/lib/comet/models/email_report_generated_preview.rb +17 -6
- data/lib/comet/models/external_ldapauthentication_source_settings.rb +102 -0
- data/lib/comet/models/extra_file_exclusion.rb +11 -3
- data/lib/comet/models/ftpdestination_location.rb +23 -6
- data/lib/comet/models/get_group_policy_response.rb +14 -4
- data/lib/comet/models/get_profile_and_hash_response_message.rb +14 -4
- data/lib/comet/models/get_profile_hash_response_message.rb +13 -4
- data/lib/comet/models/group_policy.rb +18 -3
- data/lib/comet/models/hyper_vmachine_info.rb +10 -4
- data/lib/comet/models/install_creds.rb +99 -0
- data/lib/comet/models/install_token.rb +117 -0
- data/lib/comet/models/install_token_response.rb +92 -0
- data/lib/comet/models/job_entry.rb +93 -0
- data/lib/comet/models/live_user_connection.rb +20 -7
- data/lib/comet/models/local_destination_location.rb +15 -5
- data/lib/comet/models/mac_oscode_sign_properties.rb +21 -6
- data/lib/comet/models/mongo_dbconnection.rb +33 -14
- data/lib/comet/models/new_bucket_detail.rb +10 -4
- data/lib/comet/models/news_entry.rb +20 -3
- data/lib/comet/models/organization.rb +145 -0
- data/lib/comet/models/organization_response.rb +101 -0
- data/lib/comet/models/osinfo.rb +12 -5
- data/lib/comet/models/partition.rb +32 -8
- data/lib/comet/models/private_branding_properties.rb +39 -15
- data/lib/comet/models/protected_item_engine_type_policy.rb +7 -3
- data/lib/comet/models/public_branding_properties.rb +18 -8
- data/lib/comet/models/remote_server_address.rb +19 -7
- data/lib/comet/models/remote_storage_option.rb +28 -7
- data/lib/comet/models/replicator_state_apiresponse.rb +40 -4
- data/lib/comet/models/request_storage_vault_response_message.rb +13 -4
- data/lib/comet/models/restore_job_advanced_options.rb +15 -4
- data/lib/comet/models/retention_policy.rb +9 -2
- data/lib/comet/models/retention_range.rb +30 -2
- data/lib/comet/models/s3destination_location.rb +16 -7
- data/lib/comet/models/schedule_config.rb +15 -2
- data/lib/comet/models/search_clause.rb +14 -6
- data/lib/comet/models/server_config_options_branding_fragment.rb +7 -2
- data/lib/comet/models/server_config_options_software_build_role_fragment.rb +7 -2
- data/lib/comet/models/server_meta_version_info.rb +45 -7
- data/lib/comet/models/session_key_regenerated_response.rb +15 -5
- data/lib/comet/models/sftpdestination_location.rb +21 -8
- data/lib/comet/models/size_measurement.rb +15 -2
- data/lib/comet/models/software_build_role_options.rb +6 -2
- data/lib/comet/models/software_update_news_response.rb +13 -6
- data/lib/comet/models/source_basic_info.rb +11 -3
- data/lib/comet/models/source_config.rb +38 -8
- data/lib/comet/models/source_statistics.rb +7 -2
- data/lib/comet/models/spanned_destination_location.rb +6 -2
- data/lib/comet/models/spanned_storage_extra_info.rb +6 -2
- data/lib/comet/models/sshconnection.rb +19 -7
- data/lib/comet/models/stat_result.rb +18 -2
- data/lib/comet/models/storage_free_space_info.rb +14 -2
- data/lib/comet/models/storage_vault_provider_policy.rb +8 -2
- data/lib/comet/models/stored_object.rb +27 -5
- data/lib/comet/models/streamable_event.rb +18 -2
- data/lib/comet/models/swift_destination_location.rb +32 -15
- data/lib/comet/models/test_response.rb +11 -3
- data/lib/comet/models/totp_regenerated_response.rb +17 -6
- data/lib/comet/models/u2fregister_request.rb +10 -4
- data/lib/comet/models/u2fregistered_key.rb +12 -5
- data/lib/comet/models/u2fregistration_challenge_response.rb +15 -5
- data/lib/comet/models/u2fsign_request.rb +12 -5
- data/lib/comet/models/u2fsign_response.rb +14 -6
- data/lib/comet/models/uninstall_config.rb +6 -2
- data/lib/comet/models/update_campaign_device_status.rb +9 -2
- data/lib/comet/models/update_campaign_options.rb +6 -2
- data/lib/comet/models/update_campaign_properties.rb +11 -3
- data/lib/comet/models/update_campaign_status.rb +11 -3
- data/lib/comet/models/update_campaign_status_device_entry.rb +13 -4
- data/lib/comet/models/user_custom_email_settings.rb +6 -2
- data/lib/comet/models/user_on_server.rb +11 -3
- data/lib/comet/models/user_policy.rb +22 -2
- data/lib/comet/models/user_profile_config.rb +52 -12
- data/lib/comet/models/user_profile_fragment.rb +8 -3
- data/lib/comet/models/vault_snapshot.rb +13 -4
- data/lib/comet/models/vsscomponent.rb +12 -5
- data/lib/comet/models/vsswriter_info.rb +8 -3
- data/lib/comet/models/wasabi_virtual_storage_role_settings.rb +93 -0
- data/lib/comet/models/web_interface_branding_properties.rb +14 -6
- data/lib/comet/models/webhook_option.rb +10 -3
- data/lib/comet/models/win_smbauth.rb +15 -5
- data/lib/comet/models/windows_code_sign_properties.rb +26 -9
- data/lib/comet_backup_ruby_sdk.rb +10 -0
- metadata +15 -2
@@ -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
|
+
# InstallTokenResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class InstallTokenResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [Comet::InstallToken] install_token
|
24
|
+
attr_accessor :install_token
|
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
|
+
clear
|
31
|
+
end
|
32
|
+
|
33
|
+
def clear
|
34
|
+
@status = 0
|
35
|
+
@message = ''
|
36
|
+
@install_token = Comet::InstallToken.new
|
37
|
+
@unknown_json_fields = {}
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param [String] json_string The complete object in JSON format
|
41
|
+
def from_json(json_string)
|
42
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
43
|
+
|
44
|
+
from_hash(JSON.parse(json_string))
|
45
|
+
end
|
46
|
+
|
47
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
48
|
+
def from_hash(obj)
|
49
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
50
|
+
|
51
|
+
obj.each do |k, v|
|
52
|
+
case k
|
53
|
+
when 'Status'
|
54
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
55
|
+
|
56
|
+
@status = v
|
57
|
+
when 'Message'
|
58
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
59
|
+
|
60
|
+
@message = v
|
61
|
+
when 'InstallToken'
|
62
|
+
@install_token = Comet::InstallToken.new
|
63
|
+
@install_token.from_hash(v)
|
64
|
+
else
|
65
|
+
@unknown_json_fields[k] = v
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [Hash] The complete object as a Ruby hash
|
71
|
+
def to_hash
|
72
|
+
ret = {}
|
73
|
+
ret['Status'] = @status
|
74
|
+
ret['Message'] = @message
|
75
|
+
ret['InstallToken'] = @install_token
|
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,93 @@
|
|
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
|
+
# JobEntry is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class JobEntry
|
16
|
+
|
17
|
+
# @type [Number] time
|
18
|
+
attr_accessor :time
|
19
|
+
|
20
|
+
# @type [String] severity
|
21
|
+
attr_accessor :severity
|
22
|
+
|
23
|
+
# @type [String] message
|
24
|
+
attr_accessor :message
|
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
|
+
clear
|
31
|
+
end
|
32
|
+
|
33
|
+
def clear
|
34
|
+
@time = 0
|
35
|
+
@severity = ''
|
36
|
+
@message = ''
|
37
|
+
@unknown_json_fields = {}
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param [String] json_string The complete object in JSON format
|
41
|
+
def from_json(json_string)
|
42
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
43
|
+
|
44
|
+
from_hash(JSON.parse(json_string))
|
45
|
+
end
|
46
|
+
|
47
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
48
|
+
def from_hash(obj)
|
49
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
50
|
+
|
51
|
+
obj.each do |k, v|
|
52
|
+
case k
|
53
|
+
when 'Time'
|
54
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
55
|
+
|
56
|
+
@time = v
|
57
|
+
when 'Severity'
|
58
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
59
|
+
|
60
|
+
@severity = v
|
61
|
+
when 'Message'
|
62
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
63
|
+
|
64
|
+
@message = v
|
65
|
+
else
|
66
|
+
@unknown_json_fields[k] = v
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# @return [Hash] The complete object as a Ruby hash
|
72
|
+
def to_hash
|
73
|
+
ret = {}
|
74
|
+
ret['Time'] = @time
|
75
|
+
ret['Severity'] = @severity
|
76
|
+
ret['Message'] = @message
|
77
|
+
@unknown_json_fields.each do |k, v|
|
78
|
+
ret[k] = v
|
79
|
+
end
|
80
|
+
ret
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return [Hash] The complete object as a Ruby hash
|
84
|
+
def to_h
|
85
|
+
to_hash
|
86
|
+
end
|
87
|
+
|
88
|
+
# @return [String] The complete object as a JSON string
|
89
|
+
def to_json(options = {})
|
90
|
+
to_hash.to_json(options)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
@@ -42,46 +42,59 @@ module Comet
|
|
42
42
|
attr_accessor :unknown_json_fields
|
43
43
|
|
44
44
|
def initialize
|
45
|
+
clear
|
46
|
+
end
|
47
|
+
|
48
|
+
def clear
|
49
|
+
@username = ''
|
50
|
+
@device_id = ''
|
51
|
+
@reported_version = ''
|
52
|
+
@reported_platform = ''
|
53
|
+
@reported_platform_version = Comet::OSInfo.new
|
54
|
+
@ipaddress = ''
|
55
|
+
@connection_time = 0
|
45
56
|
@unknown_json_fields = {}
|
46
57
|
end
|
47
58
|
|
48
59
|
# @param [String] json_string The complete object in JSON format
|
49
60
|
def from_json(json_string)
|
50
|
-
raise TypeError 'expected
|
61
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
51
62
|
|
52
63
|
from_hash(JSON.parse(json_string))
|
53
64
|
end
|
54
65
|
|
55
66
|
# @param [Hash] obj The complete object as a Ruby hash
|
56
67
|
def from_hash(obj)
|
57
|
-
raise TypeError 'expected
|
68
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
58
69
|
|
59
70
|
obj.each do |k, v|
|
60
71
|
case k
|
61
72
|
when 'Username'
|
62
|
-
raise TypeError 'expected
|
73
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
63
74
|
|
64
75
|
@username = v
|
65
76
|
when 'DeviceID'
|
66
|
-
raise TypeError 'expected
|
77
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
67
78
|
|
68
79
|
@device_id = v
|
69
80
|
when 'ReportedVersion'
|
70
|
-
raise TypeError 'expected
|
81
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
71
82
|
|
72
83
|
@reported_version = v
|
73
84
|
when 'ReportedPlatform'
|
74
|
-
raise TypeError 'expected
|
85
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
75
86
|
|
76
87
|
@reported_platform = v
|
77
88
|
when 'ReportedPlatformVersion'
|
78
89
|
@reported_platform_version = Comet::OSInfo.new
|
79
90
|
@reported_platform_version.from_hash(v)
|
80
91
|
when 'IPAddress'
|
81
|
-
raise TypeError 'expected
|
92
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
82
93
|
|
83
94
|
@ipaddress = v
|
84
95
|
when 'ConnectionTime'
|
96
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
97
|
+
|
85
98
|
@connection_time = v
|
86
99
|
when 'AllowsFilenames'
|
87
100
|
@allows_filenames = v
|
@@ -30,35 +30,45 @@ module Comet
|
|
30
30
|
attr_accessor :unknown_json_fields
|
31
31
|
|
32
32
|
def initialize
|
33
|
+
clear
|
34
|
+
end
|
35
|
+
|
36
|
+
def clear
|
37
|
+
@localcopy_path = ''
|
38
|
+
@localcopy_win_smbusername = ''
|
39
|
+
@localcopy_win_smbpassword = ''
|
40
|
+
@localcopy_win_smbpassword_format = 0
|
33
41
|
@unknown_json_fields = {}
|
34
42
|
end
|
35
43
|
|
36
44
|
# @param [String] json_string The complete object in JSON format
|
37
45
|
def from_json(json_string)
|
38
|
-
raise TypeError 'expected
|
46
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
39
47
|
|
40
48
|
from_hash(JSON.parse(json_string))
|
41
49
|
end
|
42
50
|
|
43
51
|
# @param [Hash] obj The complete object as a Ruby hash
|
44
52
|
def from_hash(obj)
|
45
|
-
raise TypeError 'expected
|
53
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
46
54
|
|
47
55
|
obj.each do |k, v|
|
48
56
|
case k
|
49
57
|
when 'LocalcopyPath'
|
50
|
-
raise TypeError 'expected
|
58
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
51
59
|
|
52
60
|
@localcopy_path = v
|
53
61
|
when 'LocalcopyWinSMBUsername'
|
54
|
-
raise TypeError 'expected
|
62
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
55
63
|
|
56
64
|
@localcopy_win_smbusername = v
|
57
65
|
when 'LocalcopyWinSMBPassword'
|
58
|
-
raise TypeError 'expected
|
66
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
59
67
|
|
60
68
|
@localcopy_win_smbpassword = v
|
61
69
|
when 'LocalcopyWinSMBPasswordFormat'
|
70
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
71
|
+
|
62
72
|
@localcopy_win_smbpassword_format = v
|
63
73
|
else
|
64
74
|
@unknown_json_fields[k] = v
|
@@ -39,44 +39,59 @@ module Comet
|
|
39
39
|
attr_accessor :unknown_json_fields
|
40
40
|
|
41
41
|
def initialize
|
42
|
+
clear
|
43
|
+
end
|
44
|
+
|
45
|
+
def clear
|
46
|
+
@level = 0
|
47
|
+
@sshserver = Comet::SSHConnection.new
|
48
|
+
@certificate_name = ''
|
49
|
+
@app_certificate_name = ''
|
50
|
+
@apple_id = ''
|
51
|
+
@apple_idpass = ''
|
52
|
+
@apple_idpass_format = 0
|
42
53
|
@unknown_json_fields = {}
|
43
54
|
end
|
44
55
|
|
45
56
|
# @param [String] json_string The complete object in JSON format
|
46
57
|
def from_json(json_string)
|
47
|
-
raise TypeError 'expected
|
58
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
48
59
|
|
49
60
|
from_hash(JSON.parse(json_string))
|
50
61
|
end
|
51
62
|
|
52
63
|
# @param [Hash] obj The complete object as a Ruby hash
|
53
64
|
def from_hash(obj)
|
54
|
-
raise TypeError 'expected
|
65
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
55
66
|
|
56
67
|
obj.each do |k, v|
|
57
68
|
case k
|
58
69
|
when 'Level'
|
70
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
71
|
+
|
59
72
|
@level = v
|
60
73
|
when 'SSHServer'
|
61
74
|
@sshserver = Comet::SSHConnection.new
|
62
75
|
@sshserver.from_hash(v)
|
63
76
|
when 'CertificateName'
|
64
|
-
raise TypeError 'expected
|
77
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
65
78
|
|
66
79
|
@certificate_name = v
|
67
80
|
when 'AppCertificateName'
|
68
|
-
raise TypeError 'expected
|
81
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
69
82
|
|
70
83
|
@app_certificate_name = v
|
71
84
|
when 'AppleID'
|
72
|
-
raise TypeError 'expected
|
85
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
73
86
|
|
74
87
|
@apple_id = v
|
75
88
|
when 'AppleIDPass'
|
76
|
-
raise TypeError 'expected
|
89
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
77
90
|
|
78
91
|
@apple_idpass = v
|
79
92
|
when 'AppleIDPassFormat'
|
93
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
94
|
+
|
80
95
|
@apple_idpass_format = v
|
81
96
|
else
|
82
97
|
@unknown_json_fields[k] = v
|
@@ -75,57 +75,76 @@ module Comet
|
|
75
75
|
attr_accessor :unknown_json_fields
|
76
76
|
|
77
77
|
def initialize
|
78
|
+
clear
|
79
|
+
end
|
80
|
+
|
81
|
+
def clear
|
82
|
+
@server = ''
|
83
|
+
@port = 0
|
84
|
+
@username = ''
|
85
|
+
@password = ''
|
86
|
+
@authentication_db = ''
|
87
|
+
@mongo_shell_path = ''
|
88
|
+
@mongodump_path = ''
|
89
|
+
@read_preference = ''
|
90
|
+
@replica_name = ''
|
78
91
|
@replica_members = []
|
92
|
+
@client_sslpempath = ''
|
93
|
+
@server_sslpempath = ''
|
94
|
+
@sslclient_key_password = ''
|
95
|
+
@sshconnection = Comet::SSHConnection.new
|
79
96
|
@unknown_json_fields = {}
|
80
97
|
end
|
81
98
|
|
82
99
|
# @param [String] json_string The complete object in JSON format
|
83
100
|
def from_json(json_string)
|
84
|
-
raise TypeError 'expected
|
101
|
+
raise TypeError "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
85
102
|
|
86
103
|
from_hash(JSON.parse(json_string))
|
87
104
|
end
|
88
105
|
|
89
106
|
# @param [Hash] obj The complete object as a Ruby hash
|
90
107
|
def from_hash(obj)
|
91
|
-
raise TypeError 'expected
|
108
|
+
raise TypeError "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
92
109
|
|
93
110
|
obj.each do |k, v|
|
94
111
|
case k
|
95
112
|
when 'Server'
|
96
|
-
raise TypeError 'expected
|
113
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
97
114
|
|
98
115
|
@server = v
|
99
116
|
when 'Port'
|
117
|
+
raise TypeError "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
118
|
+
|
100
119
|
@port = v
|
101
120
|
when 'Username'
|
102
|
-
raise TypeError 'expected
|
121
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
103
122
|
|
104
123
|
@username = v
|
105
124
|
when 'Password'
|
106
|
-
raise TypeError 'expected
|
125
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
107
126
|
|
108
127
|
@password = v
|
109
128
|
when 'AuthenticationDB'
|
110
|
-
raise TypeError 'expected
|
129
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
111
130
|
|
112
131
|
@authentication_db = v
|
113
132
|
when 'MongoShellPath'
|
114
|
-
raise TypeError 'expected
|
133
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
115
134
|
|
116
135
|
@mongo_shell_path = v
|
117
136
|
when 'MongodumpPath'
|
118
|
-
raise TypeError 'expected
|
137
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
119
138
|
|
120
139
|
@mongodump_path = v
|
121
140
|
when 'ReadPreference'
|
122
|
-
raise TypeError 'expected
|
141
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
123
142
|
|
124
143
|
@read_preference = v
|
125
144
|
when 'UseReplica'
|
126
145
|
@use_replica = v
|
127
146
|
when 'ReplicaName'
|
128
|
-
raise TypeError 'expected
|
147
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
129
148
|
|
130
149
|
@replica_name = v
|
131
150
|
when 'ReplicaMembers'
|
@@ -134,7 +153,7 @@ module Comet
|
|
134
153
|
else
|
135
154
|
@replica_members = Array.new(v.length)
|
136
155
|
v.each_with_index do |v1, i1|
|
137
|
-
raise TypeError 'expected
|
156
|
+
raise TypeError "'v1' expected String, got #{v1.class}" unless v1.is_a? String
|
138
157
|
|
139
158
|
@replica_members[i1] = v1
|
140
159
|
end
|
@@ -142,15 +161,15 @@ module Comet
|
|
142
161
|
when 'UseSSL'
|
143
162
|
@use_ssl = v
|
144
163
|
when 'ClientSSLPEMPath'
|
145
|
-
raise TypeError 'expected
|
164
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
146
165
|
|
147
166
|
@client_sslpempath = v
|
148
167
|
when 'ServerSSLPEMPath'
|
149
|
-
raise TypeError 'expected
|
168
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
150
169
|
|
151
170
|
@server_sslpempath = v
|
152
171
|
when 'SSLClientKeyPassword'
|
153
|
-
raise TypeError 'expected
|
172
|
+
raise TypeError "'v' expected String, got #{v.class}" unless v.is_a? String
|
154
173
|
|
155
174
|
@sslclient_key_password = v
|
156
175
|
when 'AllowInvalidCertificate'
|