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,78 @@
|
|
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
|
+
# HyperVMachineInfo is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class HyperVMachineInfo
|
16
|
+
|
17
|
+
# @type [String] id
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# @type [String] display_name
|
21
|
+
attr_accessor :display_name
|
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 'ID'
|
44
|
+
raise TypeError 'expected string' unless v.is_a? String
|
45
|
+
|
46
|
+
@id = v
|
47
|
+
when 'Name'
|
48
|
+
raise TypeError 'expected string' unless v.is_a? String
|
49
|
+
|
50
|
+
@display_name = v
|
51
|
+
else
|
52
|
+
@unknown_json_fields[k] = v
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# @return [Hash] The complete object as a Ruby hash
|
58
|
+
def to_hash
|
59
|
+
ret = {}
|
60
|
+
ret['ID'] = @id
|
61
|
+
ret['Name'] = @display_name
|
62
|
+
@unknown_json_fields.each do |k, v|
|
63
|
+
ret[k] = v
|
64
|
+
end
|
65
|
+
ret
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Hash] The complete object as a Ruby hash
|
69
|
+
def to_h
|
70
|
+
to_hash
|
71
|
+
end
|
72
|
+
|
73
|
+
# @return [String] The complete object as a JSON string
|
74
|
+
def to_json(options = {})
|
75
|
+
to_hash.to_json(options)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,125 @@
|
|
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
|
+
# LiveUserConnection is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class LiveUserConnection
|
16
|
+
|
17
|
+
# @type [String] username
|
18
|
+
attr_accessor :username
|
19
|
+
|
20
|
+
# @type [String] device_id
|
21
|
+
attr_accessor :device_id
|
22
|
+
|
23
|
+
# @type [String] reported_version
|
24
|
+
attr_accessor :reported_version
|
25
|
+
|
26
|
+
# @type [String] reported_platform
|
27
|
+
attr_accessor :reported_platform
|
28
|
+
|
29
|
+
# @type [Comet::OSInfo] reported_platform_version
|
30
|
+
attr_accessor :reported_platform_version
|
31
|
+
|
32
|
+
# @type [String] ipaddress
|
33
|
+
attr_accessor :ipaddress
|
34
|
+
|
35
|
+
# @type [Number] connection_time
|
36
|
+
attr_accessor :connection_time
|
37
|
+
|
38
|
+
# @type [Boolean] allows_filenames
|
39
|
+
attr_accessor :allows_filenames
|
40
|
+
|
41
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
42
|
+
attr_accessor :unknown_json_fields
|
43
|
+
|
44
|
+
def initialize
|
45
|
+
@unknown_json_fields = {}
|
46
|
+
end
|
47
|
+
|
48
|
+
# @param [String] json_string The complete object in JSON format
|
49
|
+
def from_json(json_string)
|
50
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
51
|
+
|
52
|
+
from_hash(JSON.parse(json_string))
|
53
|
+
end
|
54
|
+
|
55
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
56
|
+
def from_hash(obj)
|
57
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
58
|
+
|
59
|
+
obj.each do |k, v|
|
60
|
+
case k
|
61
|
+
when 'Username'
|
62
|
+
raise TypeError 'expected string' unless v.is_a? String
|
63
|
+
|
64
|
+
@username = v
|
65
|
+
when 'DeviceID'
|
66
|
+
raise TypeError 'expected string' unless v.is_a? String
|
67
|
+
|
68
|
+
@device_id = v
|
69
|
+
when 'ReportedVersion'
|
70
|
+
raise TypeError 'expected string' unless v.is_a? String
|
71
|
+
|
72
|
+
@reported_version = v
|
73
|
+
when 'ReportedPlatform'
|
74
|
+
raise TypeError 'expected string' unless v.is_a? String
|
75
|
+
|
76
|
+
@reported_platform = v
|
77
|
+
when 'ReportedPlatformVersion'
|
78
|
+
@reported_platform_version = Comet::OSInfo.new
|
79
|
+
@reported_platform_version.from_hash(v)
|
80
|
+
when 'IPAddress'
|
81
|
+
raise TypeError 'expected string' unless v.is_a? String
|
82
|
+
|
83
|
+
@ipaddress = v
|
84
|
+
when 'ConnectionTime'
|
85
|
+
@connection_time = v
|
86
|
+
when 'AllowsFilenames'
|
87
|
+
@allows_filenames = v
|
88
|
+
else
|
89
|
+
@unknown_json_fields[k] = v
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
# @return [Hash] The complete object as a Ruby hash
|
95
|
+
def to_hash
|
96
|
+
ret = {}
|
97
|
+
ret['Username'] = @username
|
98
|
+
ret['DeviceID'] = @device_id
|
99
|
+
ret['ReportedVersion'] = @reported_version
|
100
|
+
ret['ReportedPlatform'] = @reported_platform
|
101
|
+
unless @reported_platform_version.nil?
|
102
|
+
ret['ReportedPlatformVersion'] = @reported_platform_version
|
103
|
+
end
|
104
|
+
unless @ipaddress.nil?
|
105
|
+
ret['IPAddress'] = @ipaddress
|
106
|
+
end
|
107
|
+
ret['ConnectionTime'] = @connection_time
|
108
|
+
ret['AllowsFilenames'] = @allows_filenames
|
109
|
+
@unknown_json_fields.each do |k, v|
|
110
|
+
ret[k] = v
|
111
|
+
end
|
112
|
+
ret
|
113
|
+
end
|
114
|
+
|
115
|
+
# @return [Hash] The complete object as a Ruby hash
|
116
|
+
def to_h
|
117
|
+
to_hash
|
118
|
+
end
|
119
|
+
|
120
|
+
# @return [String] The complete object as a JSON string
|
121
|
+
def to_json(options = {})
|
122
|
+
to_hash.to_json(options)
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -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
|
+
# LocalDestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class LocalDestinationLocation
|
16
|
+
|
17
|
+
# @type [String] localcopy_path
|
18
|
+
attr_accessor :localcopy_path
|
19
|
+
|
20
|
+
# @type [String] localcopy_win_smbusername
|
21
|
+
attr_accessor :localcopy_win_smbusername
|
22
|
+
|
23
|
+
# @type [String] localcopy_win_smbpassword
|
24
|
+
attr_accessor :localcopy_win_smbpassword
|
25
|
+
|
26
|
+
# @type [Number] localcopy_win_smbpassword_format
|
27
|
+
attr_accessor :localcopy_win_smbpassword_format
|
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 'LocalcopyPath'
|
50
|
+
raise TypeError 'expected string' unless v.is_a? String
|
51
|
+
|
52
|
+
@localcopy_path = v
|
53
|
+
when 'LocalcopyWinSMBUsername'
|
54
|
+
raise TypeError 'expected string' unless v.is_a? String
|
55
|
+
|
56
|
+
@localcopy_win_smbusername = v
|
57
|
+
when 'LocalcopyWinSMBPassword'
|
58
|
+
raise TypeError 'expected string' unless v.is_a? String
|
59
|
+
|
60
|
+
@localcopy_win_smbpassword = v
|
61
|
+
when 'LocalcopyWinSMBPasswordFormat'
|
62
|
+
@localcopy_win_smbpassword_format = 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['LocalcopyPath'] = @localcopy_path
|
73
|
+
ret['LocalcopyWinSMBUsername'] = @localcopy_win_smbusername
|
74
|
+
ret['LocalcopyWinSMBPassword'] = @localcopy_win_smbpassword
|
75
|
+
ret['LocalcopyWinSMBPasswordFormat'] = @localcopy_win_smbpassword_format
|
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,113 @@
|
|
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
|
+
# MacOSCodeSignProperties is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class MacOSCodeSignProperties
|
16
|
+
|
17
|
+
# @type [Number] level
|
18
|
+
attr_accessor :level
|
19
|
+
|
20
|
+
# @type [Comet::SSHConnection] sshserver
|
21
|
+
attr_accessor :sshserver
|
22
|
+
|
23
|
+
# @type [String] certificate_name
|
24
|
+
attr_accessor :certificate_name
|
25
|
+
|
26
|
+
# @type [String] app_certificate_name
|
27
|
+
attr_accessor :app_certificate_name
|
28
|
+
|
29
|
+
# @type [String] apple_id
|
30
|
+
attr_accessor :apple_id
|
31
|
+
|
32
|
+
# @type [String] apple_idpass
|
33
|
+
attr_accessor :apple_idpass
|
34
|
+
|
35
|
+
# @type [Number] apple_idpass_format
|
36
|
+
attr_accessor :apple_idpass_format
|
37
|
+
|
38
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
39
|
+
attr_accessor :unknown_json_fields
|
40
|
+
|
41
|
+
def initialize
|
42
|
+
@unknown_json_fields = {}
|
43
|
+
end
|
44
|
+
|
45
|
+
# @param [String] json_string The complete object in JSON format
|
46
|
+
def from_json(json_string)
|
47
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
48
|
+
|
49
|
+
from_hash(JSON.parse(json_string))
|
50
|
+
end
|
51
|
+
|
52
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
53
|
+
def from_hash(obj)
|
54
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
55
|
+
|
56
|
+
obj.each do |k, v|
|
57
|
+
case k
|
58
|
+
when 'Level'
|
59
|
+
@level = v
|
60
|
+
when 'SSHServer'
|
61
|
+
@sshserver = Comet::SSHConnection.new
|
62
|
+
@sshserver.from_hash(v)
|
63
|
+
when 'CertificateName'
|
64
|
+
raise TypeError 'expected string' unless v.is_a? String
|
65
|
+
|
66
|
+
@certificate_name = v
|
67
|
+
when 'AppCertificateName'
|
68
|
+
raise TypeError 'expected string' unless v.is_a? String
|
69
|
+
|
70
|
+
@app_certificate_name = v
|
71
|
+
when 'AppleID'
|
72
|
+
raise TypeError 'expected string' unless v.is_a? String
|
73
|
+
|
74
|
+
@apple_id = v
|
75
|
+
when 'AppleIDPass'
|
76
|
+
raise TypeError 'expected string' unless v.is_a? String
|
77
|
+
|
78
|
+
@apple_idpass = v
|
79
|
+
when 'AppleIDPassFormat'
|
80
|
+
@apple_idpass_format = v
|
81
|
+
else
|
82
|
+
@unknown_json_fields[k] = v
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
# @return [Hash] The complete object as a Ruby hash
|
88
|
+
def to_hash
|
89
|
+
ret = {}
|
90
|
+
ret['Level'] = @level
|
91
|
+
ret['SSHServer'] = @sshserver
|
92
|
+
ret['CertificateName'] = @certificate_name
|
93
|
+
ret['AppCertificateName'] = @app_certificate_name
|
94
|
+
ret['AppleID'] = @apple_id
|
95
|
+
ret['AppleIDPass'] = @apple_idpass
|
96
|
+
ret['AppleIDPassFormat'] = @apple_idpass_format
|
97
|
+
@unknown_json_fields.each do |k, v|
|
98
|
+
ret[k] = v
|
99
|
+
end
|
100
|
+
ret
|
101
|
+
end
|
102
|
+
|
103
|
+
# @return [Hash] The complete object as a Ruby hash
|
104
|
+
def to_h
|
105
|
+
to_hash
|
106
|
+
end
|
107
|
+
|
108
|
+
# @return [String] The complete object as a JSON string
|
109
|
+
def to_json(options = {})
|
110
|
+
to_hash.to_json(options)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,211 @@
|
|
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
|
+
# MongoDBConnection is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class MongoDBConnection
|
16
|
+
|
17
|
+
# @type [String] server
|
18
|
+
attr_accessor :server
|
19
|
+
|
20
|
+
# @type [Number] port
|
21
|
+
attr_accessor :port
|
22
|
+
|
23
|
+
# @type [String] username
|
24
|
+
attr_accessor :username
|
25
|
+
|
26
|
+
# @type [String] password
|
27
|
+
attr_accessor :password
|
28
|
+
|
29
|
+
# @type [String] authentication_db
|
30
|
+
attr_accessor :authentication_db
|
31
|
+
|
32
|
+
# @type [String] mongo_shell_path
|
33
|
+
attr_accessor :mongo_shell_path
|
34
|
+
|
35
|
+
# @type [String] mongodump_path
|
36
|
+
attr_accessor :mongodump_path
|
37
|
+
|
38
|
+
# @type [String] read_preference
|
39
|
+
attr_accessor :read_preference
|
40
|
+
|
41
|
+
# @type [Boolean] use_replica
|
42
|
+
attr_accessor :use_replica
|
43
|
+
|
44
|
+
# @type [String] replica_name
|
45
|
+
attr_accessor :replica_name
|
46
|
+
|
47
|
+
# @type [Array<String>] replica_members
|
48
|
+
attr_accessor :replica_members
|
49
|
+
|
50
|
+
# @type [Boolean] use_ssl
|
51
|
+
attr_accessor :use_ssl
|
52
|
+
|
53
|
+
# @type [String] client_sslpempath
|
54
|
+
attr_accessor :client_sslpempath
|
55
|
+
|
56
|
+
# @type [String] server_sslpempath
|
57
|
+
attr_accessor :server_sslpempath
|
58
|
+
|
59
|
+
# @type [String] sslclient_key_password
|
60
|
+
attr_accessor :sslclient_key_password
|
61
|
+
|
62
|
+
# @type [Boolean] allow_invalid_certificate
|
63
|
+
attr_accessor :allow_invalid_certificate
|
64
|
+
|
65
|
+
# @type [Boolean] allow_invalid_hostname
|
66
|
+
attr_accessor :allow_invalid_hostname
|
67
|
+
|
68
|
+
# @type [Boolean] use_ssh
|
69
|
+
attr_accessor :use_ssh
|
70
|
+
|
71
|
+
# @type [Comet::SSHConnection] sshconnection
|
72
|
+
attr_accessor :sshconnection
|
73
|
+
|
74
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
75
|
+
attr_accessor :unknown_json_fields
|
76
|
+
|
77
|
+
def initialize
|
78
|
+
@replica_members = []
|
79
|
+
@unknown_json_fields = {}
|
80
|
+
end
|
81
|
+
|
82
|
+
# @param [String] json_string The complete object in JSON format
|
83
|
+
def from_json(json_string)
|
84
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
85
|
+
|
86
|
+
from_hash(JSON.parse(json_string))
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
90
|
+
def from_hash(obj)
|
91
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
92
|
+
|
93
|
+
obj.each do |k, v|
|
94
|
+
case k
|
95
|
+
when 'Server'
|
96
|
+
raise TypeError 'expected string' unless v.is_a? String
|
97
|
+
|
98
|
+
@server = v
|
99
|
+
when 'Port'
|
100
|
+
@port = v
|
101
|
+
when 'Username'
|
102
|
+
raise TypeError 'expected string' unless v.is_a? String
|
103
|
+
|
104
|
+
@username = v
|
105
|
+
when 'Password'
|
106
|
+
raise TypeError 'expected string' unless v.is_a? String
|
107
|
+
|
108
|
+
@password = v
|
109
|
+
when 'AuthenticationDB'
|
110
|
+
raise TypeError 'expected string' unless v.is_a? String
|
111
|
+
|
112
|
+
@authentication_db = v
|
113
|
+
when 'MongoShellPath'
|
114
|
+
raise TypeError 'expected string' unless v.is_a? String
|
115
|
+
|
116
|
+
@mongo_shell_path = v
|
117
|
+
when 'MongodumpPath'
|
118
|
+
raise TypeError 'expected string' unless v.is_a? String
|
119
|
+
|
120
|
+
@mongodump_path = v
|
121
|
+
when 'ReadPreference'
|
122
|
+
raise TypeError 'expected string' unless v.is_a? String
|
123
|
+
|
124
|
+
@read_preference = v
|
125
|
+
when 'UseReplica'
|
126
|
+
@use_replica = v
|
127
|
+
when 'ReplicaName'
|
128
|
+
raise TypeError 'expected string' unless v.is_a? String
|
129
|
+
|
130
|
+
@replica_name = v
|
131
|
+
when 'ReplicaMembers'
|
132
|
+
if v.nil?
|
133
|
+
@replica_members = []
|
134
|
+
else
|
135
|
+
@replica_members = Array.new(v.length)
|
136
|
+
v.each_with_index do |v1, i1|
|
137
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
138
|
+
|
139
|
+
@replica_members[i1] = v1
|
140
|
+
end
|
141
|
+
end
|
142
|
+
when 'UseSSL'
|
143
|
+
@use_ssl = v
|
144
|
+
when 'ClientSSLPEMPath'
|
145
|
+
raise TypeError 'expected string' unless v.is_a? String
|
146
|
+
|
147
|
+
@client_sslpempath = v
|
148
|
+
when 'ServerSSLPEMPath'
|
149
|
+
raise TypeError 'expected string' unless v.is_a? String
|
150
|
+
|
151
|
+
@server_sslpempath = v
|
152
|
+
when 'SSLClientKeyPassword'
|
153
|
+
raise TypeError 'expected string' unless v.is_a? String
|
154
|
+
|
155
|
+
@sslclient_key_password = v
|
156
|
+
when 'AllowInvalidCertificate'
|
157
|
+
@allow_invalid_certificate = v
|
158
|
+
when 'AllowInvalidHostname'
|
159
|
+
@allow_invalid_hostname = v
|
160
|
+
when 'UseSSH'
|
161
|
+
@use_ssh = v
|
162
|
+
when 'SSHConnection'
|
163
|
+
@sshconnection = Comet::SSHConnection.new
|
164
|
+
@sshconnection.from_hash(v)
|
165
|
+
else
|
166
|
+
@unknown_json_fields[k] = v
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# @return [Hash] The complete object as a Ruby hash
|
172
|
+
def to_hash
|
173
|
+
ret = {}
|
174
|
+
ret['Server'] = @server
|
175
|
+
ret['Port'] = @port
|
176
|
+
ret['Username'] = @username
|
177
|
+
ret['Password'] = @password
|
178
|
+
ret['AuthenticationDB'] = @authentication_db
|
179
|
+
ret['MongoShellPath'] = @mongo_shell_path
|
180
|
+
ret['MongodumpPath'] = @mongodump_path
|
181
|
+
ret['ReadPreference'] = @read_preference
|
182
|
+
ret['UseReplica'] = @use_replica
|
183
|
+
ret['ReplicaName'] = @replica_name
|
184
|
+
ret['ReplicaMembers'] = @replica_members
|
185
|
+
ret['UseSSL'] = @use_ssl
|
186
|
+
ret['ClientSSLPEMPath'] = @client_sslpempath
|
187
|
+
ret['ServerSSLPEMPath'] = @server_sslpempath
|
188
|
+
ret['SSLClientKeyPassword'] = @sslclient_key_password
|
189
|
+
ret['AllowInvalidCertificate'] = @allow_invalid_certificate
|
190
|
+
ret['AllowInvalidHostname'] = @allow_invalid_hostname
|
191
|
+
ret['UseSSH'] = @use_ssh
|
192
|
+
unless @sshconnection.nil?
|
193
|
+
ret['SSHConnection'] = @sshconnection
|
194
|
+
end
|
195
|
+
@unknown_json_fields.each do |k, v|
|
196
|
+
ret[k] = v
|
197
|
+
end
|
198
|
+
ret
|
199
|
+
end
|
200
|
+
|
201
|
+
# @return [Hash] The complete object as a Ruby hash
|
202
|
+
def to_h
|
203
|
+
to_hash
|
204
|
+
end
|
205
|
+
|
206
|
+
# @return [String] The complete object as a JSON string
|
207
|
+
def to_json(options = {})
|
208
|
+
to_hash.to_json(options)
|
209
|
+
end
|
210
|
+
end
|
211
|
+
end
|