Class: Comet::AuthenticationRoleOptions
- Inherits:
-
Object
- Object
- Comet::AuthenticationRoleOptions
- Defined in:
- lib/comet/models/authentication_role_options.rb
Overview
AuthenticationRoleOptions is a typed class wrapper around the underlying Comet Server API data structure.
Instance Attribute Summary collapse
-
#database_check_level ⇒ Object
One of the INTEGRITYCHECK_ constants.
-
#generate_missed_backup_events ⇒ Object
Returns the value of attribute generate_missed_backup_events.
-
#generate_scheduled_emails ⇒ Object
Returns the value of attribute generate_scheduled_emails.
-
#global_overrides ⇒ Object
Returns the value of attribute global_overrides.
-
#no_missed_backup_events_before ⇒ Object
Unix timestamp in seconds, before which no Missed jobs are created.
-
#prune_logs_after_days ⇒ Object
Returns the value of attribute prune_logs_after_days.
-
#remote_storage ⇒ Object
Returns the value of attribute remote_storage.
-
#replicate_to ⇒ Object
Returns the value of attribute replicate_to.
-
#role_enabled ⇒ Object
Returns the value of attribute role_enabled.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ AuthenticationRoleOptions
constructor
A new instance of AuthenticationRoleOptions.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ AuthenticationRoleOptions
Returns a new instance of AuthenticationRoleOptions.
47 48 49 |
# File 'lib/comet/models/authentication_role_options.rb', line 47 def initialize clear end |
Instance Attribute Details
#database_check_level ⇒ Object
One of the INTEGRITYCHECK_ constants
20 21 22 |
# File 'lib/comet/models/authentication_role_options.rb', line 20 def database_check_level @database_check_level end |
#generate_missed_backup_events ⇒ Object
Returns the value of attribute generate_missed_backup_events.
23 24 25 |
# File 'lib/comet/models/authentication_role_options.rb', line 23 def generate_missed_backup_events @generate_missed_backup_events end |
#generate_scheduled_emails ⇒ Object
Returns the value of attribute generate_scheduled_emails.
30 31 32 |
# File 'lib/comet/models/authentication_role_options.rb', line 30 def generate_scheduled_emails @generate_scheduled_emails end |
#global_overrides ⇒ Object
Returns the value of attribute global_overrides.
42 43 44 |
# File 'lib/comet/models/authentication_role_options.rb', line 42 def global_overrides @global_overrides end |
#no_missed_backup_events_before ⇒ Object
Unix timestamp in seconds, before which no Missed jobs are created
27 28 29 |
# File 'lib/comet/models/authentication_role_options.rb', line 27 def no_missed_backup_events_before @no_missed_backup_events_before end |
#prune_logs_after_days ⇒ Object
Returns the value of attribute prune_logs_after_days.
33 34 35 |
# File 'lib/comet/models/authentication_role_options.rb', line 33 def prune_logs_after_days @prune_logs_after_days end |
#remote_storage ⇒ Object
Returns the value of attribute remote_storage.
36 37 38 |
# File 'lib/comet/models/authentication_role_options.rb', line 36 def remote_storage @remote_storage end |
#replicate_to ⇒ Object
Returns the value of attribute replicate_to.
39 40 41 |
# File 'lib/comet/models/authentication_role_options.rb', line 39 def replicate_to @replicate_to end |
#role_enabled ⇒ Object
Returns the value of attribute role_enabled.
16 17 18 |
# File 'lib/comet/models/authentication_role_options.rb', line 16 def role_enabled @role_enabled end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
45 46 47 |
# File 'lib/comet/models/authentication_role_options.rb', line 45 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'lib/comet/models/authentication_role_options.rb', line 51 def clear @database_check_level = 0 @no_missed_backup_events_before = 0 @prune_logs_after_days = 0 @remote_storage = [] @replicate_to = [] @global_overrides = Comet::GlobalOverrideOptions.new @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/comet/models/authentication_role_options.rb', line 69 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 'RoleEnabled' @role_enabled = v when 'DatabaseCheckLevel' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @database_check_level = v when 'GenerateMissedBackupEvents' @generate_missed_backup_events = v when 'NoMissedBackupEventsBefore' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @no_missed_backup_events_before = v when 'GenerateScheduledEmails' @generate_scheduled_emails = v when 'PruneLogsAfterDays' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @prune_logs_after_days = v when 'RemoteStorage' if v.nil? @remote_storage = [] else @remote_storage = Array.new(v.length) v.each_with_index do |v1, i1| @remote_storage[i1] = Comet::RemoteStorageOption.new @remote_storage[i1].from_hash(v1) end end when 'ReplicateTo' if v.nil? @replicate_to = [] else @replicate_to = Array.new(v.length) v.each_with_index do |v1, i1| @replicate_to[i1] = Comet::ReplicaServer.new @replicate_to[i1].from_hash(v1) end end when 'GlobalOverrides' @global_overrides = Comet::GlobalOverrideOptions.new @global_overrides.from_hash(v) else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
62 63 64 65 66 |
# File 'lib/comet/models/authentication_role_options.rb', line 62 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 |
#to_h ⇒ Hash
Returns The complete object as a Ruby hash.
142 143 144 |
# File 'lib/comet/models/authentication_role_options.rb', line 142 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/comet/models/authentication_role_options.rb', line 122 def to_hash ret = {} ret['RoleEnabled'] = @role_enabled ret['DatabaseCheckLevel'] = @database_check_level ret['GenerateMissedBackupEvents'] = @generate_missed_backup_events ret['NoMissedBackupEventsBefore'] = @no_missed_backup_events_before ret['GenerateScheduledEmails'] = @generate_scheduled_emails ret['PruneLogsAfterDays'] = @prune_logs_after_days ret['RemoteStorage'] = @remote_storage ret['ReplicateTo'] = @replicate_to unless @global_overrides.nil? ret['GlobalOverrides'] = @global_overrides end @unknown_json_fields.each do |k, v| ret[k] = v end ret end |
#to_json(options = {}) ⇒ String
Returns The complete object as a JSON string.
147 148 149 |
# File 'lib/comet/models/authentication_role_options.rb', line 147 def to_json( = {}) to_hash.to_json() end |