comet_backup_ruby_sdk 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +7 -0
  2. data/.rubocop.yml +25 -0
  3. data/Gemfile +15 -0
  4. data/LICENSE +7 -0
  5. data/README.md +81 -0
  6. data/Rakefile +22 -0
  7. data/comet_backup_ruby_sdk.gemspec +35 -0
  8. data/lib/comet/api_response_error.rb +27 -0
  9. data/lib/comet/comet_server.rb +2926 -0
  10. data/lib/comet/definitions.rb +550 -0
  11. data/lib/comet/models/add_bucket_response_message.rb +92 -0
  12. data/lib/comet/models/admin_account_properties_response.rb +76 -0
  13. data/lib/comet/models/admin_resource_response.rb +84 -0
  14. data/lib/comet/models/admin_security_options.rb +139 -0
  15. data/lib/comet/models/admin_u2fregistration.rb +84 -0
  16. data/lib/comet/models/admin_user_permissions.rb +102 -0
  17. data/lib/comet/models/available_download.rb +84 -0
  18. data/lib/comet/models/azure_destination_location.rb +102 -0
  19. data/lib/comet/models/b2destination_location.rb +110 -0
  20. data/lib/comet/models/b2storage_extra_info.rb +77 -0
  21. data/lib/comet/models/b2transaction_totals.rb +80 -0
  22. data/lib/comet/models/backup_job_advanced_options.rb +98 -0
  23. data/lib/comet/models/backup_job_detail.rb +199 -0
  24. data/lib/comet/models/backup_job_progress.rb +92 -0
  25. data/lib/comet/models/backup_rule_config.rb +188 -0
  26. data/lib/comet/models/backup_rule_event_triggers.rb +78 -0
  27. data/lib/comet/models/branding_options.rb +283 -0
  28. data/lib/comet/models/branding_properties.rb +245 -0
  29. data/lib/comet/models/browse_disk_drives_response.rb +91 -0
  30. data/lib/comet/models/browse_edbresponse.rb +91 -0
  31. data/lib/comet/models/browse_hvresponse.rb +91 -0
  32. data/lib/comet/models/browse_vssresponse.rb +91 -0
  33. data/lib/comet/models/bucket_properties.rb +89 -0
  34. data/lib/comet/models/bucket_usage_info.rb +91 -0
  35. data/lib/comet/models/comet_apiresponse_message.rb +76 -0
  36. data/lib/comet/models/comet_destination_location.rb +86 -0
  37. data/lib/comet/models/constellation_check_report.rb +89 -0
  38. data/lib/comet/models/constellation_stats.rb +86 -0
  39. data/lib/comet/models/constellation_status_apiresponse.rb +109 -0
  40. data/lib/comet/models/content_measurement.rb +89 -0
  41. data/lib/comet/models/content_measurement_component.rb +84 -0
  42. data/lib/comet/models/create_group_policy_response.rb +84 -0
  43. data/lib/comet/models/default_email_report_policy.rb +83 -0
  44. data/lib/comet/models/destination_config.rb +465 -0
  45. data/lib/comet/models/destination_location.rb +365 -0
  46. data/lib/comet/models/destination_statistics.rb +102 -0
  47. data/lib/comet/models/device_config.rb +96 -0
  48. data/lib/comet/models/disk_drive.rb +153 -0
  49. data/lib/comet/models/dispatcher_admin_sources_response.rb +92 -0
  50. data/lib/comet/models/dispatcher_stored_objects_response.rb +91 -0
  51. data/lib/comet/models/dispatcher_vault_snapshots_response.rb +91 -0
  52. data/lib/comet/models/edbfile_info.rb +92 -0
  53. data/lib/comet/models/email_options.rb +140 -0
  54. data/lib/comet/models/email_report_config.rb +90 -0
  55. data/lib/comet/models/email_report_generated_preview.rb +100 -0
  56. data/lib/comet/models/extra_file_exclusion.rb +82 -0
  57. data/lib/comet/models/ftpdestination_location.rb +124 -0
  58. data/lib/comet/models/get_group_policy_response.rb +91 -0
  59. data/lib/comet/models/get_profile_and_hash_response_message.rb +91 -0
  60. data/lib/comet/models/get_profile_hash_response_message.rb +84 -0
  61. data/lib/comet/models/group_policy.rb +83 -0
  62. data/lib/comet/models/hyper_vmachine_info.rb +78 -0
  63. data/lib/comet/models/live_user_connection.rb +125 -0
  64. data/lib/comet/models/local_destination_location.rb +92 -0
  65. data/lib/comet/models/mac_oscode_sign_properties.rb +113 -0
  66. data/lib/comet/models/mongo_dbconnection.rb +211 -0
  67. data/lib/comet/models/new_bucket_detail.rb +78 -0
  68. data/lib/comet/models/news_entry.rb +76 -0
  69. data/lib/comet/models/osinfo.rb +92 -0
  70. data/lib/comet/models/partition.rb +148 -0
  71. data/lib/comet/models/private_branding_properties.rb +185 -0
  72. data/lib/comet/models/protected_item_engine_type_policy.rb +84 -0
  73. data/lib/comet/models/public_branding_properties.rb +122 -0
  74. data/lib/comet/models/remote_server_address.rb +135 -0
  75. data/lib/comet/models/remote_storage_option.rb +147 -0
  76. data/lib/comet/models/replicator_state_apiresponse.rb +138 -0
  77. data/lib/comet/models/request_storage_vault_response_message.rb +84 -0
  78. data/lib/comet/models/restore_job_advanced_options.rb +104 -0
  79. data/lib/comet/models/retention_policy.rb +83 -0
  80. data/lib/comet/models/retention_range.rb +110 -0
  81. data/lib/comet/models/s3destination_location.rb +114 -0
  82. data/lib/comet/models/schedule_config.rb +82 -0
  83. data/lib/comet/models/search_clause.rb +111 -0
  84. data/lib/comet/models/server_config_options_branding_fragment.rb +69 -0
  85. data/lib/comet/models/server_config_options_software_build_role_fragment.rb +69 -0
  86. data/lib/comet/models/server_meta_version_info.rb +208 -0
  87. data/lib/comet/models/session_key_regenerated_response.rb +92 -0
  88. data/lib/comet/models/sftpdestination_location.rb +122 -0
  89. data/lib/comet/models/size_measurement.rb +80 -0
  90. data/lib/comet/models/software_build_role_options.rb +74 -0
  91. data/lib/comet/models/software_update_news_response.rb +102 -0
  92. data/lib/comet/models/source_basic_info.rb +93 -0
  93. data/lib/comet/models/source_config.rb +172 -0
  94. data/lib/comet/models/source_statistics.rb +69 -0
  95. data/lib/comet/models/spanned_destination_location.rb +77 -0
  96. data/lib/comet/models/spanned_storage_extra_info.rb +77 -0
  97. data/lib/comet/models/sshconnection.rb +114 -0
  98. data/lib/comet/models/stat_result.rb +86 -0
  99. data/lib/comet/models/storage_free_space_info.rb +98 -0
  100. data/lib/comet/models/storage_vault_provider_policy.rb +82 -0
  101. data/lib/comet/models/stored_object.rb +130 -0
  102. data/lib/comet/models/streamable_event.rb +74 -0
  103. data/lib/comet/models/swift_destination_location.rb +192 -0
  104. data/lib/comet/models/test_response.rb +82 -0
  105. data/lib/comet/models/totp_regenerated_response.rb +100 -0
  106. data/lib/comet/models/u2fregister_request.rb +78 -0
  107. data/lib/comet/models/u2fregistered_key.rb +86 -0
  108. data/lib/comet/models/u2fregistration_challenge_response.rb +122 -0
  109. data/lib/comet/models/u2fsign_request.rb +101 -0
  110. data/lib/comet/models/u2fsign_response.rb +94 -0
  111. data/lib/comet/models/uninstall_config.rb +74 -0
  112. data/lib/comet/models/update_campaign_device_status.rb +68 -0
  113. data/lib/comet/models/update_campaign_options.rb +86 -0
  114. data/lib/comet/models/update_campaign_properties.rb +100 -0
  115. data/lib/comet/models/update_campaign_status.rb +115 -0
  116. data/lib/comet/models/update_campaign_status_device_entry.rb +84 -0
  117. data/lib/comet/models/user_custom_email_settings.rb +77 -0
  118. data/lib/comet/models/user_on_server.rb +76 -0
  119. data/lib/comet/models/user_policy.rb +304 -0
  120. data/lib/comet/models/user_profile_config.rb +300 -0
  121. data/lib/comet/models/user_profile_fragment.rb +70 -0
  122. data/lib/comet/models/vault_snapshot.rb +84 -0
  123. data/lib/comet/models/vsscomponent.rb +92 -0
  124. data/lib/comet/models/vsswriter_info.rb +85 -0
  125. data/lib/comet/models/web_interface_branding_properties.rb +100 -0
  126. data/lib/comet/models/webhook_option.rb +84 -0
  127. data/lib/comet/models/win_smbauth.rb +92 -0
  128. data/lib/comet/models/windows_code_sign_properties.rb +130 -0
  129. data/lib/comet_backup_ruby_sdk.rb +130 -0
  130. metadata +227 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6e51a11d5b03cf1b325584c429159a4e3ee504d3bbb35bba40018598ff96becf
4
+ data.tar.gz: 1ef176d29a079a13ae4aea6489afbd6b2682d143c567876bf9009aa33122b161
5
+ SHA512:
6
+ metadata.gz: c6a241c4231616d77fc376d0d165b15256ae59cbf4fff1e62a62d9812d355f046cf52d89fa06b05ec5d1ec3cce902baf7b63c7faba8058051c2e22c45bc10f4a
7
+ data.tar.gz: b402d40013cab79d0af2b33c91423de4572686cd1b1ed372ccbdb2857745bbc48d46c01cdf904d09a9a846567c69b9813e92bd8f9c6cd1e08195c5a82d2d6731
@@ -0,0 +1,25 @@
1
+ AllCops:
2
+ NewCops: enable
3
+
4
+ # Use unix LF file endings on all OS platforms
5
+ Layout/EndOfLine:
6
+ EnforcedStyle: lf
7
+
8
+ # Disable complexity metrics - it's out of our control
9
+ Metrics:
10
+ Enabled: false
11
+
12
+ Layout/LineLength:
13
+ Enabled: false
14
+
15
+ # Allow a bit more whitespace
16
+ Layout/EmptyLinesAroundModuleBody:
17
+ Enabled: false
18
+
19
+ Layout/EmptyLinesAroundClassBody:
20
+ Enabled: false
21
+
22
+ # Don't warn about single-line if bodies. It's better for us to be consistent
23
+ # with the times when we do need multi-line bodies
24
+ Style/IfUnlessModifier:
25
+ Enabled: false
data/Gemfile ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 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
+ source 'https://rubygems.org'
11
+
12
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
13
+
14
+ # Specify your gem's dependencies in comet_backup_ruby_sdk.gemspec
15
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2020 Comet Licensing Ltd.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,81 @@
1
+ # Ruby SDK for the Comet Server API
2
+
3
+ [![@CometBackup on Twitter](https://img.shields.io/badge/twitter-%40CometBackup-blue.svg?style=flat)](https://twitter.com/CometBackup)
4
+ ![MIT License](https://img.shields.io/packagist/l/cometbackup/comet-php-sdk.svg)
5
+
6
+ The Comet Server API allows you to create and manage customer accounts on your Comet Server.
7
+
8
+ Comet Licensing Ltd makes this library freely available under the [MIT license](https://spdx.org/licenses/MIT.html); you may embed it in any Ruby project, either free or commercial, as long as the copyright header comment remains intact in the `*.rb` files.
9
+
10
+ ## Features
11
+
12
+ - Full coverage of Comet Server API methods, data structures, and constant definitions
13
+
14
+ ## Version compatibility
15
+
16
+ This library uses [Semantic Versioning](https://semver.org/). However, large parts of this library are autogenerated from internal protocol descriptions from a specific version of Comet Server; to find the source Comet Server version, check the `Comet::APPLICATION_VERSION` constant.
17
+
18
+ Newer API libraries can be safely used with older versions of Comet Server, however some features may be unavailable, and any new API properties will be unrecognized and ignored by the Comet Server.
19
+
20
+ Older API libraries can be safely used with newer versions of Comet Server. Unknown API properties corresponding to new Comet Server features will be preserved via the `@unknown_json_fields` system.
21
+
22
+ ## Getting Started
23
+
24
+ This package is provided as a Gem hosted on [rubygems.org](https://rubygems.org/).
25
+
26
+ Install using [Bundler](https://bundler.io/):
27
+
28
+ ```bash
29
+ echo "gem 'comet_backup_ruby_sdk'" >> Gemfile
30
+ bundle
31
+ ```
32
+
33
+ Or install using [Gem](https://rubygems.org/):
34
+
35
+ $ gem install comet_backup_ruby_sdk
36
+
37
+ To compile the gem from source:
38
+
39
+ ```bash
40
+ git clone https://github.com/CometBackup/comet-ruby-sdk.git
41
+ cd comet-ruby-sdk
42
+ gem build comet_backup_ruby_sdk.gemspec
43
+ ```
44
+
45
+ ## Usage
46
+
47
+ Connect to the Comet Server and iterate through user profiles:
48
+
49
+ ```ruby
50
+ require 'comet_backup_ruby_sdk'
51
+
52
+ client = Comet::CometServer.new("http://127.0.0.1:8060", "admin", "admin")
53
+
54
+ client.admin_list_users_full.each do |username, profile|
55
+ puts "#{username} has #{profile.destinations.length} Storage Vault(s)"
56
+ end
57
+ ```
58
+
59
+ The Comet Server API always returns an HTTP 200 status code, and puts application-level errors in the response message body using the `Comet::CometAPIResponseMessage` structure. This helps to distinguish between network-level errors and proxy-level errors. This SDK converts application-level errors to raise exceptions:
60
+
61
+ ```ruby
62
+ begin
63
+ client.admin_get_user_profile('non_existent_user')
64
+
65
+ rescue Comet::APIResponseError => err
66
+ if err.detail.status >= 400 && err.detail.status < 500
67
+ puts "Comet Server returned caller-side error (4xx) - permanent, do not retry"
68
+ else
69
+ puts "Comet Server returned server-side error (5xx) - may want to retry"
70
+ end
71
+
72
+ rescue StandardError
73
+ puts "Failed to reach the Comet Server (non-200 HTTP status code) - may want to retry"
74
+ end
75
+ ```
76
+
77
+ ## Getting Help
78
+
79
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/CometBackup/comet-ruby-sdk](https://github.com/CometBackup/comet-ruby-sdk).
80
+
81
+ You may also submit issues via the ticket system at [cometbackup.com](https://cometbackup.com/).
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 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 'rake/testtask'
11
+ require 'rubocop/rake_task'
12
+
13
+ # Rubocop task
14
+ RuboCop::RakeTask.new
15
+
16
+ # Minitest
17
+ Rake::TestTask.new do |t|
18
+ t.libs << 'test'
19
+ end
20
+
21
+ desc 'Run tests'
22
+ task default: :test
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby --enable-frozen-string-literal
2
+ #
3
+ # Copyright (c) 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
+ lib = File.expand_path('lib', __dir__)
11
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
12
+
13
+ Gem::Specification.new do |spec|
14
+ spec.name = 'comet_backup_ruby_sdk'
15
+ spec.version = '0.2.0'
16
+ spec.authors = ['Comet Licensing Ltd.']
17
+ spec.email = ['hello@cometbackup.com']
18
+
19
+ spec.summary = 'Comet Backup - Comet Server API SDK'
20
+ spec.description = 'The Comet Server can be controlled via an API over HTTP / HTTPS.'
21
+ spec.homepage = 'https://github.com/CometBackup/comet-ruby-sdk'
22
+ spec.license = 'MIT'
23
+
24
+ # Specify which files should be added to the gem when it is released.
25
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
26
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
27
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
28
+ end
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_development_dependency 'bundler', '~> 1.17'
32
+ spec.add_development_dependency 'minitest', '~> 5.14'
33
+ spec.add_development_dependency 'rake', '~> 13.0'
34
+ spec.add_development_dependency 'rubocop', '~> 0.88'
35
+ end
@@ -0,0 +1,27 @@
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
+ module Comet
11
+
12
+ # APIResponseError is a custom exception class that wraps the Comet::CometAPIResponseMessage
13
+ # type. These represent application-level error responses from the Comet Server API.
14
+ # Network-level error responses should be caught using the Net::HTTP error types.
15
+ class APIResponseError < StandardError
16
+
17
+ # @type [Comet::CometAPIResponseMessage] The application-level error
18
+ attr_reader :detail
19
+
20
+ def initialize(carm)
21
+ @detail = carm
22
+
23
+ super("#{carm.message} (#{carm.status})")
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,2926 @@
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 'net/http'
11
+ require 'json'
12
+
13
+ module Comet
14
+
15
+ # The CometServer class enables making network requests to the Comet Server API.
16
+ class CometServer
17
+
18
+ # @type [String] The Comet Server URL
19
+ attr_accessor :server_address
20
+
21
+ # @type [String] Username to log in to the Comet Server API
22
+ attr_accessor :username
23
+
24
+ # @type [String] Password to log in to the Comet Server API
25
+ attr_accessor :password
26
+
27
+ # Initialize a new CometServer class instance.
28
+ def initialize(server_address, username, password)
29
+ raise TypeError 'expected string' unless server_address.is_a? String
30
+ raise TypeError 'expected string' unless username.is_a? String
31
+ raise TypeError 'expected string' unless password.is_a? String
32
+
33
+ @server_address = server_address
34
+ @username = username
35
+ @password = password
36
+ end
37
+
38
+ # AdminAccountProperties
39
+ #
40
+ # Retrieve properties about the current admin account.
41
+ # Some key parameters are obscured, but the obscured values are safely recognised by the corresponding AdminAccountSetProperties API.
42
+ #
43
+ # You must supply administrator authentication credentials to use this API.
44
+ #
45
+ # @return [Comet::AdminAccountPropertiesResponse]
46
+ def admin_account_properties
47
+ body = perform_request('/api/v1/admin/account/properties')
48
+ json_body = JSON.parse body
49
+ check_status json_body
50
+ ret = Comet::AdminAccountPropertiesResponse.new
51
+ ret.from_hash(json_body)
52
+ ret
53
+ end
54
+
55
+ # AdminAccountRegenerateTotp
56
+ #
57
+ # Generate a new TOTP secret.
58
+ # The secret is returned as a `data-uri` image of a QR code. The new secret is immediately applied to the current admin account.
59
+ #
60
+ # You must supply administrator authentication credentials to use this API.
61
+ #
62
+ # @return [Comet::TotpRegeneratedResponse]
63
+ def admin_account_regenerate_totp
64
+ body = perform_request('/api/v1/admin/account/regenerate-totp')
65
+ json_body = JSON.parse body
66
+ check_status json_body
67
+ ret = Comet::TotpRegeneratedResponse.new
68
+ ret.from_hash(json_body)
69
+ ret
70
+ end
71
+
72
+ # AdminAccountSessionRevoke
73
+ #
74
+ # Revoke a session key (log out).
75
+ #
76
+ # You must supply administrator authentication credentials to use this API.
77
+ #
78
+ # @return [Comet::CometAPIResponseMessage]
79
+ def admin_account_session_revoke
80
+ body = perform_request('/api/v1/admin/account/session-revoke')
81
+ json_body = JSON.parse body
82
+ check_status json_body
83
+ ret = Comet::CometAPIResponseMessage.new
84
+ ret.from_hash(json_body)
85
+ ret
86
+ end
87
+
88
+ # AdminAccountSessionStart
89
+ #
90
+ # Generate a session key (log in).
91
+ #
92
+ # You must supply administrator authentication credentials to use this API.
93
+ #
94
+ # @param [String] self_address (Optional) External URL of this server (used for U2F AppID)
95
+ # @return [Comet::SessionKeyRegeneratedResponse]
96
+ def admin_account_session_start(self_address = nil)
97
+ submit_params = {}
98
+ if self_address.nil?
99
+ submit_params['SelfAddress'] = @server_address
100
+ else
101
+ raise TypeError 'expected string' unless self_address.is_a? String
102
+
103
+ submit_params['SelfAddress'] = self_address
104
+ end
105
+
106
+ body = perform_request('/api/v1/admin/account/session-start', submit_params)
107
+ json_body = JSON.parse body
108
+ check_status json_body
109
+ ret = Comet::SessionKeyRegeneratedResponse.new
110
+ ret.from_hash(json_body)
111
+ ret
112
+ end
113
+
114
+ # AdminAccountSessionStartAsUser
115
+ #
116
+ # Generate a session key for an end-user (log in as end-user).
117
+ #
118
+ # You must supply administrator authentication credentials to use this API.
119
+ #
120
+ # @param [String] target_user Target account username
121
+ # @return [Comet::SessionKeyRegeneratedResponse]
122
+ def admin_account_session_start_as_user(target_user)
123
+ submit_params = {}
124
+ raise TypeError 'expected string' unless target_user.is_a? String
125
+
126
+ submit_params['TargetUser'] = target_user
127
+
128
+ body = perform_request('/api/v1/admin/account/session-start-as-user', submit_params)
129
+ json_body = JSON.parse body
130
+ check_status json_body
131
+ ret = Comet::SessionKeyRegeneratedResponse.new
132
+ ret.from_hash(json_body)
133
+ ret
134
+ end
135
+
136
+ # AdminAccountSetProperties
137
+ #
138
+ # Update settings for your own admin account.
139
+ # Updating your account password requires you to supply your current password.
140
+ # To set a new plaintext password, use a password format of 0 (PASSWORD_FORMAT_PLAINTEXT).
141
+ # This API does not currently allow you to modify your TOTP secret or IP whitelist.
142
+ #
143
+ # You must supply administrator authentication credentials to use this API.
144
+ #
145
+ # @param [Comet::AdminSecurityOptions] security Updated account properties
146
+ # @return [Comet::CometAPIResponseMessage]
147
+ def admin_account_set_properties(security)
148
+ submit_params = {}
149
+ raise TypeError 'expected Comet::AdminSecurityOptions' unless security.is_a? Comet::AdminSecurityOptions
150
+
151
+ submit_params['Security'] = security.to_json
152
+
153
+ body = perform_request('/api/v1/admin/account/set-properties', submit_params)
154
+ json_body = JSON.parse body
155
+ check_status json_body
156
+ ret = Comet::CometAPIResponseMessage.new
157
+ ret.from_hash(json_body)
158
+ ret
159
+ end
160
+
161
+ # AdminAccountU2fRequestRegistrationChallenge
162
+ #
163
+ # Register a new FIDO U2F token.
164
+ #
165
+ # You must supply administrator authentication credentials to use this API.
166
+ #
167
+ # @param [String] self_address External URL of this server, used as U2F AppID and Facet
168
+ # @return [Comet::U2FRegistrationChallengeResponse]
169
+ def admin_account_u2f_request_registration_challenge(self_address)
170
+ submit_params = {}
171
+ raise TypeError 'expected string' unless self_address.is_a? String
172
+
173
+ submit_params['SelfAddress'] = self_address
174
+
175
+ body = perform_request('/api/v1/admin/account/u2f/request-registration-challenge', submit_params)
176
+ json_body = JSON.parse body
177
+ check_status json_body
178
+ ret = Comet::U2FRegistrationChallengeResponse.new
179
+ ret.from_hash(json_body)
180
+ ret
181
+ end
182
+
183
+ # AdminAccountU2fSubmitChallengeResponse
184
+ #
185
+ # Register a new FIDO U2F token.
186
+ #
187
+ # You must supply administrator authentication credentials to use this API.
188
+ #
189
+ # @param [String] u2fchallenge_id Associated value from AdminAccountU2fRequestRegistrationChallenge API
190
+ # @param [String] u2fclient_data U2F response data supplied by hardware token
191
+ # @param [String] u2fregistration_data U2F response data supplied by hardware token
192
+ # @param [String] u2fversion U2F response data supplied by hardware token
193
+ # @param [String] description Optional description of the token
194
+ # @return [Comet::CometAPIResponseMessage]
195
+ def admin_account_u2f_submit_challenge_response(u2fchallenge_id, u2fclient_data, u2fregistration_data, u2fversion, description)
196
+ submit_params = {}
197
+ raise TypeError 'expected string' unless u2fchallenge_id.is_a? String
198
+
199
+ submit_params['U2FChallengeID'] = u2fchallenge_id
200
+ raise TypeError 'expected string' unless u2fclient_data.is_a? String
201
+
202
+ submit_params['U2FClientData'] = u2fclient_data
203
+ raise TypeError 'expected string' unless u2fregistration_data.is_a? String
204
+
205
+ submit_params['U2FRegistrationData'] = u2fregistration_data
206
+ raise TypeError 'expected string' unless u2fversion.is_a? String
207
+
208
+ submit_params['U2FVersion'] = u2fversion
209
+ raise TypeError 'expected string' unless description.is_a? String
210
+
211
+ submit_params['Description'] = description
212
+
213
+ body = perform_request('/api/v1/admin/account/u2f/submit-challenge-response', submit_params)
214
+ json_body = JSON.parse body
215
+ check_status json_body
216
+ ret = Comet::CometAPIResponseMessage.new
217
+ ret.from_hash(json_body)
218
+ ret
219
+ end
220
+
221
+ # AdminAccountValidateTotp
222
+ #
223
+ # Validate the TOTP code before turning 2fa(TOTP) on.
224
+ #
225
+ # You must supply administrator authentication credentials to use this API.
226
+ #
227
+ # @param [String] totpcode Six-digit code after scanning barcode image
228
+ # @return [Comet::CometAPIResponseMessage]
229
+ def admin_account_validate_totp(totpcode)
230
+ submit_params = {}
231
+ raise TypeError 'expected string' unless totpcode.is_a? String
232
+
233
+ submit_params['TOTPCode'] = totpcode
234
+
235
+ body = perform_request('/api/v1/admin/account/validate-totp', submit_params)
236
+ json_body = JSON.parse body
237
+ check_status json_body
238
+ ret = Comet::CometAPIResponseMessage.new
239
+ ret.from_hash(json_body)
240
+ ret
241
+ end
242
+
243
+ # AdminAddUser
244
+ #
245
+ # Add a new user account.
246
+ #
247
+ # You must supply administrator authentication credentials to use this API.
248
+ # This API requires the Auth Role to be enabled.
249
+ #
250
+ # @param [String] target_user New account username
251
+ # @param [String] target_password New account password
252
+ # @param [Number] store_recovery_code (Optional) If set to 1, store and keep a password recovery code for the generated user (>= 18.3.9)
253
+ # @param [Number] require_password_change (Optional) If set to 1, require to reset password at the first login for the generated user (>= 20.3.4)
254
+ # @return [Comet::CometAPIResponseMessage]
255
+ def admin_add_user(target_user, target_password, store_recovery_code = nil, require_password_change = nil)
256
+ submit_params = {}
257
+ raise TypeError 'expected string' unless target_user.is_a? String
258
+
259
+ submit_params['TargetUser'] = target_user
260
+ raise TypeError 'expected string' unless target_password.is_a? String
261
+
262
+ submit_params['TargetPassword'] = target_password
263
+ unless store_recovery_code.nil?
264
+ submit_params['StoreRecoveryCode'] = store_recovery_code
265
+ end
266
+ unless require_password_change.nil?
267
+ submit_params['RequirePasswordChange'] = require_password_change
268
+ end
269
+
270
+ body = perform_request('/api/v1/admin/add-user', submit_params)
271
+ json_body = JSON.parse body
272
+ check_status json_body
273
+ ret = Comet::CometAPIResponseMessage.new
274
+ ret.from_hash(json_body)
275
+ ret
276
+ end
277
+
278
+ # AdminAddUserFromProfile
279
+ #
280
+ # Add a new user account (with all information).
281
+ # This allows you to create a new account and set all its properties at once (e.g. during account replication). Developers creating a signup form may find it simpler to use the AdminAddUser and AdminGetUserProfile / AdminSetUserProfile APIs separately.
282
+ #
283
+ # You must supply administrator authentication credentials to use this API.
284
+ # This API requires the Auth Role to be enabled.
285
+ #
286
+ # @param [String] target_user New account username
287
+ # @param [Comet::UserProfileConfig] profile_data New account profile
288
+ # @return [Comet::CometAPIResponseMessage]
289
+ def admin_add_user_from_profile(target_user, profile_data)
290
+ submit_params = {}
291
+ raise TypeError 'expected string' unless target_user.is_a? String
292
+
293
+ submit_params['TargetUser'] = target_user
294
+ raise TypeError 'expected Comet::UserProfileConfig' unless profile_data.is_a? Comet::UserProfileConfig
295
+
296
+ submit_params['ProfileData'] = profile_data.to_json
297
+
298
+ body = perform_request('/api/v1/admin/add-user-from-profile', submit_params)
299
+ json_body = JSON.parse body
300
+ check_status json_body
301
+ ret = Comet::CometAPIResponseMessage.new
302
+ ret.from_hash(json_body)
303
+ ret
304
+ end
305
+
306
+ # AdminBrandingAvailablePlatforms
307
+ #
308
+ # List available software download platforms.
309
+ #
310
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
311
+ # This API requires the Software Build Role to be enabled.
312
+ # This API requires the Auth Role to be enabled.
313
+ #
314
+ # @return [Hash{Number => Comet::AvailableDownload}]
315
+ def admin_branding_available_platforms
316
+ body = perform_request('/api/v1/admin/branding/available-platforms')
317
+ json_body = JSON.parse body
318
+ check_status json_body
319
+ ret = {}
320
+ if json_body.nil?
321
+ ret = {}
322
+ else
323
+ json_body.each do |k, v|
324
+ ret[k] = Comet::AvailableDownload.new
325
+ ret[k].from_hash(v)
326
+ end
327
+ end
328
+ ret
329
+ end
330
+
331
+ # AdminBrandingGenerateClientByPlatform
332
+ #
333
+ # Download software.
334
+ #
335
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
336
+ # This API requires the Software Build Role to be enabled.
337
+ # This API requires the Auth Role to be enabled.
338
+ #
339
+ # @param [Number] platform The selected download platform, from the AdminBrandingAvailablePlatforms API
340
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
341
+ # @return [String]
342
+ def admin_branding_generate_client_by_platform(platform, self_address = nil)
343
+ submit_params = {}
344
+ submit_params['Platform'] = platform
345
+ if self_address.nil?
346
+ submit_params['SelfAddress'] = @server_address
347
+ else
348
+ raise TypeError 'expected string' unless self_address.is_a? String
349
+
350
+ submit_params['SelfAddress'] = self_address
351
+ end
352
+
353
+ perform_request('/api/v1/admin/branding/generate-client/by-platform', submit_params)
354
+ end
355
+
356
+ # AdminBrandingGenerateClientLinuxgeneric
357
+ #
358
+ # Download software (Linux Server .run).
359
+ #
360
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
361
+ # This API requires the Software Build Role to be enabled.
362
+ # This API requires the Auth Role to be enabled.
363
+ #
364
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
365
+ # @return [String]
366
+ def admin_branding_generate_client_linuxgeneric(self_address = nil)
367
+ submit_params = {}
368
+ if self_address.nil?
369
+ submit_params['SelfAddress'] = @server_address
370
+ else
371
+ raise TypeError 'expected string' unless self_address.is_a? String
372
+
373
+ submit_params['SelfAddress'] = self_address
374
+ end
375
+
376
+ perform_request('/api/v1/admin/branding/generate-client/linuxgeneric', submit_params)
377
+ end
378
+
379
+ # AdminBrandingGenerateClientMacosX8664
380
+ #
381
+ # Download software (macOS x86_64 pkg).
382
+ #
383
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
384
+ # This API requires the Software Build Role to be enabled.
385
+ # This API requires the Auth Role to be enabled.
386
+ #
387
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
388
+ # @return [String]
389
+ def admin_branding_generate_client_macos_x8664(self_address = nil)
390
+ submit_params = {}
391
+ if self_address.nil?
392
+ submit_params['SelfAddress'] = @server_address
393
+ else
394
+ raise TypeError 'expected string' unless self_address.is_a? String
395
+
396
+ submit_params['SelfAddress'] = self_address
397
+ end
398
+
399
+ perform_request('/api/v1/admin/branding/generate-client/macos-x86_64', submit_params)
400
+ end
401
+
402
+ # AdminBrandingGenerateClientTest
403
+ #
404
+ # Check if a software download is available.
405
+ #
406
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
407
+ # This API requires the Software Build Role to be enabled.
408
+ # This API requires the Auth Role to be enabled.
409
+ #
410
+ # @param [Number] platform The selected download platform, from the AdminBrandingAvailablePlatforms API
411
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
412
+ # @return [Comet::CometAPIResponseMessage]
413
+ def admin_branding_generate_client_test(platform, self_address = nil)
414
+ submit_params = {}
415
+ submit_params['Platform'] = platform
416
+ if self_address.nil?
417
+ submit_params['SelfAddress'] = @server_address
418
+ else
419
+ raise TypeError 'expected string' unless self_address.is_a? String
420
+
421
+ submit_params['SelfAddress'] = self_address
422
+ end
423
+
424
+ body = perform_request('/api/v1/admin/branding/generate-client/test', submit_params)
425
+ json_body = JSON.parse body
426
+ check_status json_body
427
+ ret = Comet::CometAPIResponseMessage.new
428
+ ret.from_hash(json_body)
429
+ ret
430
+ end
431
+
432
+ # AdminBrandingGenerateClientWindowsAnycpuExe
433
+ #
434
+ # Download software update (Windows AnyCPU exe).
435
+ # The exe endpoints are not recommended for end-users, as they may not be able to provide a codesigned installer if no custom codesigning certificate is present.
436
+ #
437
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
438
+ # This API requires the Software Build Role to be enabled.
439
+ # This API requires the Auth Role to be enabled.
440
+ #
441
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
442
+ # @return [String]
443
+ def admin_branding_generate_client_windows_anycpu_exe(self_address = nil)
444
+ submit_params = {}
445
+ if self_address.nil?
446
+ submit_params['SelfAddress'] = @server_address
447
+ else
448
+ raise TypeError 'expected string' unless self_address.is_a? String
449
+
450
+ submit_params['SelfAddress'] = self_address
451
+ end
452
+
453
+ perform_request('/api/v1/admin/branding/generate-client/windows-anycpu-exe', submit_params)
454
+ end
455
+
456
+ # AdminBrandingGenerateClientWindowsAnycpuZip
457
+ #
458
+ # Download software (Windows AnyCPU zip).
459
+ # The zip endpoints are recommended for end-users, as they may be able to provide a codesigned installer even when no custom codesigning certificate is present.
460
+ #
461
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
462
+ # This API requires the Software Build Role to be enabled.
463
+ # This API requires the Auth Role to be enabled.
464
+ #
465
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
466
+ # @return [String]
467
+ def admin_branding_generate_client_windows_anycpu_zip(self_address = nil)
468
+ submit_params = {}
469
+ if self_address.nil?
470
+ submit_params['SelfAddress'] = @server_address
471
+ else
472
+ raise TypeError 'expected string' unless self_address.is_a? String
473
+
474
+ submit_params['SelfAddress'] = self_address
475
+ end
476
+
477
+ perform_request('/api/v1/admin/branding/generate-client/windows-anycpu-zip', submit_params)
478
+ end
479
+
480
+ # AdminBrandingGenerateClientWindowsX8632Exe
481
+ #
482
+ # Download software update (Windows x86_32 exe).
483
+ # The exe endpoints are not recommended for end-users, as they may not be able to provide a codesigned installer if no custom codesigning certificate is present.
484
+ #
485
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
486
+ # This API requires the Software Build Role to be enabled.
487
+ # This API requires the Auth Role to be enabled.
488
+ #
489
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
490
+ # @return [String]
491
+ def admin_branding_generate_client_windows_x8632exe(self_address = nil)
492
+ submit_params = {}
493
+ if self_address.nil?
494
+ submit_params['SelfAddress'] = @server_address
495
+ else
496
+ raise TypeError 'expected string' unless self_address.is_a? String
497
+
498
+ submit_params['SelfAddress'] = self_address
499
+ end
500
+
501
+ perform_request('/api/v1/admin/branding/generate-client/windows-x86_32-exe', submit_params)
502
+ end
503
+
504
+ # AdminBrandingGenerateClientWindowsX8632Zip
505
+ #
506
+ # Download software (Windows x86_32 zip).
507
+ # The zip endpoints are recommended for end-users, as they may be able to provide a codesigned installer even when no custom codesigning certificate is present.
508
+ #
509
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
510
+ # This API requires the Software Build Role to be enabled.
511
+ # This API requires the Auth Role to be enabled.
512
+ #
513
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
514
+ # @return [String]
515
+ def admin_branding_generate_client_windows_x8632zip(self_address = nil)
516
+ submit_params = {}
517
+ if self_address.nil?
518
+ submit_params['SelfAddress'] = @server_address
519
+ else
520
+ raise TypeError 'expected string' unless self_address.is_a? String
521
+
522
+ submit_params['SelfAddress'] = self_address
523
+ end
524
+
525
+ perform_request('/api/v1/admin/branding/generate-client/windows-x86_32-zip', submit_params)
526
+ end
527
+
528
+ # AdminBrandingGenerateClientWindowsX8664Exe
529
+ #
530
+ # Download software update (Windows x86_64 exe).
531
+ # The exe endpoints are not recommended for end-users, as they may not be able to provide a codesigned installer if no custom codesigning certificate is present.
532
+ #
533
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
534
+ # This API requires the Software Build Role to be enabled.
535
+ # This API requires the Auth Role to be enabled.
536
+ #
537
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
538
+ # @return [String]
539
+ def admin_branding_generate_client_windows_x8664exe(self_address = nil)
540
+ submit_params = {}
541
+ if self_address.nil?
542
+ submit_params['SelfAddress'] = @server_address
543
+ else
544
+ raise TypeError 'expected string' unless self_address.is_a? String
545
+
546
+ submit_params['SelfAddress'] = self_address
547
+ end
548
+
549
+ perform_request('/api/v1/admin/branding/generate-client/windows-x86_64-exe', submit_params)
550
+ end
551
+
552
+ # AdminBrandingGenerateClientWindowsX8664Zip
553
+ #
554
+ # Download software (Windows x86_64 zip).
555
+ # The zip endpoints are recommended for end-users, as they may be able to provide a codesigned installer even when no custom codesigning certificate is present.
556
+ #
557
+ # This API requires administrator authentication credentials, unless the server is configured to allow unauthenticated software downloads.
558
+ # This API requires the Software Build Role to be enabled.
559
+ # This API requires the Auth Role to be enabled.
560
+ #
561
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts
562
+ # @return [String]
563
+ def admin_branding_generate_client_windows_x8664zip(self_address = nil)
564
+ submit_params = {}
565
+ if self_address.nil?
566
+ submit_params['SelfAddress'] = @server_address
567
+ else
568
+ raise TypeError 'expected string' unless self_address.is_a? String
569
+
570
+ submit_params['SelfAddress'] = self_address
571
+ end
572
+
573
+ perform_request('/api/v1/admin/branding/generate-client/windows-x86_64-zip', submit_params)
574
+ end
575
+
576
+ # AdminBulletinSubmit
577
+ #
578
+ # Send an email bulletin to all users.
579
+ #
580
+ # You must supply administrator authentication credentials to use this API.
581
+ # This API requires the Auth Role to be enabled.
582
+ #
583
+ # @param [String] subject Bulletin subject line
584
+ # @param [String] content Bulletin message content
585
+ # @return [Comet::CometAPIResponseMessage]
586
+ def admin_bulletin_submit(subject, content)
587
+ submit_params = {}
588
+ raise TypeError 'expected string' unless subject.is_a? String
589
+
590
+ submit_params['Subject'] = subject
591
+ raise TypeError 'expected string' unless content.is_a? String
592
+
593
+ submit_params['Content'] = content
594
+
595
+ body = perform_request('/api/v1/admin/bulletin/submit', submit_params)
596
+ json_body = JSON.parse body
597
+ check_status json_body
598
+ ret = Comet::CometAPIResponseMessage.new
599
+ ret.from_hash(json_body)
600
+ ret
601
+ end
602
+
603
+ # AdminConstellationLastReport
604
+ #
605
+ # Get Constellation bucket usage report (cached).
606
+ #
607
+ # You must supply administrator authentication credentials to use this API.
608
+ # This API requires the Constellation Role to be enabled.
609
+ #
610
+ # @return [Comet::ConstellationCheckReport]
611
+ def admin_constellation_last_report
612
+ body = perform_request('/api/v1/admin/constellation/last-report')
613
+ json_body = JSON.parse body
614
+ check_status json_body
615
+ ret = Comet::ConstellationCheckReport.new
616
+ ret.from_hash(json_body)
617
+ ret
618
+ end
619
+
620
+ # AdminConstellationNewReport
621
+ #
622
+ # Get Constellation bucket usage report (regenerate).
623
+ #
624
+ # You must supply administrator authentication credentials to use this API.
625
+ # This API requires the Constellation Role to be enabled.
626
+ #
627
+ # @return [Comet::ConstellationCheckReport]
628
+ def admin_constellation_new_report
629
+ body = perform_request('/api/v1/admin/constellation/new-report')
630
+ json_body = JSON.parse body
631
+ check_status json_body
632
+ ret = Comet::ConstellationCheckReport.new
633
+ ret.from_hash(json_body)
634
+ ret
635
+ end
636
+
637
+ # AdminConstellationPruneNow
638
+ #
639
+ # Prune unused buckets.
640
+ #
641
+ # You must supply administrator authentication credentials to use this API.
642
+ # This API requires the Constellation Role to be enabled.
643
+ #
644
+ # @return [Comet::CometAPIResponseMessage]
645
+ def admin_constellation_prune_now
646
+ body = perform_request('/api/v1/admin/constellation/prune-now')
647
+ json_body = JSON.parse body
648
+ check_status json_body
649
+ ret = Comet::CometAPIResponseMessage.new
650
+ ret.from_hash(json_body)
651
+ ret
652
+ end
653
+
654
+ # AdminConstellationStatus
655
+ #
656
+ # Get Constellation status.
657
+ #
658
+ # You must supply administrator authentication credentials to use this API.
659
+ # This API requires the Constellation Role to be enabled.
660
+ #
661
+ # @return [Comet::ConstellationStatusAPIResponse]
662
+ def admin_constellation_status
663
+ body = perform_request('/api/v1/admin/constellation/status')
664
+ json_body = JSON.parse body
665
+ check_status json_body
666
+ ret = Comet::ConstellationStatusAPIResponse.new
667
+ ret.from_hash(json_body)
668
+ ret
669
+ end
670
+
671
+ # AdminDeleteUser
672
+ #
673
+ # Delete user account.
674
+ # This does not remove any storage buckets. Unused storage buckets will be cleaned up by the Constellation Role.
675
+ # Any stored data can not be decrypted without the user profile. Misuse can cause data loss!
676
+ # This also allows to uninstall software from active devices under the user account
677
+ #
678
+ # You must supply administrator authentication credentials to use this API.
679
+ # This API requires the Auth Role to be enabled.
680
+ #
681
+ # @param [String] target_user Selected account username
682
+ # @param [Comet::UninstallConfig] uninstall_config (Optional) Uninstall software configuration (>= 20.3.5)
683
+ # @return [Comet::CometAPIResponseMessage]
684
+ def admin_delete_user(target_user, uninstall_config = nil)
685
+ submit_params = {}
686
+ raise TypeError 'expected string' unless target_user.is_a? String
687
+
688
+ submit_params['TargetUser'] = target_user
689
+ unless uninstall_config.nil?
690
+ raise TypeError 'expected Comet::UninstallConfig' unless uninstall_config.is_a? Comet::UninstallConfig
691
+
692
+ submit_params['UninstallConfig'] = uninstall_config.to_json
693
+ end
694
+
695
+ body = perform_request('/api/v1/admin/delete-user', submit_params)
696
+ json_body = JSON.parse body
697
+ check_status json_body
698
+ ret = Comet::CometAPIResponseMessage.new
699
+ ret.from_hash(json_body)
700
+ ret
701
+ end
702
+
703
+ # AdminDisableUserTotp
704
+ #
705
+ # Disable user account 2FA(TOTP) authentication.
706
+ #
707
+ # You must supply administrator authentication credentials to use this API.
708
+ # This API requires the Auth Role to be enabled.
709
+ #
710
+ # @param [String] target_user Selected account username
711
+ # @return [Comet::CometAPIResponseMessage]
712
+ def admin_disable_user_totp(target_user)
713
+ submit_params = {}
714
+ raise TypeError 'expected string' unless target_user.is_a? String
715
+
716
+ submit_params['TargetUser'] = target_user
717
+
718
+ body = perform_request('/api/v1/admin/disable-user-totp', submit_params)
719
+ json_body = JSON.parse body
720
+ check_status json_body
721
+ ret = Comet::CometAPIResponseMessage.new
722
+ ret.from_hash(json_body)
723
+ ret
724
+ end
725
+
726
+ # AdminDispatcherApplyRetentionRules
727
+ #
728
+ # Instruct a live connected device to apply retention rules now.
729
+ # This command is understood by Comet Backup 17.6.9 and newer.
730
+ #
731
+ # You must supply administrator authentication credentials to use this API.
732
+ # This API requires the Auth Role to be enabled.
733
+ #
734
+ # @param [String] target_id The live connection GUID
735
+ # @param [String] destination The Storage Vault GUID
736
+ # @return [Comet::CometAPIResponseMessage]
737
+ def admin_dispatcher_apply_retention_rules(target_id, destination)
738
+ submit_params = {}
739
+ raise TypeError 'expected string' unless target_id.is_a? String
740
+
741
+ submit_params['TargetID'] = target_id
742
+ raise TypeError 'expected string' unless destination.is_a? String
743
+
744
+ submit_params['Destination'] = destination
745
+
746
+ body = perform_request('/api/v1/admin/dispatcher/apply-retention-rules', submit_params)
747
+ json_body = JSON.parse body
748
+ check_status json_body
749
+ ret = Comet::CometAPIResponseMessage.new
750
+ ret.from_hash(json_body)
751
+ ret
752
+ end
753
+
754
+ # AdminDispatcherDeepverifyStorageVault
755
+ #
756
+ # Instruct a live connected device to deeply verify Storage Vault content.
757
+ # This command is understood by Comet Backup 18.8.2 and newer.
758
+ #
759
+ # You must supply administrator authentication credentials to use this API.
760
+ # This API requires the Auth Role to be enabled.
761
+ #
762
+ # @param [String] target_id The live connection GUID
763
+ # @param [String] destination The Storage Vault GUID
764
+ # @return [Comet::CometAPIResponseMessage]
765
+ def admin_dispatcher_deepverify_storage_vault(target_id, destination)
766
+ submit_params = {}
767
+ raise TypeError 'expected string' unless target_id.is_a? String
768
+
769
+ submit_params['TargetID'] = target_id
770
+ raise TypeError 'expected string' unless destination.is_a? String
771
+
772
+ submit_params['Destination'] = destination
773
+
774
+ body = perform_request('/api/v1/admin/dispatcher/deepverify-storage-vault', submit_params)
775
+ json_body = JSON.parse body
776
+ check_status json_body
777
+ ret = Comet::CometAPIResponseMessage.new
778
+ ret.from_hash(json_body)
779
+ ret
780
+ end
781
+
782
+ # AdminDispatcherDeleteSnapshot
783
+ #
784
+ # Instruct a live connected device to delete a stored snapshot.
785
+ #
786
+ # You must supply administrator authentication credentials to use this API.
787
+ # This API requires the Auth Role to be enabled.
788
+ #
789
+ # @param [String] target_id The live connection GUID
790
+ # @param [String] destination_id The Storage Vault GUID
791
+ # @param [String] snapshot_id The backup job snapshot ID to delete
792
+ # @return [Comet::CometAPIResponseMessage]
793
+ def admin_dispatcher_delete_snapshot(target_id, destination_id, snapshot_id)
794
+ submit_params = {}
795
+ raise TypeError 'expected string' unless target_id.is_a? String
796
+
797
+ submit_params['TargetID'] = target_id
798
+ raise TypeError 'expected string' unless destination_id.is_a? String
799
+
800
+ submit_params['DestinationID'] = destination_id
801
+ raise TypeError 'expected string' unless snapshot_id.is_a? String
802
+
803
+ submit_params['SnapshotID'] = snapshot_id
804
+
805
+ body = perform_request('/api/v1/admin/dispatcher/delete-snapshot', submit_params)
806
+ json_body = JSON.parse body
807
+ check_status json_body
808
+ ret = Comet::CometAPIResponseMessage.new
809
+ ret.from_hash(json_body)
810
+ ret
811
+ end
812
+
813
+ # AdminDispatcherDropConnection
814
+ #
815
+ # Disconnect a live connected device.
816
+ # The device will almost certainly attempt to reconnect.
817
+ #
818
+ # You must supply administrator authentication credentials to use this API.
819
+ # This API requires the Auth Role to be enabled.
820
+ #
821
+ # @param [String] target_id The live connection GUID
822
+ # @return [Comet::CometAPIResponseMessage]
823
+ def admin_dispatcher_drop_connection(target_id)
824
+ submit_params = {}
825
+ raise TypeError 'expected string' unless target_id.is_a? String
826
+
827
+ submit_params['TargetID'] = target_id
828
+
829
+ body = perform_request('/api/v1/admin/dispatcher/drop-connection', submit_params)
830
+ json_body = JSON.parse body
831
+ check_status json_body
832
+ ret = Comet::CometAPIResponseMessage.new
833
+ ret.from_hash(json_body)
834
+ ret
835
+ end
836
+
837
+ # AdminDispatcherImportApply
838
+ #
839
+ # Instruct a live connected device to import settings from an installed product.
840
+ # This command is understood by Comet Backup 17.12.0 and newer.
841
+ #
842
+ # You must supply administrator authentication credentials to use this API.
843
+ # This API requires the Auth Role to be enabled.
844
+ #
845
+ # @param [String] target_id The live connection GUID
846
+ # @param [String] import_source_id The selected import source, as found by the AdminDispatcherRequestImportSources API
847
+ # @return [Comet::CometAPIResponseMessage]
848
+ def admin_dispatcher_import_apply(target_id, import_source_id)
849
+ submit_params = {}
850
+ raise TypeError 'expected string' unless target_id.is_a? String
851
+
852
+ submit_params['TargetID'] = target_id
853
+ raise TypeError 'expected string' unless import_source_id.is_a? String
854
+
855
+ submit_params['ImportSourceID'] = import_source_id
856
+
857
+ body = perform_request('/api/v1/admin/dispatcher/import-apply', submit_params)
858
+ json_body = JSON.parse body
859
+ check_status json_body
860
+ ret = Comet::CometAPIResponseMessage.new
861
+ ret.from_hash(json_body)
862
+ ret
863
+ end
864
+
865
+ # AdminDispatcherKillProcess
866
+ #
867
+ # Instruct a live connected device to disconnect.
868
+ # The device will terminate its live-connection process and will not reconnect.
869
+ #
870
+ # You must supply administrator authentication credentials to use this API.
871
+ # This API requires the Auth Role to be enabled.
872
+ #
873
+ # @param [String] target_id The live connection GUID
874
+ # @return [Comet::CometAPIResponseMessage]
875
+ def admin_dispatcher_kill_process(target_id)
876
+ submit_params = {}
877
+ raise TypeError 'expected string' unless target_id.is_a? String
878
+
879
+ submit_params['TargetID'] = target_id
880
+
881
+ body = perform_request('/api/v1/admin/dispatcher/kill-process', submit_params)
882
+ json_body = JSON.parse body
883
+ check_status json_body
884
+ ret = Comet::CometAPIResponseMessage.new
885
+ ret.from_hash(json_body)
886
+ ret
887
+ end
888
+
889
+ # AdminDispatcherListActive
890
+ #
891
+ # List live connected devices.
892
+ #
893
+ # You must supply administrator authentication credentials to use this API.
894
+ # This API requires the Auth Role to be enabled.
895
+ #
896
+ # @return [Hash{String => Comet::LiveUserConnection}]
897
+ def admin_dispatcher_list_active
898
+ body = perform_request('/api/v1/admin/dispatcher/list-active')
899
+ json_body = JSON.parse body
900
+ check_status json_body
901
+ ret = {}
902
+ if json_body.nil?
903
+ ret = {}
904
+ else
905
+ json_body.each do |k, v|
906
+ ret[k] = Comet::LiveUserConnection.new
907
+ ret[k].from_hash(v)
908
+ end
909
+ end
910
+ ret
911
+ end
912
+
913
+ # AdminDispatcherRefetchProfile
914
+ #
915
+ # Instruct a live connected device to refresh their profile.
916
+ # This command is understood by Comet Backup 17.12.0 and newer.
917
+ #
918
+ # You must supply administrator authentication credentials to use this API.
919
+ # This API requires the Auth Role to be enabled.
920
+ #
921
+ # @param [String] target_id The live connection GUID
922
+ # @return [Comet::CometAPIResponseMessage]
923
+ def admin_dispatcher_refetch_profile(target_id)
924
+ submit_params = {}
925
+ raise TypeError 'expected string' unless target_id.is_a? String
926
+
927
+ submit_params['TargetID'] = target_id
928
+
929
+ body = perform_request('/api/v1/admin/dispatcher/refetch-profile', submit_params)
930
+ json_body = JSON.parse body
931
+ check_status json_body
932
+ ret = Comet::CometAPIResponseMessage.new
933
+ ret.from_hash(json_body)
934
+ ret
935
+ end
936
+
937
+ # AdminDispatcherReindexStorageVault
938
+ #
939
+ # Instruct a live connected device to rebuild Storage Vault indexes now.
940
+ # This command is understood by Comet Backup 18.6.9 and newer.
941
+ #
942
+ # You must supply administrator authentication credentials to use this API.
943
+ # This API requires the Auth Role to be enabled.
944
+ #
945
+ # @param [String] target_id The live connection GUID
946
+ # @param [String] destination The Storage Vault GUID
947
+ # @return [Comet::CometAPIResponseMessage]
948
+ def admin_dispatcher_reindex_storage_vault(target_id, destination)
949
+ submit_params = {}
950
+ raise TypeError 'expected string' unless target_id.is_a? String
951
+
952
+ submit_params['TargetID'] = target_id
953
+ raise TypeError 'expected string' unless destination.is_a? String
954
+
955
+ submit_params['Destination'] = destination
956
+
957
+ body = perform_request('/api/v1/admin/dispatcher/reindex-storage-vault', submit_params)
958
+ json_body = JSON.parse body
959
+ check_status json_body
960
+ ret = Comet::CometAPIResponseMessage.new
961
+ ret.from_hash(json_body)
962
+ ret
963
+ end
964
+
965
+ # AdminDispatcherRequestBrowseDiskDrives
966
+ #
967
+ # Request a list of physical disk drive information from a live connected device.
968
+ #
969
+ # You must supply administrator authentication credentials to use this API.
970
+ # This API requires the Auth Role to be enabled.
971
+ #
972
+ # @param [String] target_id The live connection GUID
973
+ # @return [Comet::BrowseDiskDrivesResponse]
974
+ def admin_dispatcher_request_browse_disk_drives(target_id)
975
+ submit_params = {}
976
+ raise TypeError 'expected string' unless target_id.is_a? String
977
+
978
+ submit_params['TargetID'] = target_id
979
+
980
+ body = perform_request('/api/v1/admin/dispatcher/request-browse-disk-drives', submit_params)
981
+ json_body = JSON.parse body
982
+ check_status json_body
983
+ ret = Comet::BrowseDiskDrivesResponse.new
984
+ ret.from_hash(json_body)
985
+ ret
986
+ end
987
+
988
+ # AdminDispatcherRequestBrowseExchangeEdb
989
+ #
990
+ # Request a list of Exchange EDB databases from a live connected device.
991
+ #
992
+ # You must supply administrator authentication credentials to use this API.
993
+ # This API requires the Auth Role to be enabled.
994
+ #
995
+ # @param [String] target_id The live connection GUID
996
+ # @return [Comet::BrowseEDBResponse]
997
+ def admin_dispatcher_request_browse_exchange_edb(target_id)
998
+ submit_params = {}
999
+ raise TypeError 'expected string' unless target_id.is_a? String
1000
+
1001
+ submit_params['TargetID'] = target_id
1002
+
1003
+ body = perform_request('/api/v1/admin/dispatcher/request-browse-exchange-edb', submit_params)
1004
+ json_body = JSON.parse body
1005
+ check_status json_body
1006
+ ret = Comet::BrowseEDBResponse.new
1007
+ ret.from_hash(json_body)
1008
+ ret
1009
+ end
1010
+
1011
+ # AdminDispatcherRequestBrowseHyperv
1012
+ #
1013
+ # Request a list of Hyper-V virtual machines from a live connected device.
1014
+ #
1015
+ # You must supply administrator authentication credentials to use this API.
1016
+ # This API requires the Auth Role to be enabled.
1017
+ #
1018
+ # @param [String] target_id The live connection GUID
1019
+ # @return [Comet::BrowseHVResponse]
1020
+ def admin_dispatcher_request_browse_hyperv(target_id)
1021
+ submit_params = {}
1022
+ raise TypeError 'expected string' unless target_id.is_a? String
1023
+
1024
+ submit_params['TargetID'] = target_id
1025
+
1026
+ body = perform_request('/api/v1/admin/dispatcher/request-browse-hyperv', submit_params)
1027
+ json_body = JSON.parse body
1028
+ check_status json_body
1029
+ ret = Comet::BrowseHVResponse.new
1030
+ ret.from_hash(json_body)
1031
+ ret
1032
+ end
1033
+
1034
+ # AdminDispatcherRequestBrowseVssAaw
1035
+ #
1036
+ # Request a list of installed VSS Writers (Application-Aware Writers) from a live connected device.
1037
+ #
1038
+ # You must supply administrator authentication credentials to use this API.
1039
+ # This API requires the Auth Role to be enabled.
1040
+ #
1041
+ # @param [String] target_id The live connection GUID
1042
+ # @return [Comet::BrowseVSSResponse]
1043
+ def admin_dispatcher_request_browse_vss_aaw(target_id)
1044
+ submit_params = {}
1045
+ raise TypeError 'expected string' unless target_id.is_a? String
1046
+
1047
+ submit_params['TargetID'] = target_id
1048
+
1049
+ body = perform_request('/api/v1/admin/dispatcher/request-browse-vss-aaw', submit_params)
1050
+ json_body = JSON.parse body
1051
+ check_status json_body
1052
+ ret = Comet::BrowseVSSResponse.new
1053
+ ret.from_hash(json_body)
1054
+ ret
1055
+ end
1056
+
1057
+ # AdminDispatcherRequestFilesystemObjects
1058
+ #
1059
+ # Request a list of filesystem objects from a live connected device.
1060
+ # The device must have granted the administrator permission to view its filenames.
1061
+ #
1062
+ # You must supply administrator authentication credentials to use this API.
1063
+ # This API requires the Auth Role to be enabled.
1064
+ #
1065
+ # @param [String] target_id The live connection GUID
1066
+ # @param [String] path (Optional) Browse objects inside this path. If empty or not present, returns the top-level device paths
1067
+ # @return [Array<Comet::StoredObject>]
1068
+ def admin_dispatcher_request_filesystem_objects(target_id, path = nil)
1069
+ submit_params = {}
1070
+ raise TypeError 'expected string' unless target_id.is_a? String
1071
+
1072
+ submit_params['TargetID'] = target_id
1073
+ unless path.nil?
1074
+ raise TypeError 'expected string' unless path.is_a? String
1075
+
1076
+ submit_params['Path'] = path
1077
+ end
1078
+
1079
+ body = perform_request('/api/v1/admin/dispatcher/request-filesystem-objects', submit_params)
1080
+ json_body = JSON.parse body
1081
+ check_status json_body
1082
+ if json_body.nil?
1083
+ ret = []
1084
+ else
1085
+ ret = Array.new(json_body.length)
1086
+ json_body.each_with_index do |v, i|
1087
+ ret[i] = Comet::StoredObject.new
1088
+ ret[i].from_hash(v)
1089
+ end
1090
+ end
1091
+ ret
1092
+ end
1093
+
1094
+ # AdminDispatcherRequestImportSources
1095
+ #
1096
+ # Request a list of import sources from a live connected device.
1097
+ #
1098
+ # You must supply administrator authentication credentials to use this API.
1099
+ # This API requires the Auth Role to be enabled.
1100
+ #
1101
+ # @param [String] target_id The live connection GUID
1102
+ # @return [Comet::DispatcherAdminSourcesResponse]
1103
+ def admin_dispatcher_request_import_sources(target_id)
1104
+ submit_params = {}
1105
+ raise TypeError 'expected string' unless target_id.is_a? String
1106
+
1107
+ submit_params['TargetID'] = target_id
1108
+
1109
+ body = perform_request('/api/v1/admin/dispatcher/request-import-sources', submit_params)
1110
+ json_body = JSON.parse body
1111
+ check_status json_body
1112
+ ret = Comet::DispatcherAdminSourcesResponse.new
1113
+ ret.from_hash(json_body)
1114
+ ret
1115
+ end
1116
+
1117
+ # AdminDispatcherRequestStoredObjects
1118
+ #
1119
+ # Request a list of stored objects inside an existing backup job.
1120
+ # The remote device must have given consent for an MSP to browse their files.
1121
+ #
1122
+ # You must supply administrator authentication credentials to use this API.
1123
+ # This API requires the Auth Role to be enabled.
1124
+ #
1125
+ # @param [String] target_id The live connection GUID
1126
+ # @param [String] destination The Storage Vault ID
1127
+ # @param [String] snapshot_id The selected backup job snapshot
1128
+ # @param [String] tree_id (Optional) Browse objects inside subdirectory of backup snapshot
1129
+ # @return [Comet::DispatcherStoredObjectsResponse]
1130
+ def admin_dispatcher_request_stored_objects(target_id, destination, snapshot_id, tree_id = nil)
1131
+ submit_params = {}
1132
+ raise TypeError 'expected string' unless target_id.is_a? String
1133
+
1134
+ submit_params['TargetID'] = target_id
1135
+ raise TypeError 'expected string' unless destination.is_a? String
1136
+
1137
+ submit_params['Destination'] = destination
1138
+ raise TypeError 'expected string' unless snapshot_id.is_a? String
1139
+
1140
+ submit_params['SnapshotID'] = snapshot_id
1141
+ unless tree_id.nil?
1142
+ raise TypeError 'expected string' unless tree_id.is_a? String
1143
+
1144
+ submit_params['TreeID'] = tree_id
1145
+ end
1146
+
1147
+ body = perform_request('/api/v1/admin/dispatcher/request-stored-objects', submit_params)
1148
+ json_body = JSON.parse body
1149
+ check_status json_body
1150
+ ret = Comet::DispatcherStoredObjectsResponse.new
1151
+ ret.from_hash(json_body)
1152
+ ret
1153
+ end
1154
+
1155
+ # AdminDispatcherRequestVaultSnapshots
1156
+ #
1157
+ # Request a list of Storage Vault snapshots from a live connected device.
1158
+ #
1159
+ # You must supply administrator authentication credentials to use this API.
1160
+ # This API requires the Auth Role to be enabled.
1161
+ #
1162
+ # @param [String] target_id The live connection GUID
1163
+ # @param [String] destination The Storage Vault ID
1164
+ # @return [Comet::DispatcherVaultSnapshotsResponse]
1165
+ def admin_dispatcher_request_vault_snapshots(target_id, destination)
1166
+ submit_params = {}
1167
+ raise TypeError 'expected string' unless target_id.is_a? String
1168
+
1169
+ submit_params['TargetID'] = target_id
1170
+ raise TypeError 'expected string' unless destination.is_a? String
1171
+
1172
+ submit_params['Destination'] = destination
1173
+
1174
+ body = perform_request('/api/v1/admin/dispatcher/request-vault-snapshots', submit_params)
1175
+ json_body = JSON.parse body
1176
+ check_status json_body
1177
+ ret = Comet::DispatcherVaultSnapshotsResponse.new
1178
+ ret.from_hash(json_body)
1179
+ ret
1180
+ end
1181
+
1182
+ # AdminDispatcherRunBackup
1183
+ #
1184
+ # Instruct a live connected device to run a scheduled backup.
1185
+ #
1186
+ # You must supply administrator authentication credentials to use this API.
1187
+ # This API requires the Auth Role to be enabled.
1188
+ #
1189
+ # @param [String] target_id The live connection GUID
1190
+ # @param [String] backup_rule The schedule GUID
1191
+ # @return [Comet::CometAPIResponseMessage]
1192
+ def admin_dispatcher_run_backup(target_id, backup_rule)
1193
+ submit_params = {}
1194
+ raise TypeError 'expected string' unless target_id.is_a? String
1195
+
1196
+ submit_params['TargetID'] = target_id
1197
+ raise TypeError 'expected string' unless backup_rule.is_a? String
1198
+
1199
+ submit_params['BackupRule'] = backup_rule
1200
+
1201
+ body = perform_request('/api/v1/admin/dispatcher/run-backup', submit_params)
1202
+ json_body = JSON.parse body
1203
+ check_status json_body
1204
+ ret = Comet::CometAPIResponseMessage.new
1205
+ ret.from_hash(json_body)
1206
+ ret
1207
+ end
1208
+
1209
+ # AdminDispatcherRunBackupCustom
1210
+ #
1211
+ # Instruct a live connected device to run a backup.
1212
+ #
1213
+ # You must supply administrator authentication credentials to use this API.
1214
+ # This API requires the Auth Role to be enabled.
1215
+ #
1216
+ # @param [String] target_id The live connection GUID
1217
+ # @param [String] source The Protected Item GUID
1218
+ # @param [String] destination The Storage Vault GUID
1219
+ # @param [Comet::BackupJobAdvancedOptions] options (Optional) Extra job parameters (>= 19.3.6)
1220
+ # @return [Comet::CometAPIResponseMessage]
1221
+ def admin_dispatcher_run_backup_custom(target_id, source, destination, options = nil)
1222
+ submit_params = {}
1223
+ raise TypeError 'expected string' unless target_id.is_a? String
1224
+
1225
+ submit_params['TargetID'] = target_id
1226
+ raise TypeError 'expected string' unless source.is_a? String
1227
+
1228
+ submit_params['Source'] = source
1229
+ raise TypeError 'expected string' unless destination.is_a? String
1230
+
1231
+ submit_params['Destination'] = destination
1232
+ unless options.nil?
1233
+ raise TypeError 'expected Comet::BackupJobAdvancedOptions' unless options.is_a? Comet::BackupJobAdvancedOptions
1234
+
1235
+ submit_params['Options'] = options.to_json
1236
+ end
1237
+
1238
+ body = perform_request('/api/v1/admin/dispatcher/run-backup-custom', submit_params)
1239
+ json_body = JSON.parse body
1240
+ check_status json_body
1241
+ ret = Comet::CometAPIResponseMessage.new
1242
+ ret.from_hash(json_body)
1243
+ ret
1244
+ end
1245
+
1246
+ # AdminDispatcherRunRestore
1247
+ #
1248
+ # Instruct a live connected device to perform a local restore.
1249
+ # This command is understood by Comet Backup 17.9.3 and newer.
1250
+ #
1251
+ # You must supply administrator authentication credentials to use this API.
1252
+ # This API requires the Auth Role to be enabled.
1253
+ #
1254
+ # @param [String] target_id The live connection GUID
1255
+ # @param [String] path The local path to restore to
1256
+ # @param [String] source The Protected Item ID
1257
+ # @param [String] destination The Storage Vault ID
1258
+ # @param [String] snapshot (Optional) If present, restore a specific snapshot. Otherwise, restore the latest snapshot for the selected Protected Item + Storage Vault pair
1259
+ # @param [Array<String>] paths (Optional) If present, restore these paths only. Otherwise, restore all data (>= 19.3.0)
1260
+ # @return [Comet::CometAPIResponseMessage]
1261
+ def admin_dispatcher_run_restore(target_id, path, source, destination, snapshot = nil, paths = nil)
1262
+ submit_params = {}
1263
+ raise TypeError 'expected string' unless target_id.is_a? String
1264
+
1265
+ submit_params['TargetID'] = target_id
1266
+ raise TypeError 'expected string' unless path.is_a? String
1267
+
1268
+ submit_params['Path'] = path
1269
+ raise TypeError 'expected string' unless source.is_a? String
1270
+
1271
+ submit_params['Source'] = source
1272
+ raise TypeError 'expected string' unless destination.is_a? String
1273
+
1274
+ submit_params['Destination'] = destination
1275
+ unless snapshot.nil?
1276
+ raise TypeError 'expected string' unless snapshot.is_a? String
1277
+
1278
+ submit_params['Snapshot'] = snapshot
1279
+ end
1280
+ unless paths.nil?
1281
+ raise TypeError 'expected array' unless paths.is_a? Array
1282
+
1283
+ submit_params['Paths'] = paths.to_json
1284
+ end
1285
+
1286
+ body = perform_request('/api/v1/admin/dispatcher/run-restore', submit_params)
1287
+ json_body = JSON.parse body
1288
+ check_status json_body
1289
+ ret = Comet::CometAPIResponseMessage.new
1290
+ ret.from_hash(json_body)
1291
+ ret
1292
+ end
1293
+
1294
+ # AdminDispatcherRunRestoreCustom
1295
+ #
1296
+ # Instruct a live connected device to perform a local restore.
1297
+ # This command is understood by Comet Backup 18.6.0 and newer.
1298
+ #
1299
+ # You must supply administrator authentication credentials to use this API.
1300
+ # This API requires the Auth Role to be enabled.
1301
+ #
1302
+ # @param [String] target_id The live connection GUID
1303
+ # @param [String] source The Protected Item ID
1304
+ # @param [String] destination The Storage Vault ID
1305
+ # @param [Comet::RestoreJobAdvancedOptions] options Restore targets
1306
+ # @param [String] snapshot (Optional) If present, restore a specific snapshot. Otherwise, restore the latest snapshot for the selected Protected Item + Storage Vault pair
1307
+ # @param [Array<String>] paths (Optional) If present, restore these paths only. Otherwise, restore all data
1308
+ # @return [Comet::CometAPIResponseMessage]
1309
+ def admin_dispatcher_run_restore_custom(target_id, source, destination, options, snapshot = nil, paths = nil)
1310
+ submit_params = {}
1311
+ raise TypeError 'expected string' unless target_id.is_a? String
1312
+
1313
+ submit_params['TargetID'] = target_id
1314
+ raise TypeError 'expected string' unless source.is_a? String
1315
+
1316
+ submit_params['Source'] = source
1317
+ raise TypeError 'expected string' unless destination.is_a? String
1318
+
1319
+ submit_params['Destination'] = destination
1320
+ raise TypeError 'expected Comet::RestoreJobAdvancedOptions' unless options.is_a? Comet::RestoreJobAdvancedOptions
1321
+
1322
+ submit_params['Options'] = options.to_json
1323
+ unless snapshot.nil?
1324
+ raise TypeError 'expected string' unless snapshot.is_a? String
1325
+
1326
+ submit_params['Snapshot'] = snapshot
1327
+ end
1328
+ unless paths.nil?
1329
+ raise TypeError 'expected array' unless paths.is_a? Array
1330
+
1331
+ submit_params['Paths'] = paths.to_json
1332
+ end
1333
+
1334
+ body = perform_request('/api/v1/admin/dispatcher/run-restore-custom', submit_params)
1335
+ json_body = JSON.parse body
1336
+ check_status json_body
1337
+ ret = Comet::CometAPIResponseMessage.new
1338
+ ret.from_hash(json_body)
1339
+ ret
1340
+ end
1341
+
1342
+ # AdminDispatcherUninstallSoftware
1343
+ #
1344
+ # Instruct a live connected device to self-uninstall the software.
1345
+ #
1346
+ # You must supply administrator authentication credentials to use this API.
1347
+ # This API requires the Auth Role to be enabled.
1348
+ #
1349
+ # @param [String] target_id The live connection GUID
1350
+ # @param [Boolean] remove_config_file Determine if the config.dat file will be deleted at the same time
1351
+ # @return [Comet::CometAPIResponseMessage]
1352
+ def admin_dispatcher_uninstall_software(target_id, remove_config_file)
1353
+ submit_params = {}
1354
+ raise TypeError 'expected string' unless target_id.is_a? String
1355
+
1356
+ submit_params['TargetID'] = target_id
1357
+ submit_params['RemoveConfigFile'] = (remove_config_file ? 1 : 0)
1358
+
1359
+ body = perform_request('/api/v1/admin/dispatcher/uninstall-software', submit_params)
1360
+ json_body = JSON.parse body
1361
+ check_status json_body
1362
+ ret = Comet::CometAPIResponseMessage.new
1363
+ ret.from_hash(json_body)
1364
+ ret
1365
+ end
1366
+
1367
+ # AdminDispatcherUnlock
1368
+ #
1369
+ # Instruct a live connected device to remove lock files from a Storage Vault.
1370
+ # Misuse can cause data loss!
1371
+ # This command is understood by Comet Backup 17.9.4 and newer.
1372
+ #
1373
+ # You must supply administrator authentication credentials to use this API.
1374
+ # This API requires the Auth Role to be enabled.
1375
+ #
1376
+ # @param [String] target_id The live connection GUID
1377
+ # @param [String] destination The Storage Vault GUID
1378
+ # @return [Comet::CometAPIResponseMessage]
1379
+ def admin_dispatcher_unlock(target_id, destination)
1380
+ submit_params = {}
1381
+ raise TypeError 'expected string' unless target_id.is_a? String
1382
+
1383
+ submit_params['TargetID'] = target_id
1384
+ raise TypeError 'expected string' unless destination.is_a? String
1385
+
1386
+ submit_params['Destination'] = destination
1387
+
1388
+ body = perform_request('/api/v1/admin/dispatcher/unlock', submit_params)
1389
+ json_body = JSON.parse body
1390
+ check_status json_body
1391
+ ret = Comet::CometAPIResponseMessage.new
1392
+ ret.from_hash(json_body)
1393
+ ret
1394
+ end
1395
+
1396
+ # AdminDispatcherUpdateLoginUrl
1397
+ #
1398
+ # Instruct a live connected device to update its login server URL.
1399
+ # The device will attempt to connect to the new Auth Role Comet Server using its current username and password. If the test connection succeeds, the device migrates its saved connection settings and live connections to the new server. If the device is not registered on the new URL, or if the credentials are incorrect, the device remains on the current Auth Role server.
1400
+ #
1401
+ # You must supply administrator authentication credentials to use this API.
1402
+ # This API requires the Auth Role to be enabled.
1403
+ #
1404
+ # @param [String] target_id The live connection GUID
1405
+ # @param [String] new_url The new external URL of this server
1406
+ # @return [Comet::CometAPIResponseMessage]
1407
+ def admin_dispatcher_update_login_url(target_id, new_url)
1408
+ submit_params = {}
1409
+ raise TypeError 'expected string' unless target_id.is_a? String
1410
+
1411
+ submit_params['TargetID'] = target_id
1412
+ raise TypeError 'expected string' unless new_url.is_a? String
1413
+
1414
+ submit_params['NewURL'] = new_url
1415
+
1416
+ body = perform_request('/api/v1/admin/dispatcher/update-login-url', submit_params)
1417
+ json_body = JSON.parse body
1418
+ check_status json_body
1419
+ ret = Comet::CometAPIResponseMessage.new
1420
+ ret.from_hash(json_body)
1421
+ ret
1422
+ end
1423
+
1424
+ # AdminDispatcherUpdateSoftware
1425
+ #
1426
+ # Instruct a live connected device to download a software update.
1427
+ #
1428
+ # You must supply administrator authentication credentials to use this API.
1429
+ # This API requires the Auth Role to be enabled.
1430
+ # This API requires the Software Build Role to be enabled.
1431
+ #
1432
+ # @param [String] target_id The live connection GUID
1433
+ # @param [String] self_address (Optional) The external URL of this server, used to resolve conflicts (>= 19.3.11)
1434
+ # @return [Comet::CometAPIResponseMessage]
1435
+ def admin_dispatcher_update_software(target_id, self_address = nil)
1436
+ submit_params = {}
1437
+ raise TypeError 'expected string' unless target_id.is_a? String
1438
+
1439
+ submit_params['TargetID'] = target_id
1440
+ if self_address.nil?
1441
+ submit_params['SelfAddress'] = @server_address
1442
+ else
1443
+ raise TypeError 'expected string' unless self_address.is_a? String
1444
+
1445
+ submit_params['SelfAddress'] = self_address
1446
+ end
1447
+
1448
+ body = perform_request('/api/v1/admin/dispatcher/update-software', submit_params)
1449
+ json_body = JSON.parse body
1450
+ check_status json_body
1451
+ ret = Comet::CometAPIResponseMessage.new
1452
+ ret.from_hash(json_body)
1453
+ ret
1454
+ end
1455
+
1456
+ # AdminGetJobLog
1457
+ #
1458
+ # Get the report log entries for a single job.
1459
+ #
1460
+ # You must supply administrator authentication credentials to use this API.
1461
+ # This API requires the Auth Role to be enabled.
1462
+ #
1463
+ # @param [String] job_id Selected job ID
1464
+ # @return [String]
1465
+ def admin_get_job_log(job_id)
1466
+ submit_params = {}
1467
+ raise TypeError 'expected string' unless job_id.is_a? String
1468
+
1469
+ submit_params['JobID'] = job_id
1470
+
1471
+ perform_request('/api/v1/admin/get-job-log', submit_params)
1472
+ end
1473
+
1474
+ # AdminGetJobProperties
1475
+ #
1476
+ # Get properties of a single job.
1477
+ #
1478
+ # You must supply administrator authentication credentials to use this API.
1479
+ # This API requires the Auth Role to be enabled.
1480
+ #
1481
+ # @param [String] job_id Selected job ID
1482
+ # @return [Comet::BackupJobDetail]
1483
+ def admin_get_job_properties(job_id)
1484
+ submit_params = {}
1485
+ raise TypeError 'expected string' unless job_id.is_a? String
1486
+
1487
+ submit_params['JobID'] = job_id
1488
+
1489
+ body = perform_request('/api/v1/admin/get-job-properties', submit_params)
1490
+ json_body = JSON.parse body
1491
+ check_status json_body
1492
+ ret = Comet::BackupJobDetail.new
1493
+ ret.from_hash(json_body)
1494
+ ret
1495
+ end
1496
+
1497
+ # AdminGetJobsAll
1498
+ #
1499
+ # Get jobs (All).
1500
+ # The jobs are returned in an unspecified order.
1501
+ #
1502
+ # You must supply administrator authentication credentials to use this API.
1503
+ # This API requires the Auth Role to be enabled.
1504
+ #
1505
+ # @return [Array<Comet::BackupJobDetail>]
1506
+ def admin_get_jobs_all
1507
+ body = perform_request('/api/v1/admin/get-jobs-all')
1508
+ json_body = JSON.parse body
1509
+ check_status json_body
1510
+ if json_body.nil?
1511
+ ret = []
1512
+ else
1513
+ ret = Array.new(json_body.length)
1514
+ json_body.each_with_index do |v, i|
1515
+ ret[i] = Comet::BackupJobDetail.new
1516
+ ret[i].from_hash(v)
1517
+ end
1518
+ end
1519
+ ret
1520
+ end
1521
+
1522
+ # AdminGetJobsForCustomSearch
1523
+ #
1524
+ # Get jobs (for custom search).
1525
+ # The jobs are returned in an unspecified order.
1526
+ #
1527
+ # You must supply administrator authentication credentials to use this API.
1528
+ # This API requires the Auth Role to be enabled.
1529
+ #
1530
+ # @param [Comet::SearchClause] query (No description available)
1531
+ # @return [Array<Comet::BackupJobDetail>]
1532
+ def admin_get_jobs_for_custom_search(query)
1533
+ submit_params = {}
1534
+ raise TypeError 'expected Comet::SearchClause' unless query.is_a? Comet::SearchClause
1535
+
1536
+ submit_params['Query'] = query.to_json
1537
+
1538
+ body = perform_request('/api/v1/admin/get-jobs-for-custom-search', submit_params)
1539
+ json_body = JSON.parse body
1540
+ check_status json_body
1541
+ if json_body.nil?
1542
+ ret = []
1543
+ else
1544
+ ret = Array.new(json_body.length)
1545
+ json_body.each_with_index do |v, i|
1546
+ ret[i] = Comet::BackupJobDetail.new
1547
+ ret[i].from_hash(v)
1548
+ end
1549
+ end
1550
+ ret
1551
+ end
1552
+
1553
+ # AdminGetJobsForDateRange
1554
+ #
1555
+ # Get jobs (for date range).
1556
+ # The jobs are returned in an unspecified order.
1557
+ #
1558
+ # If the `Start` parameter is later than `End`, they will be swapped.
1559
+ #
1560
+ # This API will return all jobs that either started or ended within the supplied range.
1561
+ #
1562
+ # Incomplete jobs have an end time of `0`. You can use this API to find incomplete jobs by setting both `Start` and `End` to `0`.
1563
+ #
1564
+ # You must supply administrator authentication credentials to use this API.
1565
+ # This API requires the Auth Role to be enabled.
1566
+ #
1567
+ # @param [Number] start_value Timestamp (Unix)
1568
+ # @param [Number] end_value Timestamp (Unix)
1569
+ # @return [Array<Comet::BackupJobDetail>]
1570
+ def admin_get_jobs_for_date_range(start_value, end_value)
1571
+ submit_params = {}
1572
+ submit_params['Start'] = start_value
1573
+ submit_params['End'] = end_value
1574
+
1575
+ body = perform_request('/api/v1/admin/get-jobs-for-date-range', submit_params)
1576
+ json_body = JSON.parse body
1577
+ check_status json_body
1578
+ if json_body.nil?
1579
+ ret = []
1580
+ else
1581
+ ret = Array.new(json_body.length)
1582
+ json_body.each_with_index do |v, i|
1583
+ ret[i] = Comet::BackupJobDetail.new
1584
+ ret[i].from_hash(v)
1585
+ end
1586
+ end
1587
+ ret
1588
+ end
1589
+
1590
+ # AdminGetJobsForUser
1591
+ #
1592
+ # Get jobs (for user).
1593
+ # The jobs are returned in an unspecified order.
1594
+ #
1595
+ # You must supply administrator authentication credentials to use this API.
1596
+ # This API requires the Auth Role to be enabled.
1597
+ #
1598
+ # @param [String] target_user Selected username
1599
+ # @return [Array<Comet::BackupJobDetail>]
1600
+ def admin_get_jobs_for_user(target_user)
1601
+ submit_params = {}
1602
+ raise TypeError 'expected string' unless target_user.is_a? String
1603
+
1604
+ submit_params['TargetUser'] = target_user
1605
+
1606
+ body = perform_request('/api/v1/admin/get-jobs-for-user', submit_params)
1607
+ json_body = JSON.parse body
1608
+ check_status json_body
1609
+ if json_body.nil?
1610
+ ret = []
1611
+ else
1612
+ ret = Array.new(json_body.length)
1613
+ json_body.each_with_index do |v, i|
1614
+ ret[i] = Comet::BackupJobDetail.new
1615
+ ret[i].from_hash(v)
1616
+ end
1617
+ end
1618
+ ret
1619
+ end
1620
+
1621
+ # AdminGetJobsRecent
1622
+ #
1623
+ # Get jobs (Recent and incomplete).
1624
+ # The jobs are returned in an unspecified order.
1625
+ #
1626
+ # You must supply administrator authentication credentials to use this API.
1627
+ # This API requires the Auth Role to be enabled.
1628
+ #
1629
+ # @return [Array<Comet::BackupJobDetail>]
1630
+ def admin_get_jobs_recent
1631
+ body = perform_request('/api/v1/admin/get-jobs-recent')
1632
+ json_body = JSON.parse body
1633
+ check_status json_body
1634
+ if json_body.nil?
1635
+ ret = []
1636
+ else
1637
+ ret = Array.new(json_body.length)
1638
+ json_body.each_with_index do |v, i|
1639
+ ret[i] = Comet::BackupJobDetail.new
1640
+ ret[i].from_hash(v)
1641
+ end
1642
+ end
1643
+ ret
1644
+ end
1645
+
1646
+ # AdminGetUserProfile
1647
+ #
1648
+ # Get user account profile.
1649
+ #
1650
+ # You must supply administrator authentication credentials to use this API.
1651
+ # This API requires the Auth Role to be enabled.
1652
+ #
1653
+ # @param [String] target_user Selected account username
1654
+ # @return [Comet::UserProfileConfig]
1655
+ def admin_get_user_profile(target_user)
1656
+ submit_params = {}
1657
+ raise TypeError 'expected string' unless target_user.is_a? String
1658
+
1659
+ submit_params['TargetUser'] = target_user
1660
+
1661
+ body = perform_request('/api/v1/admin/get-user-profile', submit_params)
1662
+ json_body = JSON.parse body
1663
+ check_status json_body
1664
+ ret = Comet::UserProfileConfig.new
1665
+ ret.from_hash(json_body)
1666
+ ret
1667
+ end
1668
+
1669
+ # AdminGetUserProfileAndHash
1670
+ #
1671
+ # Get user account profile (atomic).
1672
+ # The resulting hash parameter can be passed to the corresponding update API, to atomically ensure that no changes occur between get/set operations.
1673
+ # The hash format is not publicly documented and may change in a future server version. Use server APIs to retrieve current hash values.
1674
+ #
1675
+ # You must supply administrator authentication credentials to use this API.
1676
+ # This API requires the Auth Role to be enabled.
1677
+ #
1678
+ # @param [String] target_user Selected account username
1679
+ # @return [Comet::GetProfileAndHashResponseMessage]
1680
+ def admin_get_user_profile_and_hash(target_user)
1681
+ submit_params = {}
1682
+ raise TypeError 'expected string' unless target_user.is_a? String
1683
+
1684
+ submit_params['TargetUser'] = target_user
1685
+
1686
+ body = perform_request('/api/v1/admin/get-user-profile-and-hash', submit_params)
1687
+ json_body = JSON.parse body
1688
+ check_status json_body
1689
+ ret = Comet::GetProfileAndHashResponseMessage.new
1690
+ ret.from_hash(json_body)
1691
+ ret
1692
+ end
1693
+
1694
+ # AdminGetUserProfileHash
1695
+ #
1696
+ # Get user account profile (hash).
1697
+ # The profile hash can be used to determine if a user account profile has changed.
1698
+ # The hash format is not publicly documented and may change in a future server version. Use server APIs to retrieve current hash values.
1699
+ #
1700
+ # You must supply administrator authentication credentials to use this API.
1701
+ # This API requires the Auth Role to be enabled.
1702
+ #
1703
+ # @param [String] target_user Selected account username
1704
+ # @return [Comet::GetProfileHashResponseMessage]
1705
+ def admin_get_user_profile_hash(target_user)
1706
+ submit_params = {}
1707
+ raise TypeError 'expected string' unless target_user.is_a? String
1708
+
1709
+ submit_params['TargetUser'] = target_user
1710
+
1711
+ body = perform_request('/api/v1/admin/get-user-profile-hash', submit_params)
1712
+ json_body = JSON.parse body
1713
+ check_status json_body
1714
+ ret = Comet::GetProfileHashResponseMessage.new
1715
+ ret.from_hash(json_body)
1716
+ ret
1717
+ end
1718
+
1719
+ # AdminJobCancel
1720
+ #
1721
+ # Cancel a running job.
1722
+ # A request is sent to the live-connected device, asking it to cancel the operation. This may fail if there is no live-connection.
1723
+ # Only jobs from Comet 18.3.5 or newer can be cancelled. A job can only be cancelled if it has a non-empty CancellationID field in its properties.
1724
+ #
1725
+ # You must supply administrator authentication credentials to use this API.
1726
+ # This API requires the Auth Role to be enabled.
1727
+ #
1728
+ # @param [String] target_user Username
1729
+ # @param [String] job_id Job ID
1730
+ # @return [Comet::CometAPIResponseMessage]
1731
+ def admin_job_cancel(target_user, job_id)
1732
+ submit_params = {}
1733
+ raise TypeError 'expected string' unless target_user.is_a? String
1734
+
1735
+ submit_params['TargetUser'] = target_user
1736
+ raise TypeError 'expected string' unless job_id.is_a? String
1737
+
1738
+ submit_params['JobID'] = job_id
1739
+
1740
+ body = perform_request('/api/v1/admin/job/cancel', submit_params)
1741
+ json_body = JSON.parse body
1742
+ check_status json_body
1743
+ ret = Comet::CometAPIResponseMessage.new
1744
+ ret.from_hash(json_body)
1745
+ ret
1746
+ end
1747
+
1748
+ # AdminListUsers
1749
+ #
1750
+ # List all user accounts.
1751
+ #
1752
+ # You must supply administrator authentication credentials to use this API.
1753
+ # This API requires the Auth Role to be enabled.
1754
+ #
1755
+ # @return [Array<String>]
1756
+ def admin_list_users
1757
+ body = perform_request('/api/v1/admin/list-users')
1758
+ json_body = JSON.parse body
1759
+ check_status json_body
1760
+ if json_body.nil?
1761
+ ret = []
1762
+ else
1763
+ ret = Array.new(json_body.length)
1764
+ json_body.each_with_index do |v, i|
1765
+ raise TypeError 'expected string' unless v.is_a? String
1766
+
1767
+ ret[i] = v
1768
+ end
1769
+ end
1770
+ ret
1771
+ end
1772
+
1773
+ # AdminListUsersFull
1774
+ #
1775
+ # List all user account profiles.
1776
+ #
1777
+ # You must supply administrator authentication credentials to use this API.
1778
+ # This API requires the Auth Role to be enabled.
1779
+ #
1780
+ # @return [Hash{String => Comet::UserProfileConfig}]
1781
+ def admin_list_users_full
1782
+ body = perform_request('/api/v1/admin/list-users-full')
1783
+ json_body = JSON.parse body
1784
+ check_status json_body
1785
+ ret = {}
1786
+ if json_body.nil?
1787
+ ret = {}
1788
+ else
1789
+ json_body.each do |k, v|
1790
+ ret[k] = Comet::UserProfileConfig.new
1791
+ ret[k].from_hash(v)
1792
+ end
1793
+ end
1794
+ ret
1795
+ end
1796
+
1797
+ # AdminMetaBrandingConfigGet
1798
+ #
1799
+ # Get Branding configuration.
1800
+ #
1801
+ # You must supply administrator authentication credentials to use this API.
1802
+ # Access to this API may be prevented on a per-administrator basis.
1803
+ #
1804
+ # @return [Comet::ServerConfigOptionsBrandingFragment]
1805
+ def admin_meta_branding_config_get
1806
+ body = perform_request('/api/v1/admin/meta/branding-config/get')
1807
+ json_body = JSON.parse body
1808
+ check_status json_body
1809
+ ret = Comet::ServerConfigOptionsBrandingFragment.new
1810
+ ret.from_hash(json_body)
1811
+ ret
1812
+ end
1813
+
1814
+ # AdminMetaBrandingConfigSet
1815
+ #
1816
+ # Set Branding configuration.
1817
+ # Note that file resources must be provided using a resource URI I.E `"resource://05ba0b90ee66bda433169581188aba8d29faa938f9464cccd651a02fdf2e5b57"`. See AdminMetaResourceNew for the API documentation to create new file resources.
1818
+ #
1819
+ # You must supply administrator authentication credentials to use this API.
1820
+ # Access to this API may be prevented on a per-administrator basis.
1821
+ #
1822
+ # @param [Comet::BrandingOptions] branding_config Updated configuration content
1823
+ # @return [Comet::CometAPIResponseMessage]
1824
+ def admin_meta_branding_config_set(branding_config)
1825
+ submit_params = {}
1826
+ raise TypeError 'expected Comet::BrandingOptions' unless branding_config.is_a? Comet::BrandingOptions
1827
+
1828
+ submit_params['BrandingConfig'] = branding_config.to_json
1829
+
1830
+ body = perform_request('/api/v1/admin/meta/branding-config/set', submit_params)
1831
+ json_body = JSON.parse body
1832
+ check_status json_body
1833
+ ret = Comet::CometAPIResponseMessage.new
1834
+ ret.from_hash(json_body)
1835
+ ret
1836
+ end
1837
+
1838
+ # AdminMetaBuildConfigGet
1839
+ #
1840
+ # Get Software Build Role configuration.
1841
+ #
1842
+ # You must supply administrator authentication credentials to use this API.
1843
+ # Access to this API may be prevented on a per-administrator basis.
1844
+ #
1845
+ # @return [Comet::ServerConfigOptionsSoftwareBuildRoleFragment]
1846
+ def admin_meta_build_config_get
1847
+ body = perform_request('/api/v1/admin/meta/build-config/get')
1848
+ json_body = JSON.parse body
1849
+ check_status json_body
1850
+ ret = Comet::ServerConfigOptionsSoftwareBuildRoleFragment.new
1851
+ ret.from_hash(json_body)
1852
+ ret
1853
+ end
1854
+
1855
+ # AdminMetaBuildConfigSet
1856
+ #
1857
+ # Set Build Role configuration.
1858
+ #
1859
+ # You must supply administrator authentication credentials to use this API.
1860
+ # Access to this API may be prevented on a per-administrator basis.
1861
+ #
1862
+ # @param [Comet::SoftwareBuildRoleOptions] software_build_role_config Updated configuration content
1863
+ # @return [Comet::CometAPIResponseMessage]
1864
+ def admin_meta_build_config_set(software_build_role_config)
1865
+ submit_params = {}
1866
+ raise TypeError 'expected Comet::SoftwareBuildRoleOptions' unless software_build_role_config.is_a? Comet::SoftwareBuildRoleOptions
1867
+
1868
+ submit_params['SoftwareBuildRoleConfig'] = software_build_role_config.to_json
1869
+
1870
+ body = perform_request('/api/v1/admin/meta/build-config/set', submit_params)
1871
+ json_body = JSON.parse body
1872
+ check_status json_body
1873
+ ret = Comet::CometAPIResponseMessage.new
1874
+ ret.from_hash(json_body)
1875
+ ret
1876
+ end
1877
+
1878
+ # AdminMetaListAvailableLogDays
1879
+ #
1880
+ # Get log files.
1881
+ #
1882
+ # You must supply administrator authentication credentials to use this API.
1883
+ #
1884
+ # @return [Array<Number>]
1885
+ def admin_meta_list_available_log_days
1886
+ body = perform_request('/api/v1/admin/meta/list-available-log-days')
1887
+ json_body = JSON.parse body
1888
+ check_status json_body
1889
+ if json_body.nil?
1890
+ ret = []
1891
+ else
1892
+ ret = Array.new(json_body.length)
1893
+ json_body.each_with_index do |v, i|
1894
+ ret[i] = v
1895
+ end
1896
+ end
1897
+ ret
1898
+ end
1899
+
1900
+ # AdminMetaReadLogs
1901
+ #
1902
+ # Get log file content.
1903
+ # On non-Windows platforms, log content uses LF line endings. On Windows, Comet changed from LF to CRLF line endings in 18.3.2.
1904
+ # This API does not automatically convert line endings; around the 18.3.2 timeframe, log content may even contain mixed line-endings.
1905
+ #
1906
+ # You must supply administrator authentication credentials to use this API.
1907
+ #
1908
+ # @param [Number] log A log day, selected from the options returned by the Get Log Files API
1909
+ # @return [String]
1910
+ def admin_meta_read_logs(log)
1911
+ submit_params = {}
1912
+ submit_params['Log'] = log
1913
+
1914
+ perform_request('/api/v1/admin/meta/read-logs', submit_params)
1915
+ end
1916
+
1917
+ # AdminMetaRemoteStorageVaultGet
1918
+ #
1919
+ # Get Requesting Remote Storage Vault Config.
1920
+ #
1921
+ # You must supply administrator authentication credentials to use this API.
1922
+ # Access to this API may be prevented on a per-administrator basis.
1923
+ #
1924
+ # @return [Array<Comet::RemoteStorageOption>]
1925
+ def admin_meta_remote_storage_vault_get
1926
+ body = perform_request('/api/v1/admin/meta/remote-storage-vault/get')
1927
+ json_body = JSON.parse body
1928
+ check_status json_body
1929
+ if json_body.nil?
1930
+ ret = []
1931
+ else
1932
+ ret = Array.new(json_body.length)
1933
+ json_body.each_with_index do |v, i|
1934
+ ret[i] = Comet::RemoteStorageOption.new
1935
+ ret[i].from_hash(v)
1936
+ end
1937
+ end
1938
+ ret
1939
+ end
1940
+
1941
+ # AdminMetaRemoteStorageVaultSet
1942
+ #
1943
+ # Set Requestable Remote Storage Vault options.
1944
+ #
1945
+ # You must supply administrator authentication credentials to use this API.
1946
+ # Access to this API may be prevented on a per-administrator basis.
1947
+ #
1948
+ # @param [Array<Comet::RemoteStorageOption>] remote_storage_options Updated configuration content
1949
+ # @return [Comet::CometAPIResponseMessage]
1950
+ def admin_meta_remote_storage_vault_set(remote_storage_options)
1951
+ submit_params = {}
1952
+ raise TypeError 'expected array' unless remote_storage_options.is_a? Array
1953
+
1954
+ submit_params['RemoteStorageOptions'] = remote_storage_options.to_json
1955
+
1956
+ body = perform_request('/api/v1/admin/meta/remote-storage-vault/set', submit_params)
1957
+ json_body = JSON.parse body
1958
+ check_status json_body
1959
+ ret = Comet::CometAPIResponseMessage.new
1960
+ ret.from_hash(json_body)
1961
+ ret
1962
+ end
1963
+
1964
+ # AdminMetaResourceGet
1965
+ #
1966
+ # Get a resource file.
1967
+ # Resources are used to upload files within the server configuration.
1968
+ #
1969
+ # You must supply administrator authentication credentials to use this API.
1970
+ #
1971
+ # @param [String] hash The resource identifier
1972
+ # @return [String]
1973
+ def admin_meta_resource_get(hash)
1974
+ submit_params = {}
1975
+ raise TypeError 'expected string' unless hash.is_a? String
1976
+
1977
+ submit_params['Hash'] = hash
1978
+
1979
+ perform_request('/api/v1/admin/meta/resource/get', submit_params)
1980
+ end
1981
+
1982
+ # AdminMetaRestartService
1983
+ #
1984
+ # Restart server.
1985
+ # The Comet Server process will exit. The service manager should restart the server automatically.
1986
+ #
1987
+ # Prior to 18.9.2, this API terminated the server immediately without returning a response. In 18.9.2 and later, it returns a successful response before shutting down.
1988
+ #
1989
+ # You must supply administrator authentication credentials to use this API.
1990
+ # Access to this API may be prevented on a per-administrator basis.
1991
+ #
1992
+ # @return [Comet::CometAPIResponseMessage]
1993
+ def admin_meta_restart_service
1994
+ body = perform_request('/api/v1/admin/meta/restart-service')
1995
+ json_body = JSON.parse body
1996
+ check_status json_body
1997
+ ret = Comet::CometAPIResponseMessage.new
1998
+ ret.from_hash(json_body)
1999
+ ret
2000
+ end
2001
+
2002
+ # AdminMetaSendTestEmail
2003
+ #
2004
+ # Send a test email message.
2005
+ # This allows the Comet Server web interface to support testing different email credentials during setup.
2006
+ #
2007
+ # You must supply administrator authentication credentials to use this API.
2008
+ # Access to this API may be prevented on a per-administrator basis.
2009
+ #
2010
+ # @param [Comet::EmailOptions] email_options Updated configuration content
2011
+ # @param [String] recipient Target email address to send test email
2012
+ # @return [Comet::CometAPIResponseMessage]
2013
+ def admin_meta_send_test_email(email_options, recipient)
2014
+ submit_params = {}
2015
+ raise TypeError 'expected Comet::EmailOptions' unless email_options.is_a? Comet::EmailOptions
2016
+
2017
+ submit_params['EmailOptions'] = email_options.to_json
2018
+ raise TypeError 'expected string' unless recipient.is_a? String
2019
+
2020
+ submit_params['Recipient'] = recipient
2021
+
2022
+ body = perform_request('/api/v1/admin/meta/send-test-email', submit_params)
2023
+ json_body = JSON.parse body
2024
+ check_status json_body
2025
+ ret = Comet::CometAPIResponseMessage.new
2026
+ ret.from_hash(json_body)
2027
+ ret
2028
+ end
2029
+
2030
+ # AdminMetaServerConfigGet
2031
+ #
2032
+ # Get server configuration.
2033
+ #
2034
+ # You must supply administrator authentication credentials to use this API.
2035
+ # Access to this API may be prevented on a per-administrator basis.
2036
+ #
2037
+ # @return [Comet::ServerConfigOptions]
2038
+ def admin_meta_server_config_get
2039
+ body = perform_request('/api/v1/admin/meta/server-config/get')
2040
+ json_body = JSON.parse body
2041
+ check_status json_body
2042
+ ret = Comet::ServerConfigOptions.new
2043
+ ret.from_hash(json_body)
2044
+ ret
2045
+ end
2046
+
2047
+ # AdminMetaServerConfigNetworkInterfaces
2048
+ #
2049
+ # List the available network interfaces on the PC running Comet Server.
2050
+ # Any IPv6 addresses are listed in compressed form without square-brackets.
2051
+ #
2052
+ # You must supply administrator authentication credentials to use this API.
2053
+ # Access to this API may be prevented on a per-administrator basis.
2054
+ #
2055
+ # @return [Array<String>]
2056
+ def admin_meta_server_config_network_interfaces
2057
+ body = perform_request('/api/v1/admin/meta/server-config/network-interfaces')
2058
+ json_body = JSON.parse body
2059
+ check_status json_body
2060
+ if json_body.nil?
2061
+ ret = []
2062
+ else
2063
+ ret = Array.new(json_body.length)
2064
+ json_body.each_with_index do |v, i|
2065
+ raise TypeError 'expected string' unless v.is_a? String
2066
+
2067
+ ret[i] = v
2068
+ end
2069
+ end
2070
+ ret
2071
+ end
2072
+
2073
+ # AdminMetaServerConfigSet
2074
+ #
2075
+ # Set server configuration.
2076
+ # The Comet Server process will exit. The service manager should restart the server automatically.
2077
+ #
2078
+ # Prior to 18.9.2, this API terminated the server immediately without returning a response. In 18.9.2 and later, it returns a successful response before shutting down.
2079
+ #
2080
+ # You must supply administrator authentication credentials to use this API.
2081
+ # Access to this API may be prevented on a per-administrator basis.
2082
+ #
2083
+ # @param [Comet::ServerConfigOptions] config Updated configuration content
2084
+ # @return [Comet::CometAPIResponseMessage]
2085
+ def admin_meta_server_config_set(config)
2086
+ submit_params = {}
2087
+ raise TypeError 'expected Comet::ServerConfigOptions' unless config.is_a? Comet::ServerConfigOptions
2088
+
2089
+ submit_params['Config'] = config.to_json
2090
+
2091
+ body = perform_request('/api/v1/admin/meta/server-config/set', submit_params)
2092
+ json_body = JSON.parse body
2093
+ check_status json_body
2094
+ ret = Comet::CometAPIResponseMessage.new
2095
+ ret.from_hash(json_body)
2096
+ ret
2097
+ end
2098
+
2099
+ # AdminMetaShutdownService
2100
+ #
2101
+ # Shut down server.
2102
+ # The Comet Server process will exit.
2103
+ #
2104
+ # Prior to 18.9.2, this API terminated the server immediately without returning a response. In 18.9.2 and later, it returns a successful response before shutting down.
2105
+ #
2106
+ # You must supply administrator authentication credentials to use this API.
2107
+ # Access to this API may be prevented on a per-administrator basis.
2108
+ #
2109
+ # @return [Comet::CometAPIResponseMessage]
2110
+ def admin_meta_shutdown_service
2111
+ body = perform_request('/api/v1/admin/meta/shutdown-service')
2112
+ json_body = JSON.parse body
2113
+ check_status json_body
2114
+ ret = Comet::CometAPIResponseMessage.new
2115
+ ret.from_hash(json_body)
2116
+ ret
2117
+ end
2118
+
2119
+ # AdminMetaSoftwareUpdateNews
2120
+ #
2121
+ # Get software update news from the software provider.
2122
+ #
2123
+ # You must supply administrator authentication credentials to use this API.
2124
+ #
2125
+ # @return [Comet::SoftwareUpdateNewsResponse]
2126
+ def admin_meta_software_update_news
2127
+ body = perform_request('/api/v1/admin/meta/software-update-news')
2128
+ json_body = JSON.parse body
2129
+ check_status json_body
2130
+ ret = Comet::SoftwareUpdateNewsResponse.new
2131
+ ret.from_hash(json_body)
2132
+ ret
2133
+ end
2134
+
2135
+ # AdminMetaStats
2136
+ #
2137
+ # Get Comet Server historical statistics.
2138
+ # The returned key-value map is not necessarily ordered. Client-side code should sort the result before display.
2139
+ #
2140
+ # You must supply administrator authentication credentials to use this API.
2141
+ #
2142
+ # @param [Boolean] simple Remove redundant statistics
2143
+ # @return [Hash{Number => Comet::StatResult}]
2144
+ def admin_meta_stats(simple)
2145
+ submit_params = {}
2146
+ submit_params['Simple'] = (simple ? 1 : 0)
2147
+
2148
+ body = perform_request('/api/v1/admin/meta/stats', submit_params)
2149
+ json_body = JSON.parse body
2150
+ check_status json_body
2151
+ ret = {}
2152
+ if json_body.nil?
2153
+ ret = {}
2154
+ else
2155
+ json_body.each do |k, v|
2156
+ ret[k] = Comet::StatResult.new
2157
+ ret[k].from_hash(v)
2158
+ end
2159
+ end
2160
+ ret
2161
+ end
2162
+
2163
+ # AdminMetaVersion
2164
+ #
2165
+ # Get server properties.
2166
+ # Retrieve the version number and basic properties about the server.
2167
+ #
2168
+ # You must supply administrator authentication credentials to use this API.
2169
+ #
2170
+ # @return [Comet::ServerMetaVersionInfo]
2171
+ def admin_meta_version
2172
+ body = perform_request('/api/v1/admin/meta/version')
2173
+ json_body = JSON.parse body
2174
+ check_status json_body
2175
+ ret = Comet::ServerMetaVersionInfo.new
2176
+ ret.from_hash(json_body)
2177
+ ret
2178
+ end
2179
+
2180
+ # AdminMetaWebhookOptionsGet
2181
+ #
2182
+ # Get the server webhook configuration.
2183
+ #
2184
+ # You must supply administrator authentication credentials to use this API.
2185
+ #
2186
+ # @return [Hash{String => Comet::WebhookOption}]
2187
+ def admin_meta_webhook_options_get
2188
+ body = perform_request('/api/v1/admin/meta/webhook-options/get')
2189
+ json_body = JSON.parse body
2190
+ check_status json_body
2191
+ ret = {}
2192
+ if json_body.nil?
2193
+ ret = {}
2194
+ else
2195
+ json_body.each do |k, v|
2196
+ ret[k] = Comet::WebhookOption.new
2197
+ ret[k].from_hash(v)
2198
+ end
2199
+ end
2200
+ ret
2201
+ end
2202
+
2203
+ # AdminMetaWebhookOptionsSet
2204
+ #
2205
+ # Update the server webhook configuration.
2206
+ # Calling this endpoint will interrupt any messages currently queued for existing webhook destinations.
2207
+ #
2208
+ # You must supply administrator authentication credentials to use this API.
2209
+ #
2210
+ # @param [Hash{String => Comet::WebhookOption}] webhook_options A json encoded string of the new webhook target options.
2211
+ # @return [Comet::CometAPIResponseMessage]
2212
+ def admin_meta_webhook_options_set(webhook_options)
2213
+ submit_params = {}
2214
+ raise TypeError 'expected hash' unless webhook_options.is_a? Hash
2215
+
2216
+ submit_params['WebhookOptions'] = webhook_options.to_json
2217
+
2218
+ body = perform_request('/api/v1/admin/meta/webhook-options/set', submit_params)
2219
+ json_body = JSON.parse body
2220
+ check_status json_body
2221
+ ret = Comet::CometAPIResponseMessage.new
2222
+ ret.from_hash(json_body)
2223
+ ret
2224
+ end
2225
+
2226
+ # AdminNewsGetAll
2227
+ #
2228
+ # Get News entries (Admin).
2229
+ #
2230
+ # You must supply administrator authentication credentials to use this API.
2231
+ # This API requires the Auth Role to be enabled.
2232
+ #
2233
+ # @return [Hash{String => Comet::NewsEntry}]
2234
+ def admin_news_get_all
2235
+ body = perform_request('/api/v1/admin/news/get-all')
2236
+ json_body = JSON.parse body
2237
+ check_status json_body
2238
+ ret = {}
2239
+ if json_body.nil?
2240
+ ret = {}
2241
+ else
2242
+ json_body.each do |k, v|
2243
+ ret[k] = Comet::NewsEntry.new
2244
+ ret[k].from_hash(v)
2245
+ end
2246
+ end
2247
+ ret
2248
+ end
2249
+
2250
+ # AdminNewsRemove
2251
+ #
2252
+ # Remove news item.
2253
+ #
2254
+ # You must supply administrator authentication credentials to use this API.
2255
+ # This API requires the Auth Role to be enabled.
2256
+ #
2257
+ # @param [String] news_item Selected news item GUID
2258
+ # @return [Comet::CometAPIResponseMessage]
2259
+ def admin_news_remove(news_item)
2260
+ submit_params = {}
2261
+ raise TypeError 'expected string' unless news_item.is_a? String
2262
+
2263
+ submit_params['NewsItem'] = news_item
2264
+
2265
+ body = perform_request('/api/v1/admin/news/remove', submit_params)
2266
+ json_body = JSON.parse body
2267
+ check_status json_body
2268
+ ret = Comet::CometAPIResponseMessage.new
2269
+ ret.from_hash(json_body)
2270
+ ret
2271
+ end
2272
+
2273
+ # AdminNewsSubmit
2274
+ #
2275
+ # Submit news item.
2276
+ #
2277
+ # You must supply administrator authentication credentials to use this API.
2278
+ # This API requires the Auth Role to be enabled.
2279
+ #
2280
+ # @param [String] news_content Content of news item
2281
+ # @return [Comet::CometAPIResponseMessage]
2282
+ def admin_news_submit(news_content)
2283
+ submit_params = {}
2284
+ raise TypeError 'expected string' unless news_content.is_a? String
2285
+
2286
+ submit_params['NewsContent'] = news_content
2287
+
2288
+ body = perform_request('/api/v1/admin/news/submit', submit_params)
2289
+ json_body = JSON.parse body
2290
+ check_status json_body
2291
+ ret = Comet::CometAPIResponseMessage.new
2292
+ ret.from_hash(json_body)
2293
+ ret
2294
+ end
2295
+
2296
+ # AdminPoliciesDelete
2297
+ #
2298
+ # Delete an existing policy object.
2299
+ #
2300
+ # You must supply administrator authentication credentials to use this API.
2301
+ # This API requires the Auth Role to be enabled.
2302
+ #
2303
+ # @param [String] policy_id The policy ID to update or create
2304
+ # @return [Comet::CometAPIResponseMessage]
2305
+ def admin_policies_delete(policy_id)
2306
+ submit_params = {}
2307
+ raise TypeError 'expected string' unless policy_id.is_a? String
2308
+
2309
+ submit_params['PolicyID'] = policy_id
2310
+
2311
+ body = perform_request('/api/v1/admin/policies/delete', submit_params)
2312
+ json_body = JSON.parse body
2313
+ check_status json_body
2314
+ ret = Comet::CometAPIResponseMessage.new
2315
+ ret.from_hash(json_body)
2316
+ ret
2317
+ end
2318
+
2319
+ # AdminPoliciesGet
2320
+ #
2321
+ # Retrieve a single policy object.
2322
+ # A hash is also returned, to allow atomic modification operations.
2323
+ #
2324
+ # You must supply administrator authentication credentials to use this API.
2325
+ # This API requires the Auth Role to be enabled.
2326
+ #
2327
+ # @param [String] policy_id The policy ID to retrieve
2328
+ # @return [Comet::GetGroupPolicyResponse]
2329
+ def admin_policies_get(policy_id)
2330
+ submit_params = {}
2331
+ raise TypeError 'expected string' unless policy_id.is_a? String
2332
+
2333
+ submit_params['PolicyID'] = policy_id
2334
+
2335
+ body = perform_request('/api/v1/admin/policies/get', submit_params)
2336
+ json_body = JSON.parse body
2337
+ check_status json_body
2338
+ ret = Comet::GetGroupPolicyResponse.new
2339
+ ret.from_hash(json_body)
2340
+ ret
2341
+ end
2342
+
2343
+ # AdminPoliciesList
2344
+ #
2345
+ # List all policy object names.
2346
+ #
2347
+ # You must supply administrator authentication credentials to use this API.
2348
+ # This API requires the Auth Role to be enabled.
2349
+ #
2350
+ # @return [Hash{String => String}]
2351
+ def admin_policies_list
2352
+ body = perform_request('/api/v1/admin/policies/list')
2353
+ json_body = JSON.parse body
2354
+ check_status json_body
2355
+ ret = {}
2356
+ if json_body.nil?
2357
+ ret = {}
2358
+ else
2359
+ json_body.each do |k, v|
2360
+ raise TypeError 'expected string' unless v.is_a? String
2361
+
2362
+ ret[k] = v
2363
+ end
2364
+ end
2365
+ ret
2366
+ end
2367
+
2368
+ # AdminPoliciesListFull
2369
+ #
2370
+ # Get all policy objects.
2371
+ #
2372
+ # You must supply administrator authentication credentials to use this API.
2373
+ # This API requires the Auth Role to be enabled.
2374
+ #
2375
+ # @return [Hash{String => Comet::GroupPolicy}]
2376
+ def admin_policies_list_full
2377
+ body = perform_request('/api/v1/admin/policies/list-full')
2378
+ json_body = JSON.parse body
2379
+ check_status json_body
2380
+ ret = {}
2381
+ if json_body.nil?
2382
+ ret = {}
2383
+ else
2384
+ json_body.each do |k, v|
2385
+ ret[k] = Comet::GroupPolicy.new
2386
+ ret[k].from_hash(v)
2387
+ end
2388
+ end
2389
+ ret
2390
+ end
2391
+
2392
+ # AdminPoliciesNew
2393
+ #
2394
+ # Create a new policy object.
2395
+ #
2396
+ # You must supply administrator authentication credentials to use this API.
2397
+ # This API requires the Auth Role to be enabled.
2398
+ #
2399
+ # @param [Comet::GroupPolicy] policy The policy data
2400
+ # @return [Comet::CreateGroupPolicyResponse]
2401
+ def admin_policies_new(policy)
2402
+ submit_params = {}
2403
+ raise TypeError 'expected Comet::GroupPolicy' unless policy.is_a? Comet::GroupPolicy
2404
+
2405
+ submit_params['Policy'] = policy.to_json
2406
+
2407
+ body = perform_request('/api/v1/admin/policies/new', submit_params)
2408
+ json_body = JSON.parse body
2409
+ check_status json_body
2410
+ ret = Comet::CreateGroupPolicyResponse.new
2411
+ ret.from_hash(json_body)
2412
+ ret
2413
+ end
2414
+
2415
+ # AdminPoliciesSet
2416
+ #
2417
+ # Update an existing policy object.
2418
+ # An optional hash may be used, to ensure the modification was atomic.
2419
+ # This API can also be used to create a new policy object with a specific hash.
2420
+ #
2421
+ # You must supply administrator authentication credentials to use this API.
2422
+ # This API requires the Auth Role to be enabled.
2423
+ #
2424
+ # @param [String] policy_id The policy ID to update or create
2425
+ # @param [Comet::GroupPolicy] policy The policy data
2426
+ # @param [String] check_policy_hash (Optional) An atomic verification hash as supplied by the AdminPoliciesGet API
2427
+ # @return [Comet::CometAPIResponseMessage]
2428
+ def admin_policies_set(policy_id, policy, check_policy_hash = nil)
2429
+ submit_params = {}
2430
+ raise TypeError 'expected string' unless policy_id.is_a? String
2431
+
2432
+ submit_params['PolicyID'] = policy_id
2433
+ raise TypeError 'expected Comet::GroupPolicy' unless policy.is_a? Comet::GroupPolicy
2434
+
2435
+ submit_params['Policy'] = policy.to_json
2436
+ unless check_policy_hash.nil?
2437
+ raise TypeError 'expected string' unless check_policy_hash.is_a? String
2438
+
2439
+ submit_params['CheckPolicyHash'] = check_policy_hash
2440
+ end
2441
+
2442
+ body = perform_request('/api/v1/admin/policies/set', submit_params)
2443
+ json_body = JSON.parse body
2444
+ check_status json_body
2445
+ ret = Comet::CometAPIResponseMessage.new
2446
+ ret.from_hash(json_body)
2447
+ ret
2448
+ end
2449
+
2450
+ # AdminPreviewUserEmailReport
2451
+ #
2452
+ # Preview an email report for a customer.
2453
+ #
2454
+ # You must supply administrator authentication credentials to use this API.
2455
+ # This API requires the Auth Role to be enabled.
2456
+ #
2457
+ # @param [String] target_user Selected account username
2458
+ # @param [Comet::EmailReportConfig] email_report_config Email report configuration to preview
2459
+ # @param [String] email_address (Optional) Email address that may be included in the report body (>= 20.3.3)
2460
+ # @return [Comet::EmailReportGeneratedPreview]
2461
+ def admin_preview_user_email_report(target_user, email_report_config, email_address = nil)
2462
+ submit_params = {}
2463
+ raise TypeError 'expected string' unless target_user.is_a? String
2464
+
2465
+ submit_params['TargetUser'] = target_user
2466
+ raise TypeError 'expected Comet::EmailReportConfig' unless email_report_config.is_a? Comet::EmailReportConfig
2467
+
2468
+ submit_params['EmailReportConfig'] = email_report_config.to_json
2469
+ unless email_address.nil?
2470
+ raise TypeError 'expected string' unless email_address.is_a? String
2471
+
2472
+ submit_params['EmailAddress'] = email_address
2473
+ end
2474
+
2475
+ body = perform_request('/api/v1/admin/preview-user-email-report', submit_params)
2476
+ json_body = JSON.parse body
2477
+ check_status json_body
2478
+ ret = Comet::EmailReportGeneratedPreview.new
2479
+ ret.from_hash(json_body)
2480
+ ret
2481
+ end
2482
+
2483
+ # AdminReplicationState
2484
+ #
2485
+ # Get Replication status.
2486
+ #
2487
+ # You must supply administrator authentication credentials to use this API.
2488
+ #
2489
+ # @return [Array<Comet::ReplicatorStateAPIResponse>]
2490
+ def admin_replication_state
2491
+ body = perform_request('/api/v1/admin/replication/state')
2492
+ json_body = JSON.parse body
2493
+ check_status json_body
2494
+ if json_body.nil?
2495
+ ret = []
2496
+ else
2497
+ ret = Array.new(json_body.length)
2498
+ json_body.each_with_index do |v, i|
2499
+ ret[i] = Comet::ReplicatorStateAPIResponse.new
2500
+ ret[i].from_hash(v)
2501
+ end
2502
+ end
2503
+ ret
2504
+ end
2505
+
2506
+ # AdminRequestStorageVault
2507
+ #
2508
+ # Request a new Storage Vault on behalf of a user.
2509
+ # This action does not respect the "Prevent creating new Storage Vaults (via Request)" policy setting. New Storage Vaults can be requested regardless of the policy setting.
2510
+ # Prior to Comet 19.8.0, the response type was CometAPIResponseMessage (i.e. no DestinationID field in response).
2511
+ #
2512
+ # You must supply administrator authentication credentials to use this API.
2513
+ # This API requires the Auth Role to be enabled.
2514
+ #
2515
+ # @param [String] target_user The user to receive the new Storage Vault
2516
+ # @param [String] storage_provider ID for the Requestable destination
2517
+ # @param [String] self_address (Optional) The external URL for this server. Used to resolve conflicts
2518
+ # @return [Comet::RequestStorageVaultResponseMessage]
2519
+ def admin_request_storage_vault(target_user, storage_provider, self_address = nil)
2520
+ submit_params = {}
2521
+ raise TypeError 'expected string' unless target_user.is_a? String
2522
+
2523
+ submit_params['TargetUser'] = target_user
2524
+ raise TypeError 'expected string' unless storage_provider.is_a? String
2525
+
2526
+ submit_params['StorageProvider'] = storage_provider
2527
+ if self_address.nil?
2528
+ submit_params['SelfAddress'] = @server_address
2529
+ else
2530
+ raise TypeError 'expected string' unless self_address.is_a? String
2531
+
2532
+ submit_params['SelfAddress'] = self_address
2533
+ end
2534
+
2535
+ body = perform_request('/api/v1/admin/request-storage-vault', submit_params)
2536
+ json_body = JSON.parse body
2537
+ check_status json_body
2538
+ ret = Comet::RequestStorageVaultResponseMessage.new
2539
+ ret.from_hash(json_body)
2540
+ ret
2541
+ end
2542
+
2543
+ # AdminRequestStorageVaultProviders
2544
+ #
2545
+ # Get the available options for Requesting a Storage Vault.
2546
+ #
2547
+ # You must supply administrator authentication credentials to use this API.
2548
+ # This API requires the Auth Role to be enabled.
2549
+ #
2550
+ # @return [Hash{String => String}]
2551
+ def admin_request_storage_vault_providers
2552
+ body = perform_request('/api/v1/admin/request-storage-vault-providers')
2553
+ json_body = JSON.parse body
2554
+ check_status json_body
2555
+ ret = {}
2556
+ if json_body.nil?
2557
+ ret = {}
2558
+ else
2559
+ json_body.each do |k, v|
2560
+ raise TypeError 'expected string' unless v.is_a? String
2561
+
2562
+ ret[k] = v
2563
+ end
2564
+ end
2565
+ ret
2566
+ end
2567
+
2568
+ # AdminResetUserPassword
2569
+ #
2570
+ # Reset user account password.
2571
+ # The user account must have a recovery code present. A new replacement recovery code will be generated automatically.
2572
+ #
2573
+ # You must supply administrator authentication credentials to use this API.
2574
+ # This API requires the Auth Role to be enabled.
2575
+ #
2576
+ # @param [String] target_user Selected account username
2577
+ # @param [String] new_password New account password
2578
+ # @param [String] old_password Old account password (optional)
2579
+ # @return [Comet::CometAPIResponseMessage]
2580
+ def admin_reset_user_password(target_user, new_password, old_password)
2581
+ submit_params = {}
2582
+ raise TypeError 'expected string' unless target_user.is_a? String
2583
+
2584
+ submit_params['TargetUser'] = target_user
2585
+ raise TypeError 'expected string' unless new_password.is_a? String
2586
+
2587
+ submit_params['NewPassword'] = new_password
2588
+ raise TypeError 'expected string' unless old_password.is_a? String
2589
+
2590
+ submit_params['OldPassword'] = old_password
2591
+
2592
+ body = perform_request('/api/v1/admin/reset-user-password', submit_params)
2593
+ json_body = JSON.parse body
2594
+ check_status json_body
2595
+ ret = Comet::CometAPIResponseMessage.new
2596
+ ret.from_hash(json_body)
2597
+ ret
2598
+ end
2599
+
2600
+ # AdminRevokeDevice
2601
+ #
2602
+ # Revoke device from user account.
2603
+ # It's possible to simply remove the Device section from the user's profile, however, using this dedicated API will also gracefully handle live connections.
2604
+ #
2605
+ # You must supply administrator authentication credentials to use this API.
2606
+ # This API requires the Auth Role to be enabled.
2607
+ #
2608
+ # @param [String] target_user Selected account username
2609
+ # @param [String] target_device Selected Device ID
2610
+ # @return [Comet::CometAPIResponseMessage]
2611
+ def admin_revoke_device(target_user, target_device)
2612
+ submit_params = {}
2613
+ raise TypeError 'expected string' unless target_user.is_a? String
2614
+
2615
+ submit_params['TargetUser'] = target_user
2616
+ raise TypeError 'expected string' unless target_device.is_a? String
2617
+
2618
+ submit_params['TargetDevice'] = target_device
2619
+
2620
+ body = perform_request('/api/v1/admin/revoke-device', submit_params)
2621
+ json_body = JSON.parse body
2622
+ check_status json_body
2623
+ ret = Comet::CometAPIResponseMessage.new
2624
+ ret.from_hash(json_body)
2625
+ ret
2626
+ end
2627
+
2628
+ # AdminSetUserProfile
2629
+ #
2630
+ # Modify user account profile.
2631
+ #
2632
+ # You must supply administrator authentication credentials to use this API.
2633
+ # This API requires the Auth Role to be enabled.
2634
+ #
2635
+ # @param [String] target_user Selected account username
2636
+ # @param [Comet::UserProfileConfig] profile_data Modified user profile
2637
+ # @return [Comet::CometAPIResponseMessage]
2638
+ def admin_set_user_profile(target_user, profile_data)
2639
+ submit_params = {}
2640
+ raise TypeError 'expected string' unless target_user.is_a? String
2641
+
2642
+ submit_params['TargetUser'] = target_user
2643
+ raise TypeError 'expected Comet::UserProfileConfig' unless profile_data.is_a? Comet::UserProfileConfig
2644
+
2645
+ submit_params['ProfileData'] = profile_data.to_json
2646
+
2647
+ body = perform_request('/api/v1/admin/set-user-profile', submit_params)
2648
+ json_body = JSON.parse body
2649
+ check_status json_body
2650
+ ret = Comet::CometAPIResponseMessage.new
2651
+ ret.from_hash(json_body)
2652
+ ret
2653
+ end
2654
+
2655
+ # AdminSetUserProfileHash
2656
+ #
2657
+ # Modify user account profile (atomic).
2658
+ # The hash parameter can be determined from the corresponding API, to atomically ensure that no changes occur between get/set operations.
2659
+ # The hash format is not publicly documented and may change in a future server version. Use server APIs to retrieve current hash values.
2660
+ #
2661
+ # You must supply administrator authentication credentials to use this API.
2662
+ # This API requires the Auth Role to be enabled.
2663
+ #
2664
+ # @param [String] target_user Selected account username
2665
+ # @param [Comet::UserProfileConfig] profile_data Modified user profile
2666
+ # @param [String] require_hash Previous hash parameter
2667
+ # @return [Comet::CometAPIResponseMessage]
2668
+ def admin_set_user_profile_hash(target_user, profile_data, require_hash)
2669
+ submit_params = {}
2670
+ raise TypeError 'expected string' unless target_user.is_a? String
2671
+
2672
+ submit_params['TargetUser'] = target_user
2673
+ raise TypeError 'expected Comet::UserProfileConfig' unless profile_data.is_a? Comet::UserProfileConfig
2674
+
2675
+ submit_params['ProfileData'] = profile_data.to_json
2676
+ raise TypeError 'expected string' unless require_hash.is_a? String
2677
+
2678
+ submit_params['RequireHash'] = require_hash
2679
+
2680
+ body = perform_request('/api/v1/admin/set-user-profile-hash', submit_params)
2681
+ json_body = JSON.parse body
2682
+ check_status json_body
2683
+ ret = Comet::CometAPIResponseMessage.new
2684
+ ret.from_hash(json_body)
2685
+ ret
2686
+ end
2687
+
2688
+ # AdminStorageDeleteBucket
2689
+ #
2690
+ # Delete a bucket.
2691
+ # All data will be removed from the server. Misuse can cause data loss!
2692
+ #
2693
+ # You must supply administrator authentication credentials to use this API.
2694
+ # This API requires the Storage Role to be enabled.
2695
+ #
2696
+ # @param [String] bucket_id Selected bucket name
2697
+ # @return [Comet::CometAPIResponseMessage]
2698
+ def admin_storage_delete_bucket(bucket_id)
2699
+ submit_params = {}
2700
+ raise TypeError 'expected string' unless bucket_id.is_a? String
2701
+
2702
+ submit_params['BucketID'] = bucket_id
2703
+
2704
+ body = perform_request('/api/v1/admin/storage/delete-bucket', submit_params)
2705
+ json_body = JSON.parse body
2706
+ check_status json_body
2707
+ ret = Comet::CometAPIResponseMessage.new
2708
+ ret.from_hash(json_body)
2709
+ ret
2710
+ end
2711
+
2712
+ # AdminStorageFreeSpace
2713
+ #
2714
+ # Retrieve available space metrics.
2715
+ #
2716
+ # You must supply administrator authentication credentials to use this API.
2717
+ # Access to this API may be prevented on a per-administrator basis.
2718
+ # This API requires the Storage Role to be enabled.
2719
+ #
2720
+ # @param [String] bucket_id Selected bucket name
2721
+ # @return [Comet::StorageFreeSpaceInfo]
2722
+ def admin_storage_free_space(bucket_id)
2723
+ submit_params = {}
2724
+ raise TypeError 'expected string' unless bucket_id.is_a? String
2725
+
2726
+ submit_params['BucketID'] = bucket_id
2727
+
2728
+ body = perform_request('/api/v1/admin/storage/free-space', submit_params)
2729
+ json_body = JSON.parse body
2730
+ check_status json_body
2731
+ ret = Comet::StorageFreeSpaceInfo.new
2732
+ ret.from_hash(json_body)
2733
+ ret
2734
+ end
2735
+
2736
+ # AdminStorageListBuckets
2737
+ #
2738
+ # List all buckets.
2739
+ #
2740
+ # You must supply administrator authentication credentials to use this API.
2741
+ # This API requires the Storage Role to be enabled.
2742
+ #
2743
+ # @return [Hash{String => Comet::BucketProperties}]
2744
+ def admin_storage_list_buckets
2745
+ body = perform_request('/api/v1/admin/storage/list-buckets')
2746
+ json_body = JSON.parse body
2747
+ check_status json_body
2748
+ ret = {}
2749
+ if json_body.nil?
2750
+ ret = {}
2751
+ else
2752
+ json_body.each do |k, v|
2753
+ ret[k] = Comet::BucketProperties.new
2754
+ ret[k].from_hash(v)
2755
+ end
2756
+ end
2757
+ ret
2758
+ end
2759
+
2760
+ # AdminStorageRegisterBucket
2761
+ #
2762
+ # Create a new bucket.
2763
+ # Leave the Set* parameters blank to generate a bucket with random credentials, or, supply a pre-hashed password for zero-knowledge operations.
2764
+ # Any auto-generated credentials are returned in the response message.
2765
+ #
2766
+ # You must supply administrator authentication credentials to use this API.
2767
+ # This API requires the Storage Role to be enabled.
2768
+ #
2769
+ # @param [String] set_bucket_value (Optional) Bucket ID
2770
+ # @param [String] set_key_hash_format (Optional) Bucket key hashing format
2771
+ # @param [String] set_key_hash_value (Optional) Bucket key hash
2772
+ # @return [Comet::AddBucketResponseMessage]
2773
+ def admin_storage_register_bucket(set_bucket_value = nil, set_key_hash_format = nil, set_key_hash_value = nil)
2774
+ submit_params = {}
2775
+ unless set_bucket_value.nil?
2776
+ raise TypeError 'expected string' unless set_bucket_value.is_a? String
2777
+
2778
+ submit_params['SetBucketValue'] = set_bucket_value
2779
+ end
2780
+ unless set_key_hash_format.nil?
2781
+ raise TypeError 'expected string' unless set_key_hash_format.is_a? String
2782
+
2783
+ submit_params['SetKeyHashFormat'] = set_key_hash_format
2784
+ end
2785
+ unless set_key_hash_value.nil?
2786
+ raise TypeError 'expected string' unless set_key_hash_value.is_a? String
2787
+
2788
+ submit_params['SetKeyHashValue'] = set_key_hash_value
2789
+ end
2790
+
2791
+ body = perform_request('/api/v1/admin/storage/register-bucket', submit_params)
2792
+ json_body = JSON.parse body
2793
+ check_status json_body
2794
+ ret = Comet::AddBucketResponseMessage.new
2795
+ ret.from_hash(json_body)
2796
+ ret
2797
+ end
2798
+
2799
+ # AdminUpdateCampaignStart
2800
+ #
2801
+ # Start a new software update campaign.
2802
+ #
2803
+ # You must supply administrator authentication credentials to use this API.
2804
+ # This API requires the Software Build Role to be enabled.
2805
+ # This API requires the Auth Role to be enabled.
2806
+ #
2807
+ # @param [Comet::UpdateCampaignOptions] options Configure targets for the software update campaign
2808
+ # @return [Comet::CometAPIResponseMessage]
2809
+ def admin_update_campaign_start(options)
2810
+ submit_params = {}
2811
+ raise TypeError 'expected Comet::UpdateCampaignOptions' unless options.is_a? Comet::UpdateCampaignOptions
2812
+
2813
+ submit_params['Options'] = options.to_json
2814
+
2815
+ body = perform_request('/api/v1/admin/update-campaign/start', submit_params)
2816
+ json_body = JSON.parse body
2817
+ check_status json_body
2818
+ ret = Comet::CometAPIResponseMessage.new
2819
+ ret.from_hash(json_body)
2820
+ ret
2821
+ end
2822
+
2823
+ # AdminUpdateCampaignStatus
2824
+ #
2825
+ # Get current campaign status.
2826
+ #
2827
+ # You must supply administrator authentication credentials to use this API.
2828
+ # This API requires the Software Build Role to be enabled.
2829
+ # This API requires the Auth Role to be enabled.
2830
+ #
2831
+ # @return [Comet::UpdateCampaignStatus]
2832
+ def admin_update_campaign_status
2833
+ body = perform_request('/api/v1/admin/update-campaign/status')
2834
+ json_body = JSON.parse body
2835
+ check_status json_body
2836
+ ret = Comet::UpdateCampaignStatus.new
2837
+ ret.from_hash(json_body)
2838
+ ret
2839
+ end
2840
+
2841
+ # HybridSessionStart
2842
+ #
2843
+ # Generate a session key (log in).
2844
+ # This hybrid API allows you to log in to the Comet Server as either an administrator or end-user account.
2845
+ # This API behaves like either AdminAccountSessionStart or UserWebSessionStart, depending on what the supplied credentials were valid for.
2846
+ #
2847
+ # @return [Comet::SessionKeyRegeneratedResponse]
2848
+ def hybrid_session_start
2849
+ body = perform_request('/api/v1/hybrid/session/start')
2850
+ json_body = JSON.parse body
2851
+ check_status json_body
2852
+ ret = Comet::SessionKeyRegeneratedResponse.new
2853
+ ret.from_hash(json_body)
2854
+ ret
2855
+ end
2856
+
2857
+ # UserWebSessionRevoke
2858
+ #
2859
+ # Revoke a session key (log out).
2860
+ #
2861
+ # You must supply user authentication credentials to use this API, and the user account must be authorized for web access.
2862
+ # This API requires the Auth Role to be enabled.
2863
+ #
2864
+ # @return [Comet::CometAPIResponseMessage]
2865
+ def user_web_session_revoke
2866
+ body = perform_request('/api/v1/user/web/session/revoke')
2867
+ json_body = JSON.parse body
2868
+ check_status json_body
2869
+ ret = Comet::CometAPIResponseMessage.new
2870
+ ret.from_hash(json_body)
2871
+ ret
2872
+ end
2873
+
2874
+ # UserWebSessionStart
2875
+ #
2876
+ # Generate a session key (log in).
2877
+ #
2878
+ # You must supply user authentication credentials to use this API, and the user account must be authorized for web access.
2879
+ # This API requires the Auth Role to be enabled.
2880
+ #
2881
+ # @return [Comet::SessionKeyRegeneratedResponse]
2882
+ def user_web_session_start
2883
+ body = perform_request('/api/v1/user/web/session/start')
2884
+ json_body = JSON.parse body
2885
+ check_status json_body
2886
+ ret = Comet::SessionKeyRegeneratedResponse.new
2887
+ ret.from_hash(json_body)
2888
+ ret
2889
+ end
2890
+
2891
+ # If the supplied object represents an unsuccessful CometAPIResponseMessage, raise
2892
+ # it as an error.
2893
+ #
2894
+ # @param [Hash] obj
2895
+ def check_status(obj)
2896
+ return unless obj.is_a? Hash
2897
+ return unless obj.key?('Status')
2898
+ return unless obj.key?('Message')
2899
+ return unless obj['Status'] != 200 && obj['Status'] != 201
2900
+
2901
+ ret_error = Comet::CometAPIResponseMessage.new
2902
+ ret_error.from_hash(obj)
2903
+ raise Comet::APIResponseError.new(ret_error)
2904
+ end
2905
+
2906
+ # Perform a synchronous HTTP request.
2907
+ #
2908
+ # @param [String] endpoint The URL suffix
2909
+ # @param [Hash<String,String>] params Form post parameters to submit to the target API
2910
+ # @return [String] Response body
2911
+ def perform_request(endpoint, params = {})
2912
+ full_uri = URI(@server_address + endpoint)
2913
+ params['Username'] = @username
2914
+ params['AuthType'] = 'Password'
2915
+ params['Password'] = @password
2916
+
2917
+ res = Net::HTTP.post_form(full_uri, params)
2918
+ unless res.is_a?(Net::HTTPSuccess)
2919
+ raise res
2920
+ end
2921
+
2922
+ res.body
2923
+ end
2924
+ end
2925
+
2926
+ end