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,74 @@
|
|
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
|
+
# SoftwareBuildRoleOptions is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class SoftwareBuildRoleOptions
|
16
|
+
|
17
|
+
# @type [Boolean] role_enabled
|
18
|
+
attr_accessor :role_enabled
|
19
|
+
|
20
|
+
# @type [Boolean] allow_unauthenticated_downloads
|
21
|
+
attr_accessor :allow_unauthenticated_downloads
|
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 'RoleEnabled'
|
44
|
+
@role_enabled = v
|
45
|
+
when 'AllowUnauthenticatedDownloads'
|
46
|
+
@allow_unauthenticated_downloads = v
|
47
|
+
else
|
48
|
+
@unknown_json_fields[k] = v
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# @return [Hash] The complete object as a Ruby hash
|
54
|
+
def to_hash
|
55
|
+
ret = {}
|
56
|
+
ret['RoleEnabled'] = @role_enabled
|
57
|
+
ret['AllowUnauthenticatedDownloads'] = @allow_unauthenticated_downloads
|
58
|
+
@unknown_json_fields.each do |k, v|
|
59
|
+
ret[k] = v
|
60
|
+
end
|
61
|
+
ret
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [Hash] The complete object as a Ruby hash
|
65
|
+
def to_h
|
66
|
+
to_hash
|
67
|
+
end
|
68
|
+
|
69
|
+
# @return [String] The complete object as a JSON string
|
70
|
+
def to_json(options = {})
|
71
|
+
to_hash.to_json(options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,102 @@
|
|
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
|
+
# SoftwareUpdateNewsResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class SoftwareUpdateNewsResponse
|
16
|
+
|
17
|
+
# @type [String] latest_stable
|
18
|
+
attr_accessor :latest_stable
|
19
|
+
|
20
|
+
# @type [String] latest_prerelease
|
21
|
+
attr_accessor :latest_prerelease
|
22
|
+
|
23
|
+
# @type [String] downloads_url
|
24
|
+
attr_accessor :downloads_url
|
25
|
+
|
26
|
+
# @type [Array<String>] whats_new
|
27
|
+
attr_accessor :whats_new
|
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
|
+
@whats_new = []
|
34
|
+
@unknown_json_fields = {}
|
35
|
+
end
|
36
|
+
|
37
|
+
# @param [String] json_string The complete object in JSON format
|
38
|
+
def from_json(json_string)
|
39
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
40
|
+
|
41
|
+
from_hash(JSON.parse(json_string))
|
42
|
+
end
|
43
|
+
|
44
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
45
|
+
def from_hash(obj)
|
46
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
47
|
+
|
48
|
+
obj.each do |k, v|
|
49
|
+
case k
|
50
|
+
when 'latest_stable'
|
51
|
+
raise TypeError 'expected string' unless v.is_a? String
|
52
|
+
|
53
|
+
@latest_stable = v
|
54
|
+
when 'latest_prerelease'
|
55
|
+
raise TypeError 'expected string' unless v.is_a? String
|
56
|
+
|
57
|
+
@latest_prerelease = v
|
58
|
+
when 'downloads_url'
|
59
|
+
raise TypeError 'expected string' unless v.is_a? String
|
60
|
+
|
61
|
+
@downloads_url = v
|
62
|
+
when 'updates_info'
|
63
|
+
if v.nil?
|
64
|
+
@whats_new = []
|
65
|
+
else
|
66
|
+
@whats_new = Array.new(v.length)
|
67
|
+
v.each_with_index do |v1, i1|
|
68
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
69
|
+
|
70
|
+
@whats_new[i1] = v1
|
71
|
+
end
|
72
|
+
end
|
73
|
+
else
|
74
|
+
@unknown_json_fields[k] = v
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# @return [Hash] The complete object as a Ruby hash
|
80
|
+
def to_hash
|
81
|
+
ret = {}
|
82
|
+
ret['latest_stable'] = @latest_stable
|
83
|
+
ret['latest_prerelease'] = @latest_prerelease
|
84
|
+
ret['downloads_url'] = @downloads_url
|
85
|
+
ret['updates_info'] = @whats_new
|
86
|
+
@unknown_json_fields.each do |k, v|
|
87
|
+
ret[k] = v
|
88
|
+
end
|
89
|
+
ret
|
90
|
+
end
|
91
|
+
|
92
|
+
# @return [Hash] The complete object as a Ruby hash
|
93
|
+
def to_h
|
94
|
+
to_hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# @return [String] The complete object as a JSON string
|
98
|
+
def to_json(options = {})
|
99
|
+
to_hash.to_json(options)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
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
|
+
# SourceBasicInfo is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class SourceBasicInfo
|
16
|
+
|
17
|
+
# @type [String] description
|
18
|
+
attr_accessor :description
|
19
|
+
|
20
|
+
# @type [Number] size
|
21
|
+
attr_accessor :size
|
22
|
+
|
23
|
+
# @type [Hash{String => Comet::RetentionPolicy}] override_destination_retention
|
24
|
+
attr_accessor :override_destination_retention
|
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
|
+
@override_destination_retention = {}
|
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 'Description'
|
48
|
+
raise TypeError 'expected string' unless v.is_a? String
|
49
|
+
|
50
|
+
@description = v
|
51
|
+
when 'Size'
|
52
|
+
@size = v
|
53
|
+
when 'OverrideDestinationRetention'
|
54
|
+
@override_destination_retention = {}
|
55
|
+
if v.nil?
|
56
|
+
@override_destination_retention = {}
|
57
|
+
else
|
58
|
+
v.each do |k1, v1|
|
59
|
+
@override_destination_retention[k1] = Comet::RetentionPolicy.new
|
60
|
+
@override_destination_retention[k1].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['Description'] = @description
|
73
|
+
ret['Size'] = @size
|
74
|
+
unless @override_destination_retention.nil?
|
75
|
+
ret['OverrideDestinationRetention'] = @override_destination_retention
|
76
|
+
end
|
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
|
@@ -0,0 +1,172 @@
|
|
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
|
+
# SourceConfig is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class SourceConfig
|
16
|
+
|
17
|
+
# @type [String] engine
|
18
|
+
attr_accessor :engine
|
19
|
+
|
20
|
+
# @type [String] description
|
21
|
+
attr_accessor :description
|
22
|
+
|
23
|
+
# @type [String] owner_device
|
24
|
+
attr_accessor :owner_device
|
25
|
+
|
26
|
+
# @type [Number] create_time
|
27
|
+
attr_accessor :create_time
|
28
|
+
|
29
|
+
# @type [Number] modify_time
|
30
|
+
attr_accessor :modify_time
|
31
|
+
|
32
|
+
# @type [Array<String>] pre_exec
|
33
|
+
attr_accessor :pre_exec
|
34
|
+
|
35
|
+
# @type [Array<String>] post_exec
|
36
|
+
attr_accessor :post_exec
|
37
|
+
|
38
|
+
# @type [Hash{String => String}] engine_props
|
39
|
+
attr_accessor :engine_props
|
40
|
+
|
41
|
+
# @type [Hash{String => Comet::RetentionPolicy}] override_destination_retention
|
42
|
+
attr_accessor :override_destination_retention
|
43
|
+
|
44
|
+
# @type [Comet::SourceStatistics] statistics
|
45
|
+
attr_accessor :statistics
|
46
|
+
|
47
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
48
|
+
attr_accessor :unknown_json_fields
|
49
|
+
|
50
|
+
def initialize
|
51
|
+
@pre_exec = []
|
52
|
+
@post_exec = []
|
53
|
+
@engine_props = {}
|
54
|
+
@override_destination_retention = {}
|
55
|
+
@unknown_json_fields = {}
|
56
|
+
end
|
57
|
+
|
58
|
+
# @param [String] json_string The complete object in JSON format
|
59
|
+
def from_json(json_string)
|
60
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
61
|
+
|
62
|
+
from_hash(JSON.parse(json_string))
|
63
|
+
end
|
64
|
+
|
65
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
66
|
+
def from_hash(obj)
|
67
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
68
|
+
|
69
|
+
obj.each do |k, v|
|
70
|
+
case k
|
71
|
+
when 'Engine'
|
72
|
+
raise TypeError 'expected string' unless v.is_a? String
|
73
|
+
|
74
|
+
@engine = v
|
75
|
+
when 'Description'
|
76
|
+
raise TypeError 'expected string' unless v.is_a? String
|
77
|
+
|
78
|
+
@description = v
|
79
|
+
when 'OwnerDevice'
|
80
|
+
raise TypeError 'expected string' unless v.is_a? String
|
81
|
+
|
82
|
+
@owner_device = v
|
83
|
+
when 'CreateTime'
|
84
|
+
@create_time = v
|
85
|
+
when 'ModifyTime'
|
86
|
+
@modify_time = v
|
87
|
+
when 'PreExec'
|
88
|
+
if v.nil?
|
89
|
+
@pre_exec = []
|
90
|
+
else
|
91
|
+
@pre_exec = Array.new(v.length)
|
92
|
+
v.each_with_index do |v1, i1|
|
93
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
94
|
+
|
95
|
+
@pre_exec[i1] = v1
|
96
|
+
end
|
97
|
+
end
|
98
|
+
when 'PostExec'
|
99
|
+
if v.nil?
|
100
|
+
@post_exec = []
|
101
|
+
else
|
102
|
+
@post_exec = Array.new(v.length)
|
103
|
+
v.each_with_index do |v1, i1|
|
104
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
105
|
+
|
106
|
+
@post_exec[i1] = v1
|
107
|
+
end
|
108
|
+
end
|
109
|
+
when 'EngineProps'
|
110
|
+
@engine_props = {}
|
111
|
+
if v.nil?
|
112
|
+
@engine_props = {}
|
113
|
+
else
|
114
|
+
v.each do |k1, v1|
|
115
|
+
raise TypeError 'expected string' unless v1.is_a? String
|
116
|
+
|
117
|
+
@engine_props[k1] = v1
|
118
|
+
end
|
119
|
+
end
|
120
|
+
when 'OverrideDestinationRetention'
|
121
|
+
@override_destination_retention = {}
|
122
|
+
if v.nil?
|
123
|
+
@override_destination_retention = {}
|
124
|
+
else
|
125
|
+
v.each do |k1, v1|
|
126
|
+
@override_destination_retention[k1] = Comet::RetentionPolicy.new
|
127
|
+
@override_destination_retention[k1].from_hash(v1)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
when 'Statistics'
|
131
|
+
@statistics = Comet::SourceStatistics.new
|
132
|
+
@statistics.from_hash(v)
|
133
|
+
else
|
134
|
+
@unknown_json_fields[k] = v
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
# @return [Hash] The complete object as a Ruby hash
|
140
|
+
def to_hash
|
141
|
+
ret = {}
|
142
|
+
ret['Engine'] = @engine
|
143
|
+
ret['Description'] = @description
|
144
|
+
ret['OwnerDevice'] = @owner_device
|
145
|
+
ret['CreateTime'] = @create_time
|
146
|
+
ret['ModifyTime'] = @modify_time
|
147
|
+
ret['PreExec'] = @pre_exec
|
148
|
+
ret['PostExec'] = @post_exec
|
149
|
+
ret['EngineProps'] = @engine_props
|
150
|
+
unless @override_destination_retention.nil?
|
151
|
+
ret['OverrideDestinationRetention'] = @override_destination_retention
|
152
|
+
end
|
153
|
+
unless @statistics.nil?
|
154
|
+
ret['Statistics'] = @statistics
|
155
|
+
end
|
156
|
+
@unknown_json_fields.each do |k, v|
|
157
|
+
ret[k] = v
|
158
|
+
end
|
159
|
+
ret
|
160
|
+
end
|
161
|
+
|
162
|
+
# @return [Hash] The complete object as a Ruby hash
|
163
|
+
def to_h
|
164
|
+
to_hash
|
165
|
+
end
|
166
|
+
|
167
|
+
# @return [String] The complete object as a JSON string
|
168
|
+
def to_json(options = {})
|
169
|
+
to_hash.to_json(options)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
end
|
@@ -0,0 +1,69 @@
|
|
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
|
+
# SourceStatistics is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class SourceStatistics
|
16
|
+
|
17
|
+
# @type [Comet::BackupJobDetail] last_backup_job
|
18
|
+
attr_accessor :last_backup_job
|
19
|
+
|
20
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
21
|
+
attr_accessor :unknown_json_fields
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@unknown_json_fields = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
# @param [String] json_string The complete object in JSON format
|
28
|
+
def from_json(json_string)
|
29
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
30
|
+
|
31
|
+
from_hash(JSON.parse(json_string))
|
32
|
+
end
|
33
|
+
|
34
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
35
|
+
def from_hash(obj)
|
36
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
37
|
+
|
38
|
+
obj.each do |k, v|
|
39
|
+
case k
|
40
|
+
when 'LastBackupJob'
|
41
|
+
@last_backup_job = Comet::BackupJobDetail.new
|
42
|
+
@last_backup_job.from_hash(v)
|
43
|
+
else
|
44
|
+
@unknown_json_fields[k] = v
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# @return [Hash] The complete object as a Ruby hash
|
50
|
+
def to_hash
|
51
|
+
ret = {}
|
52
|
+
ret['LastBackupJob'] = @last_backup_job
|
53
|
+
@unknown_json_fields.each do |k, v|
|
54
|
+
ret[k] = v
|
55
|
+
end
|
56
|
+
ret
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [Hash] The complete object as a Ruby hash
|
60
|
+
def to_h
|
61
|
+
to_hash
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [String] The complete object as a JSON string
|
65
|
+
def to_json(options = {})
|
66
|
+
to_hash.to_json(options)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|