class Comet::UserPolicy
UserPolicy is a typed class wrapper around the underlying Comet Server API data structure.
def clear
def clear @storage_vault_providers = Comet::StorageVaultProviderPolicy.new @protected_item_engine_types = Comet::ProtectedItemEngineTypePolicy.new @file_and_folder_mandatory_exclusions = [] @mode_schedule_skip_already_running = 0 @mode_admin_reset_password = 0 @mode_admin_view_filenames = 0 @mode_require_user_reset_password = 0 @default_email_reports = Comet::DefaultEmailReportPolicy.new @default_storage_vault_retention = Comet::RetentionPolicy.new @default_sources = {} @default_sources_backup_rules = {} @default_sources_with_osrestriction = {} @default_backup_rules = {} @random_delay_secs = 0 @unknown_json_fields = {} end
def from_hash(obj)
-
obj
(Hash
) -- The complete object as a Ruby hash
def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'PreventRequestStorageVault' @prevent_request_storage_vault = v when 'PreventAddCustomStorageVault' @prevent_add_custom_storage_vault = v when 'PreventEditStorageVault' @prevent_edit_storage_vault = v when 'HideCloudStorageBranding' @hide_cloud_storage_branding = v when 'PreventDeleteStorageVault' @prevent_delete_storage_vault = v when 'StorageVaultProviders' @storage_vault_providers = Comet::StorageVaultProviderPolicy.new @storage_vault_providers.from_hash(v) when 'PreventNewProtectedItem' @prevent_new_protected_item = v when 'PreventEditProtectedItem' @prevent_edit_protected_item = v when 'PreventDeleteProtectedItem' @prevent_delete_protected_item = v when 'ProtectedItemEngineTypes' @protected_item_engine_types = Comet::ProtectedItemEngineTypePolicy.new @protected_item_engine_types.from_hash(v) when 'FileAndFolderMandatoryExclusions' if v.nil? @file_and_folder_mandatory_exclusions = [] else @file_and_folder_mandatory_exclusions = Array.new(v.length) v.each_with_index do |v1, i1| @file_and_folder_mandatory_exclusions[i1] = Comet::ExtraFileExclusion.new @file_and_folder_mandatory_exclusions[i1].from_hash(v1) end end when 'ModeScheduleSkipAlreadyRunning' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @mode_schedule_skip_already_running = v when 'ModeAdminResetPassword' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @mode_admin_reset_password = v when 'ModeAdminViewFilenames' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @mode_admin_view_filenames = v when 'ModeRequireUserResetPassword' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @mode_require_user_reset_password = v when 'PreventDeleteSingleSnapshots' @prevent_delete_single_snapshots = v when 'PreventChangeAccountPassword' @prevent_change_account_password = v when 'PreventChangeEmailSettings' @prevent_change_email_settings = v when 'PreventChangeAccountName' @prevent_change_account_name = v when 'PreventOpenAppUI' @prevent_open_app_ui = v when 'RequirePasswordOpenAppUI' @require_password_open_app_ui = v when 'HideAppImport' @hide_app_import = v when 'HideAppVersion' @hide_app_version = v when 'PreventOpenWebUI' @prevent_open_web_ui = v when 'PreventViewDeviceNames' @prevent_view_device_names = v when 'DefaultEmailReports' @default_email_reports = Comet::DefaultEmailReportPolicy.new @default_email_reports.from_hash(v) when 'DefaultStorageVaultRetention' @default_storage_vault_retention = Comet::RetentionPolicy.new @default_storage_vault_retention.from_hash(v) when 'EnforceStorageVaultRetention' @enforce_storage_vault_retention = v when 'PreventProtectedItemRetention' @prevent_protected_item_retention = v when 'AllowEditObjectLockRetention' @allow_edit_object_lock_retention = v when 'DefaultSources' @default_sources = {} if v.nil? @default_sources = {} else v.each do |k1, v1| @default_sources[k1] = Comet::SourceConfig.new @default_sources[k1].from_hash(v1) end end when 'DefaultSourcesBackupRules' @default_sources_backup_rules = {} if v.nil? @default_sources_backup_rules = {} else v.each do |k1, v1| @default_sources_backup_rules[k1] = Comet::BackupRuleConfig.new @default_sources_backup_rules[k1].from_hash(v1) end end when 'DefaultSourcesWithOSRestriction' @default_sources_with_osrestriction = {} if v.nil? @default_sources_with_osrestriction = {} else v.each do |k1, v1| @default_sources_with_osrestriction[k1] = Comet::DefaultSourceWithOSRestriction.new @default_sources_with_osrestriction[k1].from_hash(v1) end end when 'DefaultBackupRules' @default_backup_rules = {} if v.nil? @default_backup_rules = {} else v.each do |k1, v1| @default_backup_rules[k1] = Comet::BackupRuleConfig.new @default_backup_rules[k1].from_hash(v1) end end when 'RandomDelaySecs' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @random_delay_secs = v else @unknown_json_fields[k] = v end end end
def from_json(json_string)
-
json_string
(String
) -- The complete object in JSON format
def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end
def initialize
def initialize clear end
def to_h
-
(Hash)
- The complete object as a Ruby hash
def to_h to_hash end
def to_hash
-
(Hash)
- The complete object as a Ruby hash
def to_hash ret = {} ret['PreventRequestStorageVault'] = @prevent_request_storage_vault ret['PreventAddCustomStorageVault'] = @prevent_add_custom_storage_vault ret['PreventEditStorageVault'] = @prevent_edit_storage_vault ret['HideCloudStorageBranding'] = @hide_cloud_storage_branding ret['PreventDeleteStorageVault'] = @prevent_delete_storage_vault ret['StorageVaultProviders'] = @storage_vault_providers ret['PreventNewProtectedItem'] = @prevent_new_protected_item ret['PreventEditProtectedItem'] = @prevent_edit_protected_item ret['PreventDeleteProtectedItem'] = @prevent_delete_protected_item ret['ProtectedItemEngineTypes'] = @protected_item_engine_types unless @file_and_folder_mandatory_exclusions.nil? ret['FileAndFolderMandatoryExclusions'] = @file_and_folder_mandatory_exclusions end unless @mode_schedule_skip_already_running.nil? ret['ModeScheduleSkipAlreadyRunning'] = @mode_schedule_skip_already_running end unless @mode_admin_reset_password.nil? ret['ModeAdminResetPassword'] = @mode_admin_reset_password end unless @mode_admin_view_filenames.nil? ret['ModeAdminViewFilenames'] = @mode_admin_view_filenames end unless @mode_require_user_reset_password.nil? ret['ModeRequireUserResetPassword'] = @mode_require_user_reset_password end ret['PreventDeleteSingleSnapshots'] = @prevent_delete_single_snapshots ret['PreventChangeAccountPassword'] = @prevent_change_account_password ret['PreventChangeEmailSettings'] = @prevent_change_email_settings ret['PreventChangeAccountName'] = @prevent_change_account_name ret['PreventOpenAppUI'] = @prevent_open_app_ui ret['RequirePasswordOpenAppUI'] = @require_password_open_app_ui ret['HideAppImport'] = @hide_app_import ret['HideAppVersion'] = @hide_app_version ret['PreventOpenWebUI'] = @prevent_open_web_ui ret['PreventViewDeviceNames'] = @prevent_view_device_names ret['DefaultEmailReports'] = @default_email_reports ret['DefaultStorageVaultRetention'] = @default_storage_vault_retention ret['EnforceStorageVaultRetention'] = @enforce_storage_vault_retention ret['PreventProtectedItemRetention'] = @prevent_protected_item_retention ret['AllowEditObjectLockRetention'] = @allow_edit_object_lock_retention ret['DefaultSources'] = @default_sources ret['DefaultSourcesBackupRules'] = @default_sources_backup_rules ret['DefaultSourcesWithOSRestriction'] = @default_sources_with_osrestriction ret['DefaultBackupRules'] = @default_backup_rules unless @random_delay_secs.nil? ret['RandomDelaySecs'] = @random_delay_secs end @unknown_json_fields.each do |k, v| ret[k] = v end ret end
def to_json(options = {})
-
(String)
- The complete object as a JSON string
def to_json(options = {}) to_hash.to_json(options) end