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,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
|
+
# AdminUserPermissions is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AdminUserPermissions
|
16
|
+
|
17
|
+
# @type [Boolean] prevent_edit_server_settings
|
18
|
+
attr_accessor :prevent_edit_server_settings
|
19
|
+
|
20
|
+
# @type [Boolean] prevent_server_shutdown
|
21
|
+
attr_accessor :prevent_server_shutdown
|
22
|
+
|
23
|
+
# @type [Boolean] prevent_change_password
|
24
|
+
attr_accessor :prevent_change_password
|
25
|
+
|
26
|
+
# @type [Boolean] allow_edit_branding
|
27
|
+
attr_accessor :allow_edit_branding
|
28
|
+
|
29
|
+
# @type [Boolean] allow_edit_remote_storage
|
30
|
+
attr_accessor :allow_edit_remote_storage
|
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
|
+
@unknown_json_fields = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] json_string The complete object in JSON format
|
40
|
+
def from_json(json_string)
|
41
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
42
|
+
|
43
|
+
from_hash(JSON.parse(json_string))
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
47
|
+
def from_hash(obj)
|
48
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
49
|
+
|
50
|
+
obj.each do |k, v|
|
51
|
+
case k
|
52
|
+
when 'PreventEditServerSettings'
|
53
|
+
@prevent_edit_server_settings = v
|
54
|
+
when 'PreventServerShutdown'
|
55
|
+
@prevent_server_shutdown = v
|
56
|
+
when 'PreventChangePassword'
|
57
|
+
@prevent_change_password = v
|
58
|
+
when 'AllowEditBranding'
|
59
|
+
@allow_edit_branding = v
|
60
|
+
when 'AllowEditRemoteStorage'
|
61
|
+
@allow_edit_remote_storage = v
|
62
|
+
else
|
63
|
+
@unknown_json_fields[k] = v
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [Hash] The complete object as a Ruby hash
|
69
|
+
def to_hash
|
70
|
+
ret = {}
|
71
|
+
unless @prevent_edit_server_settings.nil?
|
72
|
+
ret['PreventEditServerSettings'] = @prevent_edit_server_settings
|
73
|
+
end
|
74
|
+
unless @prevent_server_shutdown.nil?
|
75
|
+
ret['PreventServerShutdown'] = @prevent_server_shutdown
|
76
|
+
end
|
77
|
+
unless @prevent_change_password.nil?
|
78
|
+
ret['PreventChangePassword'] = @prevent_change_password
|
79
|
+
end
|
80
|
+
unless @allow_edit_branding.nil?
|
81
|
+
ret['AllowEditBranding'] = @allow_edit_branding
|
82
|
+
end
|
83
|
+
unless @allow_edit_remote_storage.nil?
|
84
|
+
ret['AllowEditRemoteStorage'] = @allow_edit_remote_storage
|
85
|
+
end
|
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,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
|
+
# AvailableDownload is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AvailableDownload
|
16
|
+
|
17
|
+
# @type [String] category
|
18
|
+
attr_accessor :category
|
19
|
+
|
20
|
+
# @type [String] description
|
21
|
+
attr_accessor :description
|
22
|
+
|
23
|
+
# @type [Boolean] recommended
|
24
|
+
attr_accessor :recommended
|
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 'Category'
|
47
|
+
raise TypeError 'expected string' unless v.is_a? String
|
48
|
+
|
49
|
+
@category = v
|
50
|
+
when 'Description'
|
51
|
+
raise TypeError 'expected string' unless v.is_a? String
|
52
|
+
|
53
|
+
@description = v
|
54
|
+
when 'Recommended'
|
55
|
+
@recommended = 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['Category'] = @category
|
66
|
+
ret['Description'] = @description
|
67
|
+
ret['Recommended'] = @recommended
|
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,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
|
+
# AzureDestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class AzureDestinationLocation
|
16
|
+
|
17
|
+
# @type [String] azbaccount_name
|
18
|
+
attr_accessor :azbaccount_name
|
19
|
+
|
20
|
+
# @type [String] azbaccount_key
|
21
|
+
attr_accessor :azbaccount_key
|
22
|
+
|
23
|
+
# @type [String] azbcontainer
|
24
|
+
attr_accessor :azbcontainer
|
25
|
+
|
26
|
+
# @type [String] azbrealm
|
27
|
+
attr_accessor :azbrealm
|
28
|
+
|
29
|
+
# @type [String] azbprefix
|
30
|
+
attr_accessor :azbprefix
|
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
|
+
@unknown_json_fields = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] json_string The complete object in JSON format
|
40
|
+
def from_json(json_string)
|
41
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
42
|
+
|
43
|
+
from_hash(JSON.parse(json_string))
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
47
|
+
def from_hash(obj)
|
48
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
49
|
+
|
50
|
+
obj.each do |k, v|
|
51
|
+
case k
|
52
|
+
when 'AZBAccountName'
|
53
|
+
raise TypeError 'expected string' unless v.is_a? String
|
54
|
+
|
55
|
+
@azbaccount_name = v
|
56
|
+
when 'AZBAccountKey'
|
57
|
+
raise TypeError 'expected string' unless v.is_a? String
|
58
|
+
|
59
|
+
@azbaccount_key = v
|
60
|
+
when 'AZBContainer'
|
61
|
+
raise TypeError 'expected string' unless v.is_a? String
|
62
|
+
|
63
|
+
@azbcontainer = v
|
64
|
+
when 'AZBRealm'
|
65
|
+
raise TypeError 'expected string' unless v.is_a? String
|
66
|
+
|
67
|
+
@azbrealm = v
|
68
|
+
when 'AZBPrefix'
|
69
|
+
raise TypeError 'expected string' unless v.is_a? String
|
70
|
+
|
71
|
+
@azbprefix = v
|
72
|
+
else
|
73
|
+
@unknown_json_fields[k] = v
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
# @return [Hash] The complete object as a Ruby hash
|
79
|
+
def to_hash
|
80
|
+
ret = {}
|
81
|
+
ret['AZBAccountName'] = @azbaccount_name
|
82
|
+
ret['AZBAccountKey'] = @azbaccount_key
|
83
|
+
ret['AZBContainer'] = @azbcontainer
|
84
|
+
ret['AZBRealm'] = @azbrealm
|
85
|
+
ret['AZBPrefix'] = @azbprefix
|
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,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
|
+
# B2DestinationLocation is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class B2DestinationLocation
|
16
|
+
|
17
|
+
# @type [String] account_id
|
18
|
+
attr_accessor :account_id
|
19
|
+
|
20
|
+
# @type [String] key
|
21
|
+
attr_accessor :key
|
22
|
+
|
23
|
+
# @type [String] bucket
|
24
|
+
attr_accessor :bucket
|
25
|
+
|
26
|
+
# @type [String] prefix
|
27
|
+
attr_accessor :prefix
|
28
|
+
|
29
|
+
# @type [Number] max_connections
|
30
|
+
attr_accessor :max_connections
|
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
|
+
@unknown_json_fields = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
# @param [String] json_string The complete object in JSON format
|
40
|
+
def from_json(json_string)
|
41
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
42
|
+
|
43
|
+
from_hash(JSON.parse(json_string))
|
44
|
+
end
|
45
|
+
|
46
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
47
|
+
def from_hash(obj)
|
48
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
49
|
+
|
50
|
+
obj.each do |k, v|
|
51
|
+
case k
|
52
|
+
when 'AccountID'
|
53
|
+
raise TypeError 'expected string' unless v.is_a? String
|
54
|
+
|
55
|
+
@account_id = v
|
56
|
+
when 'Key'
|
57
|
+
raise TypeError 'expected string' unless v.is_a? String
|
58
|
+
|
59
|
+
@key = v
|
60
|
+
when 'Bucket'
|
61
|
+
raise TypeError 'expected string' unless v.is_a? String
|
62
|
+
|
63
|
+
@bucket = v
|
64
|
+
when 'Prefix'
|
65
|
+
raise TypeError 'expected string' unless v.is_a? String
|
66
|
+
|
67
|
+
@prefix = v
|
68
|
+
when 'MaxConnections'
|
69
|
+
@max_connections = v
|
70
|
+
else
|
71
|
+
@unknown_json_fields[k] = v
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [Hash] The complete object as a Ruby hash
|
77
|
+
def to_hash
|
78
|
+
ret = {}
|
79
|
+
unless @account_id.nil?
|
80
|
+
ret['AccountID'] = @account_id
|
81
|
+
end
|
82
|
+
unless @key.nil?
|
83
|
+
ret['Key'] = @key
|
84
|
+
end
|
85
|
+
unless @bucket.nil?
|
86
|
+
ret['Bucket'] = @bucket
|
87
|
+
end
|
88
|
+
unless @prefix.nil?
|
89
|
+
ret['Prefix'] = @prefix
|
90
|
+
end
|
91
|
+
unless @max_connections.nil?
|
92
|
+
ret['MaxConnections'] = @max_connections
|
93
|
+
end
|
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
|
@@ -0,0 +1,77 @@
|
|
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
|
+
# B2StorageExtraInfo is a typed class wrapper around the underlying Comet Server API data structure.
|
15
|
+
class B2StorageExtraInfo
|
16
|
+
|
17
|
+
# @type [Hash{Number => Comet::B2TransactionTotals}] total_transactions_in_time_interval
|
18
|
+
attr_accessor :total_transactions_in_time_interval
|
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
|
+
@total_transactions_in_time_interval = {}
|
25
|
+
@unknown_json_fields = {}
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [String] json_string The complete object in JSON format
|
29
|
+
def from_json(json_string)
|
30
|
+
raise TypeError 'expected string' unless json_string.is_a? String
|
31
|
+
|
32
|
+
from_hash(JSON.parse(json_string))
|
33
|
+
end
|
34
|
+
|
35
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
36
|
+
def from_hash(obj)
|
37
|
+
raise TypeError 'expected hash' unless obj.is_a? Hash
|
38
|
+
|
39
|
+
obj.each do |k, v|
|
40
|
+
case k
|
41
|
+
when 'TotalTransactionsInTimeInterval'
|
42
|
+
@total_transactions_in_time_interval = {}
|
43
|
+
if v.nil?
|
44
|
+
@total_transactions_in_time_interval = {}
|
45
|
+
else
|
46
|
+
v.each do |k1, v1|
|
47
|
+
@total_transactions_in_time_interval[k1] = Comet::B2TransactionTotals.new
|
48
|
+
@total_transactions_in_time_interval[k1].from_hash(v1)
|
49
|
+
end
|
50
|
+
end
|
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['TotalTransactionsInTimeInterval'] = @total_transactions_in_time_interval
|
61
|
+
@unknown_json_fields.each do |k, v|
|
62
|
+
ret[k] = v
|
63
|
+
end
|
64
|
+
ret
|
65
|
+
end
|
66
|
+
|
67
|
+
# @return [Hash] The complete object as a Ruby hash
|
68
|
+
def to_h
|
69
|
+
to_hash
|
70
|
+
end
|
71
|
+
|
72
|
+
# @return [String] The complete object as a JSON string
|
73
|
+
def to_json(options = {})
|
74
|
+
to_hash.to_json(options)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|