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,138 @@
|
|
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
|
+
# ReplicatorStateAPIResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class ReplicatorStateAPIResponse
|
16
|
+
|
17
|
+
# @type [String] description
|
18
|
+
attr_accessor :description
|
19
|
+
|
20
|
+
# @type [String] remote_server_id
|
21
|
+
attr_accessor :remote_server_id
|
22
|
+
|
23
|
+
# @type [Number] display_class
|
24
|
+
attr_accessor :display_class
|
25
|
+
|
26
|
+
# @type [Number] active_workers
|
27
|
+
attr_accessor :active_workers
|
28
|
+
|
29
|
+
# @type [Number] total_workers
|
30
|
+
attr_accessor :total_workers
|
31
|
+
|
32
|
+
# @type [Number] state
|
33
|
+
attr_accessor :state
|
34
|
+
|
35
|
+
# @type [Number] items_queued
|
36
|
+
attr_accessor :items_queued
|
37
|
+
|
38
|
+
# @type [Number] bytes_queued
|
39
|
+
attr_accessor :bytes_queued
|
40
|
+
|
41
|
+
# @type [Number] last_worker_submit_time
|
42
|
+
attr_accessor :last_worker_submit_time
|
43
|
+
|
44
|
+
# @type [Number] current_time
|
45
|
+
attr_accessor :current_time
|
46
|
+
|
47
|
+
# @type [Number] items_replicated
|
48
|
+
attr_accessor :items_replicated
|
49
|
+
|
50
|
+
# @type [Number] bytes_replicated
|
51
|
+
attr_accessor :bytes_replicated
|
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
|
+
@unknown_json_fields = {}
|
58
|
+
end
|
59
|
+
|
60
|
+
# @param [String] json_string The complete object in JSON format
|
61
|
+
def from_json(json_string)
|
62
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
63
|
+
|
64
|
+
from_hash(JSON.parse(json_string))
|
65
|
+
end
|
66
|
+
|
67
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
68
|
+
def from_hash(obj)
|
69
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
70
|
+
|
71
|
+
obj.each do |k, v|
|
72
|
+
case k
|
73
|
+
when 'Description'
|
74
|
+
raise TypeError 'expected string' unless v.is_a? String
|
75
|
+
|
76
|
+
@description = v
|
77
|
+
when 'RemoteServerID'
|
78
|
+
raise TypeError 'expected string' unless v.is_a? String
|
79
|
+
|
80
|
+
@remote_server_id = v
|
81
|
+
when 'DisplayClass'
|
82
|
+
@display_class = v
|
83
|
+
when 'ActiveWorkers'
|
84
|
+
@active_workers = v
|
85
|
+
when 'TotalWorkers'
|
86
|
+
@total_workers = v
|
87
|
+
when 'State'
|
88
|
+
@state = v
|
89
|
+
when 'ItemsQueued'
|
90
|
+
@items_queued = v
|
91
|
+
when 'BytesQueued'
|
92
|
+
@bytes_queued = v
|
93
|
+
when 'LastWorkerSubmitTime'
|
94
|
+
@last_worker_submit_time = v
|
95
|
+
when 'CurrentTime'
|
96
|
+
@current_time = v
|
97
|
+
when 'ItemsReplicated'
|
98
|
+
@items_replicated = v
|
99
|
+
when 'BytesReplicated'
|
100
|
+
@bytes_replicated = v
|
101
|
+
else
|
102
|
+
@unknown_json_fields[k] = v
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# @return [Hash] The complete object as a Ruby hash
|
108
|
+
def to_hash
|
109
|
+
ret = {}
|
110
|
+
ret['Description'] = @description
|
111
|
+
ret['RemoteServerID'] = @remote_server_id
|
112
|
+
ret['DisplayClass'] = @display_class
|
113
|
+
ret['ActiveWorkers'] = @active_workers
|
114
|
+
ret['TotalWorkers'] = @total_workers
|
115
|
+
ret['State'] = @state
|
116
|
+
ret['ItemsQueued'] = @items_queued
|
117
|
+
ret['BytesQueued'] = @bytes_queued
|
118
|
+
ret['LastWorkerSubmitTime'] = @last_worker_submit_time
|
119
|
+
ret['CurrentTime'] = @current_time
|
120
|
+
ret['ItemsReplicated'] = @items_replicated
|
121
|
+
ret['BytesReplicated'] = @bytes_replicated
|
122
|
+
@unknown_json_fields.each do |k, v|
|
123
|
+
ret[k] = v
|
124
|
+
end
|
125
|
+
ret
|
126
|
+
end
|
127
|
+
|
128
|
+
# @return [Hash] The complete object as a Ruby hash
|
129
|
+
def to_h
|
130
|
+
to_hash
|
131
|
+
end
|
132
|
+
|
133
|
+
# @return [String] The complete object as a JSON string
|
134
|
+
def to_json(options = {})
|
135
|
+
to_hash.to_json(options)
|
136
|
+
end
|
137
|
+
end
|
138
|
+
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
|
+
# RequestStorageVaultResponseMessage is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class RequestStorageVaultResponseMessage
|
16
|
+
|
17
|
+
# @type [Number] status
|
18
|
+
attr_accessor :status
|
19
|
+
|
20
|
+
# @type [String] message
|
21
|
+
attr_accessor :message
|
22
|
+
|
23
|
+
# @type [String] destination_id
|
24
|
+
attr_accessor :destination_id
|
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 'DestinationID'
|
53
|
+
raise TypeError 'expected string' unless v.is_a? String
|
54
|
+
|
55
|
+
@destination_id = 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['DestinationID'] = @destination_id
|
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,104 @@
|
|
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
|
+
# RestoreJobAdvancedOptions is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class RestoreJobAdvancedOptions
|
16
|
+
|
17
|
+
# @type [Number] type
|
18
|
+
attr_accessor :type
|
19
|
+
|
20
|
+
# @type [Boolean] overwrite_existing_files
|
21
|
+
attr_accessor :overwrite_existing_files
|
22
|
+
|
23
|
+
# @type [String] dest_path
|
24
|
+
attr_accessor :dest_path
|
25
|
+
|
26
|
+
# @type [Array<String>] exact_dest_paths
|
27
|
+
attr_accessor :exact_dest_paths
|
28
|
+
|
29
|
+
# @type [Number] archive_format
|
30
|
+
attr_accessor :archive_format
|
31
|
+
|
32
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
33
|
+
attr_accessor :unknown_json_fields
|
34
|
+
|
35
|
+
def initialize
|
36
|
+
@exact_dest_paths = []
|
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 'expected string' 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 'expected hash' unless obj.is_a? Hash
|
50
|
+
|
51
|
+
obj.each do |k, v|
|
52
|
+
case k
|
53
|
+
when 'Type'
|
54
|
+
@type = v
|
55
|
+
when 'OverwriteExistingFiles'
|
56
|
+
@overwrite_existing_files = v
|
57
|
+
when 'DestPath'
|
58
|
+
raise TypeError 'expected string' unless v.is_a? String
|
59
|
+
|
60
|
+
@dest_path = v
|
61
|
+
when 'ExactDestPaths'
|
62
|
+
if v.nil?
|
63
|
+
@exact_dest_paths = []
|
64
|
+
else
|
65
|
+
@exact_dest_paths = Array.new(v.length)
|
66
|
+
v.each_with_index do |v1, i1|
|
67
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
68
|
+
|
69
|
+
@exact_dest_paths[i1] = v1
|
70
|
+
end
|
71
|
+
end
|
72
|
+
when 'ArchiveFormat'
|
73
|
+
@archive_format = v
|
74
|
+
else
|
75
|
+
@unknown_json_fields[k] = v
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# @return [Hash] The complete object as a Ruby hash
|
81
|
+
def to_hash
|
82
|
+
ret = {}
|
83
|
+
ret['Type'] = @type
|
84
|
+
ret['OverwriteExistingFiles'] = @overwrite_existing_files
|
85
|
+
ret['DestPath'] = @dest_path
|
86
|
+
ret['ExactDestPaths'] = @exact_dest_paths
|
87
|
+
ret['ArchiveFormat'] = @archive_format
|
88
|
+
@unknown_json_fields.each do |k, v|
|
89
|
+
ret[k] = v
|
90
|
+
end
|
91
|
+
ret
|
92
|
+
end
|
93
|
+
|
94
|
+
# @return [Hash] The complete object as a Ruby hash
|
95
|
+
def to_h
|
96
|
+
to_hash
|
97
|
+
end
|
98
|
+
|
99
|
+
# @return [String] The complete object as a JSON string
|
100
|
+
def to_json(options = {})
|
101
|
+
to_hash.to_json(options)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,83 @@
|
|
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
|
+
# RetentionPolicy is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class RetentionPolicy
|
16
|
+
|
17
|
+
# @type [Number] mode
|
18
|
+
attr_accessor :mode
|
19
|
+
|
20
|
+
# @type [Array<Comet::RetentionRange>] ranges
|
21
|
+
attr_accessor :ranges
|
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
|
+
@ranges = []
|
28
|
+
@unknown_json_fields = {}
|
29
|
+
end
|
30
|
+
|
31
|
+
# @param [String] json_string The complete object in JSON format
|
32
|
+
def from_json(json_string)
|
33
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
34
|
+
|
35
|
+
from_hash(JSON.parse(json_string))
|
36
|
+
end
|
37
|
+
|
38
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
39
|
+
def from_hash(obj)
|
40
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
41
|
+
|
42
|
+
obj.each do |k, v|
|
43
|
+
case k
|
44
|
+
when 'Mode'
|
45
|
+
@mode = v
|
46
|
+
when 'Ranges'
|
47
|
+
if v.nil?
|
48
|
+
@ranges = []
|
49
|
+
else
|
50
|
+
@ranges = Array.new(v.length)
|
51
|
+
v.each_with_index do |v1, i1|
|
52
|
+
@ranges[i1] = Comet::RetentionRange.new
|
53
|
+
@ranges[i1].from_hash(v1)
|
54
|
+
end
|
55
|
+
end
|
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['Mode'] = @mode
|
66
|
+
ret['Ranges'] = @ranges
|
67
|
+
@unknown_json_fields.each do |k, v|
|
68
|
+
ret[k] = v
|
69
|
+
end
|
70
|
+
ret
|
71
|
+
end
|
72
|
+
|
73
|
+
# @return [Hash] The complete object as a Ruby hash
|
74
|
+
def to_h
|
75
|
+
to_hash
|
76
|
+
end
|
77
|
+
|
78
|
+
# @return [String] The complete object as a JSON string
|
79
|
+
def to_json(options = {})
|
80
|
+
to_hash.to_json(options)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,110 @@
|
|
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
|
+
# RetentionRange is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class RetentionRange
|
16
|
+
|
17
|
+
# @type [Number] type
|
18
|
+
attr_accessor :type
|
19
|
+
|
20
|
+
# @type [Number] timestamp
|
21
|
+
attr_accessor :timestamp
|
22
|
+
|
23
|
+
# @type [Number] jobs
|
24
|
+
attr_accessor :jobs
|
25
|
+
|
26
|
+
# @type [Number] days
|
27
|
+
attr_accessor :days
|
28
|
+
|
29
|
+
# @type [Number] weeks
|
30
|
+
attr_accessor :weeks
|
31
|
+
|
32
|
+
# @type [Number] months
|
33
|
+
attr_accessor :months
|
34
|
+
|
35
|
+
# @type [Number] week_offset
|
36
|
+
attr_accessor :week_offset
|
37
|
+
|
38
|
+
# @type [Number] month_offset
|
39
|
+
attr_accessor :month_offset
|
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 'Type'
|
62
|
+
@type = v
|
63
|
+
when 'Timestamp'
|
64
|
+
@timestamp = v
|
65
|
+
when 'Jobs'
|
66
|
+
@jobs = v
|
67
|
+
when 'Days'
|
68
|
+
@days = v
|
69
|
+
when 'Weeks'
|
70
|
+
@weeks = v
|
71
|
+
when 'Months'
|
72
|
+
@months = v
|
73
|
+
when 'WeekOffset'
|
74
|
+
@week_offset = v
|
75
|
+
when 'MonthOffset'
|
76
|
+
@month_offset = v
|
77
|
+
else
|
78
|
+
@unknown_json_fields[k] = v
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
# @return [Hash] The complete object as a Ruby hash
|
84
|
+
def to_hash
|
85
|
+
ret = {}
|
86
|
+
ret['Type'] = @type
|
87
|
+
ret['Timestamp'] = @timestamp
|
88
|
+
ret['Jobs'] = @jobs
|
89
|
+
ret['Days'] = @days
|
90
|
+
ret['Weeks'] = @weeks
|
91
|
+
ret['Months'] = @months
|
92
|
+
ret['WeekOffset'] = @week_offset
|
93
|
+
ret['MonthOffset'] = @month_offset
|
94
|
+
@unknown_json_fields.each do |k, v|
|
95
|
+
ret[k] = v
|
96
|
+
end
|
97
|
+
ret
|
98
|
+
end
|
99
|
+
|
100
|
+
# @return [Hash] The complete object as a Ruby hash
|
101
|
+
def to_h
|
102
|
+
to_hash
|
103
|
+
end
|
104
|
+
|
105
|
+
# @return [String] The complete object as a JSON string
|
106
|
+
def to_json(options = {})
|
107
|
+
to_hash.to_json(options)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|