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
Returns the value of attribute database_check_level.
-
#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
Returns the value of attribute no_missed_backup_events_before.
-
#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.
45 46 47 |
# File 'lib/comet/models/authentication_role_options.rb', line 45 def initialize clear end |
Instance Attribute Details
#database_check_level ⇒ Object
Returns the value of attribute database_check_level.
19 20 21 |
# File 'lib/comet/models/authentication_role_options.rb', line 19 def database_check_level @database_check_level end |
#generate_missed_backup_events ⇒ Object
Returns the value of attribute generate_missed_backup_events.
22 23 24 |
# File 'lib/comet/models/authentication_role_options.rb', line 22 def generate_missed_backup_events @generate_missed_backup_events end |
#generate_scheduled_emails ⇒ Object
Returns the value of attribute generate_scheduled_emails.
28 29 30 |
# File 'lib/comet/models/authentication_role_options.rb', line 28 def generate_scheduled_emails @generate_scheduled_emails end |
#global_overrides ⇒ Object
Returns the value of attribute global_overrides.
40 41 42 |
# File 'lib/comet/models/authentication_role_options.rb', line 40 def global_overrides @global_overrides end |
#no_missed_backup_events_before ⇒ Object
Returns the value of attribute no_missed_backup_events_before.
25 26 27 |
# File 'lib/comet/models/authentication_role_options.rb', line 25 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.
31 32 33 |
# File 'lib/comet/models/authentication_role_options.rb', line 31 def prune_logs_after_days @prune_logs_after_days end |
#remote_storage ⇒ Object
Returns the value of attribute remote_storage.
34 35 36 |
# File 'lib/comet/models/authentication_role_options.rb', line 34 def remote_storage @remote_storage end |
#replicate_to ⇒ Object
Returns the value of attribute replicate_to.
37 38 39 |
# File 'lib/comet/models/authentication_role_options.rb', line 37 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.
43 44 45 |
# File 'lib/comet/models/authentication_role_options.rb', line 43 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/comet/models/authentication_role_options.rb', line 49 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
67 68 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 |
# File 'lib/comet/models/authentication_role_options.rb', line 67 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
60 61 62 63 64 |
# File 'lib/comet/models/authentication_role_options.rb', line 60 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.
140 141 142 |
# File 'lib/comet/models/authentication_role_options.rb', line 140 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/comet/models/authentication_role_options.rb', line 120 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.
145 146 147 |
# File 'lib/comet/models/authentication_role_options.rb', line 145 def to_json( = {}) to_hash.to_json() end |