comet_backup_ruby_sdk 2.43.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +0 -0
- data/CHANGELOG.md +35 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/RELEASING.md +7 -7
- data/Rakefile +0 -0
- data/comet_backup_ruby_sdk.gemspec +2 -3
- data/lib/comet/api_response_error.rb +1 -1
- data/lib/comet/comet_server.rb +824 -90
- data/lib/comet/definitions.rb +409 -125
- data/lib/comet/models/add_bucket_response_message.rb +1 -1
- data/lib/comet/models/admin_account_apitoken_create_response.rb +102 -0
- data/lib/comet/models/admin_account_apitoken_list_response.rb +98 -0
- data/lib/comet/models/admin_account_properties_response.rb +38 -1
- data/lib/comet/models/admin_apitoken.rb +139 -0
- data/lib/comet/models/admin_apitoken_info.rb +117 -0
- data/lib/comet/models/admin_email_options.rb +1 -1
- data/lib/comet/models/admin_options.rb +1 -1
- data/lib/comet/models/admin_resource_response.rb +1 -1
- data/lib/comet/models/admin_security_options.rb +1 -1
- data/lib/comet/models/admin_u2fregistration.rb +1 -1
- data/lib/comet/models/admin_user_permissions.rb +20 -1
- data/lib/comet/models/admin_web_authn_registration.rb +1 -1
- data/lib/comet/models/allowed_admin_user.rb +19 -1
- data/lib/comet/models/amazon_awsvirtual_storage_role_settings.rb +1 -1
- data/lib/comet/models/attributed_content_measurement.rb +146 -0
- data/lib/comet/models/attributed_content_measurement_component.rb +105 -0
- data/lib/comet/models/authentication_role_options.rb +2 -4
- data/lib/comet/models/available_download.rb +1 -1
- data/lib/comet/models/azure_destination_location.rb +1 -1
- data/lib/comet/models/b2destination_location.rb +1 -1
- data/lib/comet/models/b2storage_extra_info.rb +1 -1
- data/lib/comet/models/b2transaction_totals.rb +1 -1
- data/lib/comet/models/b2virtual_storage_role_settings.rb +1 -1
- data/lib/comet/models/backup_job_advanced_options.rb +15 -1
- data/lib/comet/models/backup_job_detail.rb +14 -2
- data/lib/comet/models/backup_job_progress.rb +1 -1
- data/lib/comet/models/backup_rule_config.rb +43 -1
- data/lib/comet/models/backup_rule_event_triggers.rb +1 -1
- data/lib/comet/models/branding_options.rb +184 -1
- data/lib/comet/models/branding_properties.rb +184 -1
- data/lib/comet/models/browse_disk_drives_response.rb +1 -1
- data/lib/comet/models/browse_edbresponse.rb +1 -1
- data/lib/comet/models/browse_hvresponse.rb +1 -1
- data/lib/comet/models/browse_office_365list_virtual_accounts_response.rb +1 -1
- data/lib/comet/models/browse_office_365objects_response.rb +1 -1
- data/lib/comet/models/browse_proxmox_nodes_response.rb +1 -1
- data/lib/comet/models/browse_proxmox_response.rb +16 -1
- data/lib/comet/models/browse_proxmox_storage_response.rb +1 -1
- data/lib/comet/models/browse_sqlserver_response.rb +1 -1
- data/lib/comet/models/browse_vmware_datacenters_response.rb +1 -1
- data/lib/comet/models/browse_vmware_datastores_response.rb +1 -1
- data/lib/comet/models/browse_vmware_hosts_response.rb +1 -1
- data/lib/comet/models/browse_vmware_networks_response.rb +1 -1
- data/lib/comet/models/browse_vmware_response.rb +1 -1
- data/lib/comet/models/browse_vssresponse.rb +1 -1
- data/lib/comet/models/bucket_properties.rb +1 -1
- data/lib/comet/models/bucket_usage_info.rb +1 -1
- data/lib/comet/models/comet_apiresponse_message.rb +1 -1
- data/lib/comet/models/comet_destination_location.rb +1 -1
- data/lib/comet/models/constellation_check_report.rb +1 -1
- data/lib/comet/models/constellation_role_options.rb +1 -1
- data/lib/comet/models/constellation_stats.rb +1 -1
- data/lib/comet/models/constellation_status_apiresponse.rb +1 -1
- data/lib/comet/models/content_measurement.rb +1 -1
- data/lib/comet/models/content_measurement_component.rb +3 -3
- data/lib/comet/models/count_jobs_response.rb +1 -1
- data/lib/comet/models/create_group_policy_response.rb +1 -1
- data/lib/comet/models/create_user_group_response.rb +1 -1
- data/lib/comet/models/custom_branding_item.rb +143 -0
- data/lib/comet/models/custom_branding_options.rb +79 -0
- data/lib/comet/models/custom_branding_origin.rb +76 -0
- data/lib/comet/models/custom_remote_bucket_settings.rb +1 -1
- data/lib/comet/models/days_of_week_config.rb +1 -1
- data/lib/comet/models/default_email_report_policy.rb +1 -1
- data/lib/comet/models/default_source_with_osrestriction.rb +1 -1
- data/lib/comet/models/destination_config.rb +43 -5
- data/lib/comet/models/destination_location.rb +11 -2
- data/lib/comet/models/destination_statistics.rb +1 -1
- data/lib/comet/models/device_config.rb +42 -1
- data/lib/comet/models/device_identity_response.rb +82 -0
- data/lib/comet/models/disk_drive.rb +1 -1
- data/lib/comet/models/dispatch_with_job_idresponse.rb +1 -1
- data/lib/comet/models/dispatcher_admin_sources_response.rb +1 -1
- data/lib/comet/models/dispatcher_list_snapshot_virtual_machines_response.rb +1 -1
- data/lib/comet/models/dispatcher_stored_objects_response.rb +1 -1
- data/lib/comet/models/dispatcher_vault_snapshots_response.rb +1 -1
- data/lib/comet/models/dispatcher_windisk_snapshot_response.rb +1 -1
- data/lib/comet/models/dnscache_options.rb +94 -0
- data/lib/comet/models/edbfile_info.rb +1 -1
- data/lib/comet/models/email_options.rb +14 -1
- data/lib/comet/models/email_report_config.rb +15 -1
- data/lib/comet/models/email_report_generated_preview.rb +1 -1
- data/lib/comet/models/email_reporting_option.rb +1 -1
- data/lib/comet/models/external_authentication_source.rb +1 -1
- data/lib/comet/models/external_authentication_source_display.rb +1 -1
- data/lib/comet/models/external_authentication_source_response.rb +1 -1
- data/lib/comet/models/external_ldapauthentication_source_server.rb +1 -1
- data/lib/comet/models/external_ldapauthentication_source_settings.rb +1 -1
- data/lib/comet/models/extra_file_exclusion.rb +1 -1
- data/lib/comet/models/file_option.rb +1 -1
- data/lib/comet/models/ftpdestination_location.rb +1 -1
- data/lib/comet/models/get_group_policy_response.rb +1 -1
- data/lib/comet/models/get_profile_and_hash_response_message.rb +1 -1
- data/lib/comet/models/get_profile_hash_response_message.rb +1 -1
- data/lib/comet/models/get_shared_storage_quota_response.rb +110 -0
- data/lib/comet/models/get_user_group_response.rb +1 -1
- data/lib/comet/models/get_user_group_with_users_response.rb +1 -1
- data/lib/comet/models/global_override_options.rb +1 -1
- data/lib/comet/models/group_policy.rb +1 -1
- data/lib/comet/models/hour_sched_config.rb +1 -1
- data/lib/comet/models/httpconnector_options.rb +1 -1
- data/lib/comet/models/hyper_vmachine_info.rb +1 -1
- data/lib/comet/models/hyper_vrestore_target_options.rb +1 -1
- data/lib/comet/models/impossible_cloud_iamtemplate_settings.rb +1 -1
- data/lib/comet/models/impossible_cloud_partner_template_settings.rb +1 -1
- data/lib/comet/models/install_creds.rb +1 -1
- data/lib/comet/models/install_token.rb +8 -8
- data/lib/comet/models/install_token_response.rb +1 -1
- data/lib/comet/models/job_entry.rb +1 -1
- data/lib/comet/models/license_limits.rb +1 -1
- data/lib/comet/models/license_options.rb +1 -1
- data/lib/comet/models/linux_rpm_code_sign_properties.rb +115 -0
- data/lib/comet/models/list_shared_storage_quota_response.rb +98 -0
- data/lib/comet/models/live_user_connection.rb +1 -1
- data/lib/comet/models/local_destination_location.rb +2 -2
- data/lib/comet/models/local_storage_directory.rb +1 -1
- data/lib/comet/models/login_protection_options.rb +1 -1
- data/lib/comet/models/mac_oscode_sign_properties.rb +1 -1
- data/lib/comet/models/mongo_dbconnection.rb +4 -1
- data/lib/comet/models/mssqlconnection.rb +1 -1
- data/lib/comet/models/mssqllogin_args.rb +1 -1
- data/lib/comet/models/my_sqlconnection.rb +1 -1
- data/lib/comet/models/new_bucket_detail.rb +1 -1
- data/lib/comet/models/news_entry.rb +1 -1
- data/lib/comet/models/nfsdestination_location.rb +132 -0
- data/lib/comet/models/ninja_one_auth_callback_response.rb +82 -0
- data/lib/comet/models/ninja_one_config.rb +130 -0
- data/lib/comet/models/ninja_one_organization.rb +91 -0
- data/lib/comet/models/node.rb +80 -0
- data/lib/comet/models/object_lock_storage_template_settings.rb +1 -1
- data/lib/comet/models/office_365connection.rb +1 -1
- data/lib/comet/models/office_365convert_selection_response.rb +102 -0
- data/lib/comet/models/office_365credential.rb +1 -1
- data/lib/comet/models/office_365custom_setting.rb +1 -1
- data/lib/comet/models/office_365custom_setting_v2.rb +23 -1
- data/lib/comet/models/office_365effective_selection.rb +109 -0
- data/lib/comet/models/office_365effective_selection_account.rb +101 -0
- data/lib/comet/models/office_365evaluate_selection_rules_response.rb +95 -0
- data/lib/comet/models/office_365mixed_virtual_account.rb +1 -1
- data/lib/comet/models/office_365object_info.rb +1 -1
- data/lib/comet/models/office_365selection_rule.rb +182 -0
- data/lib/comet/models/office_365service_rule_decision.rb +93 -0
- data/lib/comet/models/oidc_claim.rb +1 -1
- data/lib/comet/models/oidc_config.rb +1 -1
- data/lib/comet/models/organization.rb +1 -1
- data/lib/comet/models/organization_login_urlresponse.rb +1 -1
- data/lib/comet/models/organization_response.rb +1 -1
- data/lib/comet/models/osinfo.rb +1 -1
- data/lib/comet/models/partition.rb +1 -1
- data/lib/comet/models/partition_conflict.rb +1 -1
- data/lib/comet/models/pkcs_11allowed_driver.rb +75 -0
- data/lib/comet/models/pkcs_11allowlist_options.rb +90 -0
- data/lib/comet/models/policy_options.rb +1 -1
- data/lib/comet/models/postgre_sqlconnection.rb +151 -0
- data/lib/comet/models/private_branding_properties.rb +184 -1
- data/lib/comet/models/protected_item_engine_type_policy.rb +1 -1
- data/lib/comet/models/protected_item_with_backup_rules_response.rb +1 -1
- data/lib/comet/models/proxmox_connection.rb +1 -1
- data/lib/comet/models/proxmox_restore_target_options.rb +1 -1
- data/lib/comet/models/psaconfig.rb +26 -1
- data/lib/comet/models/psaconfig_connect_wise.rb +130 -0
- data/lib/comet/models/psagrouped_by.rb +1 -1
- data/lib/comet/models/public_branding_properties.rb +1 -1
- data/lib/comet/models/pvebackup_disk.rb +1 -1
- data/lib/comet/models/pvebackup_node.rb +1 -1
- data/lib/comet/models/pvebackup_vm.rb +1 -1
- data/lib/comet/models/pvedisk.rb +1 -1
- data/lib/comet/models/pveparams.rb +2 -4
- data/lib/comet/models/pvestorage_name.rb +17 -1
- data/lib/comet/models/pvevm.rb +8 -1
- data/lib/comet/models/ratelimit_options.rb +1 -1
- data/lib/comet/models/ratelimit_rule.rb +1 -1
- data/lib/comet/models/register_office_application_begin_response.rb +1 -1
- data/lib/comet/models/register_office_application_check_response.rb +1 -1
- data/lib/comet/models/registration_lobby_connection.rb +1 -1
- data/lib/comet/models/remote_server_address.rb +1 -1
- data/lib/comet/models/remote_storage_option.rb +10 -1
- data/lib/comet/models/replica_server.rb +1 -1
- data/lib/comet/models/replicator_state_apiresponse.rb +1 -1
- data/lib/comet/models/request_storage_vault_response_message.rb +1 -1
- data/lib/comet/models/restore_job_advanced_options.rb +66 -10
- data/lib/comet/models/retention_policy.rb +1 -1
- data/lib/comet/models/retention_range.rb +1 -1
- data/lib/comet/models/s3destination_location.rb +1 -1
- data/lib/comet/models/s3generic_virtual_storage_role.rb +1 -1
- data/lib/comet/models/schedule_config.rb +1 -1
- data/lib/comet/models/search_clause.rb +1 -1
- data/lib/comet/models/search_result_file_info.rb +1 -1
- data/lib/comet/models/search_snapshots_response.rb +1 -1
- data/lib/comet/models/self_backup_event_data.rb +135 -0
- data/lib/comet/models/self_backup_export_options.rb +1 -1
- data/lib/comet/models/self_backup_options.rb +1 -1
- data/lib/comet/models/self_backup_statistics.rb +1 -1
- data/lib/comet/models/self_backup_target.rb +1 -1
- data/lib/comet/models/server_config_options.rb +76 -1
- data/lib/comet/models/server_config_options_and_hash_response.rb +103 -0
- data/lib/comet/models/server_config_options_branding_fragment.rb +1 -1
- data/lib/comet/models/server_config_options_hash_response.rb +95 -0
- data/lib/comet/models/server_config_options_software_build_role_fragment.rb +1 -1
- data/lib/comet/models/server_meta_branding_properties.rb +20 -1
- data/lib/comet/models/server_meta_version_info.rb +1 -1
- data/lib/comet/models/session_key_regenerated_response.rb +1 -1
- data/lib/comet/models/session_options.rb +1 -1
- data/lib/comet/models/set_shared_storage_quota_response.rb +92 -0
- data/lib/comet/models/sftpdestination_location.rb +1 -1
- data/lib/comet/models/shared_storage_quota.rb +94 -0
- data/lib/comet/models/single_field_source.rb +2 -2
- data/lib/comet/models/size_measurement.rb +1 -1
- data/lib/comet/models/smbdestination_location.rb +1 -1
- data/lib/comet/models/smtpoauth_options.rb +154 -0
- data/lib/comet/models/software_build_role_options.rb +1 -1
- data/lib/comet/models/software_update_news_response.rb +1 -1
- data/lib/comet/models/source_basic_info.rb +10 -1
- data/lib/comet/models/source_config.rb +69 -4
- data/lib/comet/models/source_include_pattern.rb +1 -1
- data/lib/comet/models/source_statistics.rb +1 -1
- data/lib/comet/models/spanned_destination_location.rb +1 -1
- data/lib/comet/models/spanned_storage_extra_info.rb +1 -1
- data/lib/comet/models/speed_limit_time_window.rb +114 -0
- data/lib/comet/models/sshconnection.rb +1 -1
- data/lib/comet/models/stat_result.rb +1 -1
- data/lib/comet/models/storage_free_space_info.rb +1 -1
- data/lib/comet/models/storage_role_options.rb +1 -1
- data/lib/comet/models/storage_vault_provider_policy.rb +1 -1
- data/lib/comet/models/stored_object.rb +1 -1
- data/lib/comet/models/storj_destination_location.rb +1 -1
- data/lib/comet/models/storj_virtual_storage_role_setting.rb +1 -1
- data/lib/comet/models/streamable_event.rb +1 -1
- data/lib/comet/models/swift_destination_location.rb +1 -1
- data/lib/comet/models/test_response.rb +1 -1
- data/lib/comet/models/time_span.rb +1 -1
- data/lib/comet/models/totp_regenerated_response.rb +1 -1
- data/lib/comet/models/u2fregister_request.rb +1 -1
- data/lib/comet/models/u2fregistered_key.rb +1 -1
- data/lib/comet/models/u2fregistration_challenge_response.rb +1 -1
- data/lib/comet/models/u2fsign_request.rb +1 -1
- data/lib/comet/models/u2fsign_response.rb +1 -1
- data/lib/comet/models/uninstall_config.rb +1 -1
- data/lib/comet/models/update_campaign_device_status.rb +9 -1
- data/lib/comet/models/update_campaign_options.rb +1 -1
- data/lib/comet/models/update_campaign_properties.rb +1 -1
- data/lib/comet/models/update_campaign_skip_detail.rb +100 -0
- data/lib/comet/models/update_campaign_status.rb +1 -1
- data/lib/comet/models/update_campaign_status_device_entry.rb +9 -1
- data/lib/comet/models/user_custom_email_settings.rb +1 -1
- data/lib/comet/models/user_group.rb +1 -1
- data/lib/comet/models/user_on_server.rb +1 -1
- data/lib/comet/models/user_policy.rb +18 -1
- data/lib/comet/models/user_profile_config.rb +82 -8
- data/lib/comet/models/user_profile_fragment.rb +1 -1
- data/lib/comet/models/user_server_config.rb +1 -1
- data/lib/comet/models/vault_snapshot.rb +1 -1
- data/lib/comet/models/vmdisk_info.rb +1 -1
- data/lib/comet/models/vmdksnapshot_view_options.rb +1 -1
- data/lib/comet/models/vminfo.rb +1 -1
- data/lib/comet/models/vminfo_list.rb +1 -1
- data/lib/comet/models/vmware_connection.rb +1 -1
- data/lib/comet/models/vmware_datacenter_info.rb +1 -1
- data/lib/comet/models/vmware_datastore_info.rb +1 -1
- data/lib/comet/models/vmware_host_info.rb +1 -1
- data/lib/comet/models/vmware_machine_info.rb +1 -1
- data/lib/comet/models/vmware_network_info.rb +1 -1
- data/lib/comet/models/vmware_restore_target_options.rb +1 -1
- data/lib/comet/models/vsphere_connection.rb +1 -1
- data/lib/comet/models/vsscomponent.rb +1 -1
- data/lib/comet/models/vsswriter_info.rb +1 -1
- data/lib/comet/models/wasabi_virtual_storage_role_settings.rb +1 -1
- data/lib/comet/models/web_authn_authenticator_selection.rb +1 -1
- data/lib/comet/models/web_authn_credential.rb +1 -1
- data/lib/comet/models/web_authn_credential_assertion.rb +1 -1
- data/lib/comet/models/web_authn_credential_descriptor.rb +1 -1
- data/lib/comet/models/web_authn_credential_entity.rb +1 -1
- data/lib/comet/models/web_authn_credential_parameter.rb +1 -1
- data/lib/comet/models/web_authn_public_key_credential_creation_options.rb +2 -4
- data/lib/comet/models/web_authn_public_key_credential_request_options.rb +1 -1
- data/lib/comet/models/web_authn_registration_challenge_response.rb +1 -1
- data/lib/comet/models/web_authn_relying_party_entity.rb +1 -1
- data/lib/comet/models/web_authn_sign_request.rb +1 -1
- data/lib/comet/models/web_authn_sign_response.rb +1 -1
- data/lib/comet/models/web_authn_user_entity.rb +1 -1
- data/lib/comet/models/web_dav_destination_location.rb +1 -1
- data/lib/comet/models/web_interface_branding_properties.rb +1 -1
- data/lib/comet/models/webhook_awsoptions.rb +96 -0
- data/lib/comet/models/webhook_option.rb +49 -2
- data/lib/comet/models/win_smbauth.rb +3 -3
- data/lib/comet/models/windows_code_sign_properties.rb +176 -1
- data/lib/comet_backup_ruby_sdk.rb +39 -1
- metadata +43 -23
- data/Gemfile.lock +0 -43
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# NinjaOneAuthCallbackResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class NinjaOneAuthCallbackResponse
|
|
14
|
+
|
|
15
|
+
# @type [String] refresh_token
|
|
16
|
+
attr_accessor :refresh_token
|
|
17
|
+
|
|
18
|
+
# @type [Number] refresh_token_format
|
|
19
|
+
attr_accessor :refresh_token_format
|
|
20
|
+
|
|
21
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
22
|
+
attr_accessor :unknown_json_fields
|
|
23
|
+
|
|
24
|
+
def initialize
|
|
25
|
+
clear
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def clear
|
|
29
|
+
@refresh_token = ''
|
|
30
|
+
@refresh_token_format = 0
|
|
31
|
+
@unknown_json_fields = {}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @param [String] json_string The complete object in JSON format
|
|
35
|
+
def from_json(json_string)
|
|
36
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
37
|
+
|
|
38
|
+
from_hash(JSON.parse(json_string))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
42
|
+
def from_hash(obj)
|
|
43
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
44
|
+
|
|
45
|
+
obj.each do |k, v|
|
|
46
|
+
case k
|
|
47
|
+
when 'RefreshToken'
|
|
48
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
49
|
+
|
|
50
|
+
@refresh_token = v
|
|
51
|
+
when 'RefreshTokenFormat'
|
|
52
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
53
|
+
|
|
54
|
+
@refresh_token_format = v
|
|
55
|
+
else
|
|
56
|
+
@unknown_json_fields[k] = v
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
62
|
+
def to_hash
|
|
63
|
+
ret = {}
|
|
64
|
+
ret['RefreshToken'] = @refresh_token
|
|
65
|
+
ret['RefreshTokenFormat'] = @refresh_token_format
|
|
66
|
+
@unknown_json_fields.each do |k, v|
|
|
67
|
+
ret[k] = v
|
|
68
|
+
end
|
|
69
|
+
ret
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
73
|
+
def to_h
|
|
74
|
+
to_hash
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# @return [String] The complete object as a JSON string
|
|
78
|
+
def to_json(options = {})
|
|
79
|
+
to_hash.to_json(options)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# NinjaOneConfig is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class NinjaOneConfig
|
|
14
|
+
|
|
15
|
+
# OAuth 2.0 Client ID for NinjaOne API
|
|
16
|
+
# @type [String] client_id
|
|
17
|
+
attr_accessor :client_id
|
|
18
|
+
|
|
19
|
+
# OAuth 2.0 Client Secret for NinjaOne API
|
|
20
|
+
# @type [String] client_secret
|
|
21
|
+
attr_accessor :client_secret
|
|
22
|
+
|
|
23
|
+
# @type [String] refresh_token
|
|
24
|
+
attr_accessor :refresh_token
|
|
25
|
+
|
|
26
|
+
# One of the ENCRYPTIONMETHOD_ constants
|
|
27
|
+
# @type [Number] refresh_token_format
|
|
28
|
+
attr_accessor :refresh_token_format
|
|
29
|
+
|
|
30
|
+
# Whether to create and manage tickets in NinjaOne for backup failures
|
|
31
|
+
# @type [Boolean] tickets_enabled
|
|
32
|
+
attr_accessor :tickets_enabled
|
|
33
|
+
|
|
34
|
+
# NinjaOne client (organization) ID. Required when tickets are enabled.
|
|
35
|
+
# @type [Number] ninja_client_id
|
|
36
|
+
attr_accessor :ninja_client_id
|
|
37
|
+
|
|
38
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
39
|
+
attr_accessor :unknown_json_fields
|
|
40
|
+
|
|
41
|
+
def initialize
|
|
42
|
+
clear
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def clear
|
|
46
|
+
@client_id = ''
|
|
47
|
+
@client_secret = ''
|
|
48
|
+
@refresh_token = ''
|
|
49
|
+
@refresh_token_format = 0
|
|
50
|
+
@ninja_client_id = 0
|
|
51
|
+
@unknown_json_fields = {}
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @param [String] json_string The complete object in JSON format
|
|
55
|
+
def from_json(json_string)
|
|
56
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
57
|
+
|
|
58
|
+
from_hash(JSON.parse(json_string))
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
62
|
+
def from_hash(obj)
|
|
63
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
64
|
+
|
|
65
|
+
obj.each do |k, v|
|
|
66
|
+
case k
|
|
67
|
+
when 'ClientID'
|
|
68
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
69
|
+
|
|
70
|
+
@client_id = v
|
|
71
|
+
when 'ClientSecret'
|
|
72
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
73
|
+
|
|
74
|
+
@client_secret = v
|
|
75
|
+
when 'RefreshToken'
|
|
76
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
77
|
+
|
|
78
|
+
@refresh_token = v
|
|
79
|
+
when 'RefreshTokenFormat'
|
|
80
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
81
|
+
|
|
82
|
+
@refresh_token_format = v
|
|
83
|
+
when 'TicketsEnabled'
|
|
84
|
+
@tickets_enabled = v
|
|
85
|
+
when 'NinjaClientID'
|
|
86
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
87
|
+
|
|
88
|
+
@ninja_client_id = v
|
|
89
|
+
else
|
|
90
|
+
@unknown_json_fields[k] = v
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
96
|
+
def to_hash
|
|
97
|
+
ret = {}
|
|
98
|
+
unless @client_id.nil?
|
|
99
|
+
ret['ClientID'] = @client_id
|
|
100
|
+
end
|
|
101
|
+
unless @client_secret.nil?
|
|
102
|
+
ret['ClientSecret'] = @client_secret
|
|
103
|
+
end
|
|
104
|
+
unless @refresh_token.nil?
|
|
105
|
+
ret['RefreshToken'] = @refresh_token
|
|
106
|
+
end
|
|
107
|
+
unless @refresh_token_format.nil?
|
|
108
|
+
ret['RefreshTokenFormat'] = @refresh_token_format
|
|
109
|
+
end
|
|
110
|
+
ret['TicketsEnabled'] = @tickets_enabled
|
|
111
|
+
unless @ninja_client_id.nil?
|
|
112
|
+
ret['NinjaClientID'] = @ninja_client_id
|
|
113
|
+
end
|
|
114
|
+
@unknown_json_fields.each do |k, v|
|
|
115
|
+
ret[k] = v
|
|
116
|
+
end
|
|
117
|
+
ret
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
121
|
+
def to_h
|
|
122
|
+
to_hash
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# @return [String] The complete object as a JSON string
|
|
126
|
+
def to_json(options = {})
|
|
127
|
+
to_hash.to_json(options)
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# NinjaOneOrganization is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
class NinjaOneOrganization
|
|
14
|
+
|
|
15
|
+
# @type [Number] id
|
|
16
|
+
attr_accessor :id
|
|
17
|
+
|
|
18
|
+
# @type [String] name
|
|
19
|
+
attr_accessor :name
|
|
20
|
+
|
|
21
|
+
# @type [String] description
|
|
22
|
+
attr_accessor :description
|
|
23
|
+
|
|
24
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
25
|
+
attr_accessor :unknown_json_fields
|
|
26
|
+
|
|
27
|
+
def initialize
|
|
28
|
+
clear
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def clear
|
|
32
|
+
@id = 0
|
|
33
|
+
@name = ''
|
|
34
|
+
@description = ''
|
|
35
|
+
@unknown_json_fields = {}
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# @param [String] json_string The complete object in JSON format
|
|
39
|
+
def from_json(json_string)
|
|
40
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
41
|
+
|
|
42
|
+
from_hash(JSON.parse(json_string))
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
46
|
+
def from_hash(obj)
|
|
47
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
48
|
+
|
|
49
|
+
obj.each do |k, v|
|
|
50
|
+
case k
|
|
51
|
+
when 'ID'
|
|
52
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
53
|
+
|
|
54
|
+
@id = v
|
|
55
|
+
when 'Name'
|
|
56
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
57
|
+
|
|
58
|
+
@name = v
|
|
59
|
+
when 'Description'
|
|
60
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
61
|
+
|
|
62
|
+
@description = v
|
|
63
|
+
else
|
|
64
|
+
@unknown_json_fields[k] = v
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
70
|
+
def to_hash
|
|
71
|
+
ret = {}
|
|
72
|
+
ret['ID'] = @id
|
|
73
|
+
ret['Name'] = @name
|
|
74
|
+
ret['Description'] = @description
|
|
75
|
+
@unknown_json_fields.each do |k, v|
|
|
76
|
+
ret[k] = v
|
|
77
|
+
end
|
|
78
|
+
ret
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
82
|
+
def to_h
|
|
83
|
+
to_hash
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @return [String] The complete object as a JSON string
|
|
87
|
+
def to_json(options = {})
|
|
88
|
+
to_hash.to_json(options)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# Node is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# Node contains the name and online status of a Proxmox node
|
|
14
|
+
class Node
|
|
15
|
+
|
|
16
|
+
# @type [String] name
|
|
17
|
+
attr_accessor :name
|
|
18
|
+
|
|
19
|
+
# @type [Boolean] is_available
|
|
20
|
+
attr_accessor :is_available
|
|
21
|
+
|
|
22
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
23
|
+
attr_accessor :unknown_json_fields
|
|
24
|
+
|
|
25
|
+
def initialize
|
|
26
|
+
clear
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def clear
|
|
30
|
+
@name = ''
|
|
31
|
+
@unknown_json_fields = {}
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# @param [String] json_string The complete object in JSON format
|
|
35
|
+
def from_json(json_string)
|
|
36
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
37
|
+
|
|
38
|
+
from_hash(JSON.parse(json_string))
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
42
|
+
def from_hash(obj)
|
|
43
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
44
|
+
|
|
45
|
+
obj.each do |k, v|
|
|
46
|
+
case k
|
|
47
|
+
when 'Name'
|
|
48
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
49
|
+
|
|
50
|
+
@name = v
|
|
51
|
+
when 'IsAvailable'
|
|
52
|
+
@is_available = v
|
|
53
|
+
else
|
|
54
|
+
@unknown_json_fields[k] = v
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
60
|
+
def to_hash
|
|
61
|
+
ret = {}
|
|
62
|
+
ret['Name'] = @name
|
|
63
|
+
ret['IsAvailable'] = @is_available
|
|
64
|
+
@unknown_json_fields.each do |k, v|
|
|
65
|
+
ret[k] = v
|
|
66
|
+
end
|
|
67
|
+
ret
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
71
|
+
def to_h
|
|
72
|
+
to_hash
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @return [String] The complete object as a JSON string
|
|
76
|
+
def to_json(options = {})
|
|
77
|
+
to_hash.to_json(options)
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# Office365ConvertSelectionResponse is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# Office365ConvertSelectionResponse contains the ordered rule list produced by
|
|
14
|
+
# converting a legacy Office 365 selection.
|
|
15
|
+
# This type is available in Comet 26.8.1 and later.
|
|
16
|
+
class Office365ConvertSelectionResponse
|
|
17
|
+
|
|
18
|
+
# If the operation was successful, the status will be in the 200-299 range.
|
|
19
|
+
# @type [Number] status
|
|
20
|
+
attr_accessor :status
|
|
21
|
+
|
|
22
|
+
# @type [String] message
|
|
23
|
+
attr_accessor :message
|
|
24
|
+
|
|
25
|
+
# The converted ordered rule list, equivalent to the legacy selection
|
|
26
|
+
# @type [Array<Comet::Office365SelectionRule>] rules
|
|
27
|
+
attr_accessor :rules
|
|
28
|
+
|
|
29
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
30
|
+
attr_accessor :unknown_json_fields
|
|
31
|
+
|
|
32
|
+
def initialize
|
|
33
|
+
clear
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def clear
|
|
37
|
+
@status = 0
|
|
38
|
+
@message = ''
|
|
39
|
+
@rules = []
|
|
40
|
+
@unknown_json_fields = {}
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# @param [String] json_string The complete object in JSON format
|
|
44
|
+
def from_json(json_string)
|
|
45
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
46
|
+
|
|
47
|
+
from_hash(JSON.parse(json_string))
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
51
|
+
def from_hash(obj)
|
|
52
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
53
|
+
|
|
54
|
+
obj.each do |k, v|
|
|
55
|
+
case k
|
|
56
|
+
when 'Status'
|
|
57
|
+
raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric
|
|
58
|
+
|
|
59
|
+
@status = v
|
|
60
|
+
when 'Message'
|
|
61
|
+
raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String
|
|
62
|
+
|
|
63
|
+
@message = v
|
|
64
|
+
when 'Rules'
|
|
65
|
+
if v.nil?
|
|
66
|
+
@rules = []
|
|
67
|
+
else
|
|
68
|
+
@rules = Array.new(v.length)
|
|
69
|
+
v.each_with_index do |v1, i1|
|
|
70
|
+
@rules[i1] = Comet::Office365SelectionRule.new
|
|
71
|
+
@rules[i1].from_hash(v1)
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
else
|
|
75
|
+
@unknown_json_fields[k] = v
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
81
|
+
def to_hash
|
|
82
|
+
ret = {}
|
|
83
|
+
ret['Status'] = @status
|
|
84
|
+
ret['Message'] = @message
|
|
85
|
+
ret['Rules'] = @rules
|
|
86
|
+
@unknown_json_fields.each do |k, v|
|
|
87
|
+
ret[k] = v
|
|
88
|
+
end
|
|
89
|
+
ret
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
93
|
+
def to_h
|
|
94
|
+
to_hash
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
# @return [String] The complete object as a JSON string
|
|
98
|
+
def to_json(options = {})
|
|
99
|
+
to_hash.to_json(options)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
# Copyright (c) 2020-
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
4
|
# Please see the LICENSE file for usage information.
|
|
5
5
|
#
|
|
6
6
|
# SPDX-License-Identifier: MIT
|
|
@@ -48,6 +48,14 @@ module Comet
|
|
|
48
48
|
# @type [Hash{String => Number}] filter_member_options
|
|
49
49
|
attr_accessor :filter_member_options
|
|
50
50
|
|
|
51
|
+
# An ordered list of include/exclude rules. If this field is non-empty, it is the
|
|
52
|
+
# sole source of truth for account and service selection, and the Organization, FilterMode,
|
|
53
|
+
# WholeOrg, BackupOptions, MemberBackupOptions, FilterOptions and FilterMemberOptions fields are
|
|
54
|
+
# all ignored. If empty or omitted, behavior is identical to prior Comet versions.
|
|
55
|
+
# This field is available in Comet 26.8.1 and later.
|
|
56
|
+
# @type [Array<Comet::Office365SelectionRule>] rules
|
|
57
|
+
attr_accessor :rules
|
|
58
|
+
|
|
51
59
|
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
52
60
|
attr_accessor :unknown_json_fields
|
|
53
61
|
|
|
@@ -60,6 +68,7 @@ module Comet
|
|
|
60
68
|
@member_backup_options = {}
|
|
61
69
|
@filter_options = {}
|
|
62
70
|
@filter_member_options = {}
|
|
71
|
+
@rules = []
|
|
63
72
|
@unknown_json_fields = {}
|
|
64
73
|
end
|
|
65
74
|
|
|
@@ -126,6 +135,16 @@ module Comet
|
|
|
126
135
|
@filter_member_options[k1] = v1
|
|
127
136
|
end
|
|
128
137
|
end
|
|
138
|
+
when 'Rules'
|
|
139
|
+
if v.nil?
|
|
140
|
+
@rules = []
|
|
141
|
+
else
|
|
142
|
+
@rules = Array.new(v.length)
|
|
143
|
+
v.each_with_index do |v1, i1|
|
|
144
|
+
@rules[i1] = Comet::Office365SelectionRule.new
|
|
145
|
+
@rules[i1].from_hash(v1)
|
|
146
|
+
end
|
|
147
|
+
end
|
|
129
148
|
else
|
|
130
149
|
@unknown_json_fields[k] = v
|
|
131
150
|
end
|
|
@@ -154,6 +173,9 @@ module Comet
|
|
|
154
173
|
unless @filter_member_options.nil?
|
|
155
174
|
ret['FilterMemberOptions'] = @filter_member_options
|
|
156
175
|
end
|
|
176
|
+
unless @rules.nil?
|
|
177
|
+
ret['Rules'] = @rules
|
|
178
|
+
end
|
|
157
179
|
@unknown_json_fields.each do |k, v|
|
|
158
180
|
ret[k] = v
|
|
159
181
|
end
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Copyright (c) 2020-2026 Comet Licensing Ltd.
|
|
4
|
+
# Please see the LICENSE file for usage information.
|
|
5
|
+
#
|
|
6
|
+
# SPDX-License-Identifier: MIT
|
|
7
|
+
|
|
8
|
+
require 'json'
|
|
9
|
+
|
|
10
|
+
module Comet
|
|
11
|
+
|
|
12
|
+
# Office365EffectiveSelection is a typed class wrapper around the underlying Comet Server API data structure.
|
|
13
|
+
# Office365EffectiveSelection is the full result of evaluating an ordered rule list
|
|
14
|
+
# against an organization's accounts, including per-service rule attribution for
|
|
15
|
+
# display purposes.
|
|
16
|
+
# This type is available in Comet 26.8.1 and later.
|
|
17
|
+
class Office365EffectiveSelection
|
|
18
|
+
|
|
19
|
+
# The effective selection for every account in the organization, keyed by
|
|
20
|
+
# account ID. Accounts with no matching rules are present with a zero
|
|
21
|
+
# ServiceMask.
|
|
22
|
+
# @type [Hash{String => Comet::Office365EffectiveSelectionAccount}] accounts
|
|
23
|
+
attr_accessor :accounts
|
|
24
|
+
|
|
25
|
+
# Indexes (into the evaluated rule list) of rules that are the final decider of
|
|
26
|
+
# at least one (account, service) pair. A rule index absent from this list is
|
|
27
|
+
# fully overridden by later rules (or matches nothing) and has no effect.
|
|
28
|
+
# @type [Array<Number>] effective_rule_indexes
|
|
29
|
+
attr_accessor :effective_rule_indexes
|
|
30
|
+
|
|
31
|
+
# @type [Hash] Hidden storage to preserve future properties for non-destructive roundtrip operations
|
|
32
|
+
attr_accessor :unknown_json_fields
|
|
33
|
+
|
|
34
|
+
def initialize
|
|
35
|
+
clear
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def clear
|
|
39
|
+
@accounts = {}
|
|
40
|
+
@effective_rule_indexes = []
|
|
41
|
+
@unknown_json_fields = {}
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# @param [String] json_string The complete object in JSON format
|
|
45
|
+
def from_json(json_string)
|
|
46
|
+
raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String
|
|
47
|
+
|
|
48
|
+
from_hash(JSON.parse(json_string))
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# @param [Hash] obj The complete object as a Ruby hash
|
|
52
|
+
def from_hash(obj)
|
|
53
|
+
raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash
|
|
54
|
+
|
|
55
|
+
obj.each do |k, v|
|
|
56
|
+
case k
|
|
57
|
+
when 'Accounts'
|
|
58
|
+
@accounts = {}
|
|
59
|
+
if v.nil?
|
|
60
|
+
@accounts = {}
|
|
61
|
+
else
|
|
62
|
+
v.each do |k1, v1|
|
|
63
|
+
@accounts[k1] = Comet::Office365EffectiveSelectionAccount.new
|
|
64
|
+
@accounts[k1].from_hash(v1)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
when 'EffectiveRuleIndexes'
|
|
68
|
+
if v.nil?
|
|
69
|
+
@effective_rule_indexes = []
|
|
70
|
+
else
|
|
71
|
+
@effective_rule_indexes = Array.new(v.length)
|
|
72
|
+
v.each_with_index do |v1, i1|
|
|
73
|
+
raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric
|
|
74
|
+
|
|
75
|
+
@effective_rule_indexes[i1] = v1
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
else
|
|
79
|
+
@unknown_json_fields[k] = v
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
85
|
+
def to_hash
|
|
86
|
+
ret = {}
|
|
87
|
+
unless @accounts.nil?
|
|
88
|
+
ret['Accounts'] = @accounts
|
|
89
|
+
end
|
|
90
|
+
unless @effective_rule_indexes.nil?
|
|
91
|
+
ret['EffectiveRuleIndexes'] = @effective_rule_indexes
|
|
92
|
+
end
|
|
93
|
+
@unknown_json_fields.each do |k, v|
|
|
94
|
+
ret[k] = v
|
|
95
|
+
end
|
|
96
|
+
ret
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# @return [Hash] The complete object as a Ruby hash
|
|
100
|
+
def to_h
|
|
101
|
+
to_hash
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
# @return [String] The complete object as a JSON string
|
|
105
|
+
def to_json(options = {})
|
|
106
|
+
to_hash.to_json(options)
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
end
|