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,96 @@
|
|
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
|
+
# DeviceConfig is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class DeviceConfig
|
16
|
+
|
17
|
+
# @type [String] friendly_name
|
18
|
+
attr_accessor :friendly_name
|
19
|
+
|
20
|
+
# @type [Comet::OSInfo] platform_version
|
21
|
+
attr_accessor :platform_version
|
22
|
+
|
23
|
+
# @type [Hash{String => Comet::SourceBasicInfo}] sources
|
24
|
+
attr_accessor :sources
|
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
|
+
@sources = {}
|
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 'expected string' 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 'expected hash' unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'FriendlyName'
|
48
|
+
raise TypeError 'expected string' unless v.is_a? String
|
49
|
+
|
50
|
+
@friendly_name = v
|
51
|
+
when 'PlatformVersion'
|
52
|
+
@platform_version = Comet::OSInfo.new
|
53
|
+
@platform_version.from_hash(v)
|
54
|
+
when 'Sources'
|
55
|
+
@sources = {}
|
56
|
+
if v.nil?
|
57
|
+
@sources = {}
|
58
|
+
else
|
59
|
+
v.each do |k1, v1|
|
60
|
+
@sources[k1] = Comet::SourceBasicInfo.new
|
61
|
+
@sources[k1].from_hash(v1)
|
62
|
+
end
|
63
|
+
end
|
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['FriendlyName'] = @friendly_name
|
74
|
+
unless @platform_version.nil?
|
75
|
+
ret['PlatformVersion'] = @platform_version
|
76
|
+
end
|
77
|
+
unless @sources.nil?
|
78
|
+
ret['Sources'] = @sources
|
79
|
+
end
|
80
|
+
@unknown_json_fields.each do |k, v|
|
81
|
+
ret[k] = v
|
82
|
+
end
|
83
|
+
ret
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [Hash] The complete object as a Ruby hash
|
87
|
+
def to_h
|
88
|
+
to_hash
|
89
|
+
end
|
90
|
+
|
91
|
+
# @return [String] The complete object as a JSON string
|
92
|
+
def to_json(options = {})
|
93
|
+
to_hash.to_json(options)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,153 @@
|
|
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
|
+
# DiskDrive is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class DiskDrive
|
16
|
+
|
17
|
+
# @type [String] id
|
18
|
+
attr_accessor :id
|
19
|
+
|
20
|
+
# @type [String] device_name
|
21
|
+
attr_accessor :device_name
|
22
|
+
|
23
|
+
# @type [String] caption
|
24
|
+
attr_accessor :caption
|
25
|
+
|
26
|
+
# @type [String] model
|
27
|
+
attr_accessor :model
|
28
|
+
|
29
|
+
# @type [String] serial_number
|
30
|
+
attr_accessor :serial_number
|
31
|
+
|
32
|
+
# @type [Number] size
|
33
|
+
attr_accessor :size
|
34
|
+
|
35
|
+
# @type [Array<Comet::Partition>] partitions
|
36
|
+
attr_accessor :partitions
|
37
|
+
|
38
|
+
# @type [Number] flags
|
39
|
+
attr_accessor :flags
|
40
|
+
|
41
|
+
# @type [Number] cylinders
|
42
|
+
attr_accessor :cylinders
|
43
|
+
|
44
|
+
# @type [Number] heads
|
45
|
+
attr_accessor :heads
|
46
|
+
|
47
|
+
# @type [Number] sectors
|
48
|
+
attr_accessor :sectors
|
49
|
+
|
50
|
+
# @type [Number] sector_size
|
51
|
+
attr_accessor :sector_size
|
52
|
+
|
53
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
54
|
+
attr_accessor :unknown_json_fields
|
55
|
+
|
56
|
+
def initialize
|
57
|
+
@partitions = []
|
58
|
+
@unknown_json_fields = {}
|
59
|
+
end
|
60
|
+
|
61
|
+
# @param [String] json_string The complete object in JSON format
|
62
|
+
def from_json(json_string)
|
63
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
64
|
+
|
65
|
+
from_hash(JSON.parse(json_string))
|
66
|
+
end
|
67
|
+
|
68
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
69
|
+
def from_hash(obj)
|
70
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
71
|
+
|
72
|
+
obj.each do |k, v|
|
73
|
+
case k
|
74
|
+
when 'ID'
|
75
|
+
raise TypeError 'expected string' unless v.is_a? String
|
76
|
+
|
77
|
+
@id = v
|
78
|
+
when 'DeviceName'
|
79
|
+
raise TypeError 'expected string' unless v.is_a? String
|
80
|
+
|
81
|
+
@device_name = v
|
82
|
+
when 'Caption'
|
83
|
+
raise TypeError 'expected string' unless v.is_a? String
|
84
|
+
|
85
|
+
@caption = v
|
86
|
+
when 'Model'
|
87
|
+
raise TypeError 'expected string' unless v.is_a? String
|
88
|
+
|
89
|
+
@model = v
|
90
|
+
when 'SerialNumber'
|
91
|
+
raise TypeError 'expected string' unless v.is_a? String
|
92
|
+
|
93
|
+
@serial_number = v
|
94
|
+
when 'Size'
|
95
|
+
@size = v
|
96
|
+
when 'Partitions'
|
97
|
+
if v.nil?
|
98
|
+
@partitions = []
|
99
|
+
else
|
100
|
+
@partitions = Array.new(v.length)
|
101
|
+
v.each_with_index do |v1, i1|
|
102
|
+
@partitions[i1] = Comet::Partition.new
|
103
|
+
@partitions[i1].from_hash(v1)
|
104
|
+
end
|
105
|
+
end
|
106
|
+
when 'Flags'
|
107
|
+
@flags = v
|
108
|
+
when 'Cylinders'
|
109
|
+
@cylinders = v
|
110
|
+
when 'Heads'
|
111
|
+
@heads = v
|
112
|
+
when 'Sectors'
|
113
|
+
@sectors = v
|
114
|
+
when 'SectorSize'
|
115
|
+
@sector_size = v
|
116
|
+
else
|
117
|
+
@unknown_json_fields[k] = v
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
# @return [Hash] The complete object as a Ruby hash
|
123
|
+
def to_hash
|
124
|
+
ret = {}
|
125
|
+
ret['ID'] = @id
|
126
|
+
ret['DeviceName'] = @device_name
|
127
|
+
ret['Caption'] = @caption
|
128
|
+
ret['Model'] = @model
|
129
|
+
ret['SerialNumber'] = @serial_number
|
130
|
+
ret['Size'] = @size
|
131
|
+
ret['Partitions'] = @partitions
|
132
|
+
ret['Flags'] = @flags
|
133
|
+
ret['Cylinders'] = @cylinders
|
134
|
+
ret['Heads'] = @heads
|
135
|
+
ret['Sectors'] = @sectors
|
136
|
+
ret['SectorSize'] = @sector_size
|
137
|
+
@unknown_json_fields.each do |k, v|
|
138
|
+
ret[k] = v
|
139
|
+
end
|
140
|
+
ret
|
141
|
+
end
|
142
|
+
|
143
|
+
# @return [Hash] The complete object as a Ruby hash
|
144
|
+
def to_h
|
145
|
+
to_hash
|
146
|
+
end
|
147
|
+
|
148
|
+
# @return [String] The complete object as a JSON string
|
149
|
+
def to_json(options = {})
|
150
|
+
to_hash.to_json(options)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
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
|
+
# DispatcherAdminSourcesResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class DispatcherAdminSourcesResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [Hash{String => String}] import_sources
|
24
|
+
attr_accessor :import_sources
|
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
|
+
@import_sources = {}
|
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 'expected string' 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 'expected hash' unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'Status'
|
48
|
+
@status = v
|
49
|
+
when 'Message'
|
50
|
+
raise TypeError 'expected string' unless v.is_a? String
|
51
|
+
|
52
|
+
@message = v
|
53
|
+
when 'ImportSources'
|
54
|
+
@import_sources = {}
|
55
|
+
if v.nil?
|
56
|
+
@import_sources = {}
|
57
|
+
else
|
58
|
+
v.each do |k1, v1|
|
59
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
60
|
+
|
61
|
+
@import_sources[k1] = v1
|
62
|
+
end
|
63
|
+
end
|
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['ImportSources'] = @import_sources
|
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,91 @@
|
|
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
|
+
# DispatcherStoredObjectsResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class DispatcherStoredObjectsResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [Array<Comet::StoredObject>] stored_objects
|
24
|
+
attr_accessor :stored_objects
|
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
|
+
@stored_objects = []
|
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 'expected string' 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 'expected hash' unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'Status'
|
48
|
+
@status = v
|
49
|
+
when 'Message'
|
50
|
+
raise TypeError 'expected string' unless v.is_a? String
|
51
|
+
|
52
|
+
@message = v
|
53
|
+
when 'StoredObjects'
|
54
|
+
if v.nil?
|
55
|
+
@stored_objects = []
|
56
|
+
else
|
57
|
+
@stored_objects = Array.new(v.length)
|
58
|
+
v.each_with_index do |v1, i1|
|
59
|
+
@stored_objects[i1] = Comet::StoredObject.new
|
60
|
+
@stored_objects[i1].from_hash(v1)
|
61
|
+
end
|
62
|
+
end
|
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['StoredObjects'] = @stored_objects
|
75
|
+
@unknown_json_fields.each do |k, v|
|
76
|
+
ret[k] = v
|
77
|
+
end
|
78
|
+
ret
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [Hash] The complete object as a Ruby hash
|
82
|
+
def to_h
|
83
|
+
to_hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [String] The complete object as a JSON string
|
87
|
+
def to_json(options = {})
|
88
|
+
to_hash.to_json(options)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,91 @@
|
|
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
|
+
# DispatcherVaultSnapshotsResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class DispatcherVaultSnapshotsResponse
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [Array<Comet::VaultSnapshot>] snapshots
|
24
|
+
attr_accessor :snapshots
|
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
|
+
@snapshots = []
|
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 'expected string' 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 'expected hash' unless obj.is_a? Hash
|
44
|
+
|
45
|
+
obj.each do |k, v|
|
46
|
+
case k
|
47
|
+
when 'Status'
|
48
|
+
@status = v
|
49
|
+
when 'Message'
|
50
|
+
raise TypeError 'expected string' unless v.is_a? String
|
51
|
+
|
52
|
+
@message = v
|
53
|
+
when 'Snapshots'
|
54
|
+
if v.nil?
|
55
|
+
@snapshots = []
|
56
|
+
else
|
57
|
+
@snapshots = Array.new(v.length)
|
58
|
+
v.each_with_index do |v1, i1|
|
59
|
+
@snapshots[i1] = Comet::VaultSnapshot.new
|
60
|
+
@snapshots[i1].from_hash(v1)
|
61
|
+
end
|
62
|
+
end
|
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['Snapshots'] = @snapshots
|
75
|
+
@unknown_json_fields.each do |k, v|
|
76
|
+
ret[k] = v
|
77
|
+
end
|
78
|
+
ret
|
79
|
+
end
|
80
|
+
|
81
|
+
# @return [Hash] The complete object as a Ruby hash
|
82
|
+
def to_h
|
83
|
+
to_hash
|
84
|
+
end
|
85
|
+
|
86
|
+
# @return [String] The complete object as a JSON string
|
87
|
+
def to_json(options = {})
|
88
|
+
to_hash.to_json(options)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|