Class: Comet::ServerConfigOptions

Inherits:
Object
  • Object
show all
Defined in:
lib/comet/models/server_config_options.rb

Overview

ServerConfigOptions is a typed class wrapper around the underlying Comet Server API data structure.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeServerConfigOptions

Returns a new instance of ServerConfigOptions.



92
93
94
# File 'lib/comet/models/server_config_options.rb', line 92

def initialize
  clear
end

Instance Attribute Details

#admin_usersObject

Returns the value of attribute admin_users.



16
17
18
# File 'lib/comet/models/server_config_options.rb', line 16

def admin_users
  @admin_users
end

#audit_file_optionsObject

Returns the value of attribute audit_file_options.



87
88
89
# File 'lib/comet/models/server_config_options.rb', line 87

def audit_file_options
  @audit_file_options
end

#authentication_roleObject

Returns the value of attribute authentication_role.



19
20
21
# File 'lib/comet/models/server_config_options.rb', line 19

def authentication_role
  @authentication_role
end

#brandingObject

Returns the value of attribute branding.



22
23
24
# File 'lib/comet/models/server_config_options.rb', line 22

def branding
  @branding
end

#constellation_roleObject

Returns the value of attribute constellation_role.



25
26
27
# File 'lib/comet/models/server_config_options.rb', line 25

def constellation_role
  @constellation_role
end

#constellation_role__legacyObject

This field is defined for compatibility with 17.x.x versions of Comet Server. Do not rely on this field. In Comet 23.2.x, if this field is defined, it is imported into the replacement ‘ConstellationRole’ field under the assumption that you are upgrading this Comet Server from a 17.x.x version. In Comet 23.3.x and later, this field is ignored and will not be respected during the import process.



33
34
35
# File 'lib/comet/models/server_config_options.rb', line 33

def constellation_role__legacy
  @constellation_role__legacy
end

#emailObject

Returns the value of attribute email.



36
37
38
# File 'lib/comet/models/server_config_options.rb', line 36

def email
  @email
end

#experimental_optionsObject

An array of GUIDs that can enable additional early-access functionality



40
41
42
# File 'lib/comet/models/server_config_options.rb', line 40

def experimental_options
  @experimental_options
end

#external_admin_user_sourcesObject

Returns the value of attribute external_admin_user_sources.



43
44
45
# File 'lib/comet/models/server_config_options.rb', line 43

def external_admin_user_sources
  @external_admin_user_sources
end

#iprate_limitObject

The Comet Server can enforce a bandwidth limit based on the target IP address



47
48
49
# File 'lib/comet/models/server_config_options.rb', line 47

def iprate_limit
  @iprate_limit
end

#licenseObject

Returns the value of attribute license.



50
51
52
# File 'lib/comet/models/server_config_options.rb', line 50

def license
  @license
end

#listen_addressesObject

Configure ip, port, and SSL settings for this self-hosted Comet Server.



54
55
56
# File 'lib/comet/models/server_config_options.rb', line 54

def listen_addresses
  @listen_addresses
end

#organizationsObject

Tenants



58
59
60
# File 'lib/comet/models/server_config_options.rb', line 58

def organizations
  @organizations
end

#psaconfigsObject

Returns the value of attribute psaconfigs.



61
62
63
# File 'lib/comet/models/server_config_options.rb', line 61

def psaconfigs
  @psaconfigs
end

#self_backupObject

Automatically create backup zip files of this Comet Server’s configuration



65
66
67
# File 'lib/comet/models/server_config_options.rb', line 65

def self_backup
  @self_backup
end

#session_settingsObject

Control how long admin accounts can remain logged in to the Comet Server web interface



69
70
71
# File 'lib/comet/models/server_config_options.rb', line 69

def session_settings
  @session_settings
end

#software_build_roleObject

Returns the value of attribute software_build_role.



72
73
74
# File 'lib/comet/models/server_config_options.rb', line 72

def software_build_role
  @software_build_role
end

#storage_roleObject

Returns the value of attribute storage_role.



75
76
77
# File 'lib/comet/models/server_config_options.rb', line 75

def storage_role
  @storage_role
end

#trust_xforwarded_forObject

If true, the X-Forwarded-For header will be trusted for the purposes of IP allowlisting. This should only be enabled when you explicitly configure Comet Server behind a reverse proxy, otherwise it could allow malicious users to bypass the IP allowlist.



81
82
83
# File 'lib/comet/models/server_config_options.rb', line 81

def trust_xforwarded_for
  @trust_xforwarded_for
end

#unknown_json_fieldsObject

Returns the value of attribute unknown_json_fields.



90
91
92
# File 'lib/comet/models/server_config_options.rb', line 90

def unknown_json_fields
  @unknown_json_fields
end

#webhook_optionsObject

Returns the value of attribute webhook_options.



84
85
86
# File 'lib/comet/models/server_config_options.rb', line 84

def webhook_options
  @webhook_options
end

Instance Method Details

#clearObject



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/server_config_options.rb', line 96

def clear
  @admin_users = []
  @authentication_role = Comet::AuthenticationRoleOptions.new
  @branding = Comet::BrandingOptions.new
  @constellation_role = Comet::ConstellationRoleOptions.new
  @constellation_role__legacy = Comet::ConstellationRoleOptions.new
  @email = Comet::EmailOptions.new
  @experimental_options = []
  @external_admin_user_sources = {}
  @iprate_limit = Comet::RatelimitOptions.new
  @license = Comet::LicenseOptions.new
  @listen_addresses = []
  @organizations = {}
  @psaconfigs = []
  @self_backup = Comet::SelfBackupOptions.new
  @session_settings = Comet::SessionOptions.new
  @software_build_role = Comet::SoftwareBuildRoleOptions.new
  @storage_role = Comet::StorageRoleOptions.new
  @webhook_options = {}
  @audit_file_options = {}
  @unknown_json_fields = {}
end

#from_hash(obj) ⇒ Object

Parameters:

  • obj (Hash)

    The complete object as a Ruby hash

Raises:

  • (TypeError)


127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/comet/models/server_config_options.rb', line 127

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 'AdminUsers'
      if v.nil?
        @admin_users = []
      else
        @admin_users = Array.new(v.length)
        v.each_with_index do |v1, i1|
          @admin_users[i1] = Comet::AllowedAdminUser.new
          @admin_users[i1].from_hash(v1)
        end
      end
    when 'AuthenticationRole'
      @authentication_role = Comet::AuthenticationRoleOptions.new
      @authentication_role.from_hash(v)
    when 'Branding'
      @branding = Comet::BrandingOptions.new
      @branding.from_hash(v)
    when 'ConstellationRole'
      @constellation_role = Comet::ConstellationRoleOptions.new
      @constellation_role.from_hash(v)
    when 'OverseerRole'
      @constellation_role__legacy = Comet::ConstellationRoleOptions.new
      @constellation_role__legacy.from_hash(v)
    when 'Email'
      @email = Comet::EmailOptions.new
      @email.from_hash(v)
    when 'ExperimentalOptions'
      if v.nil?
        @experimental_options = []
      else
        @experimental_options = Array.new(v.length)
        v.each_with_index do |v1, i1|
          raise TypeError, "'v1' expected String, got #{v1.class}" unless v1.is_a? String

          @experimental_options[i1] = v1
        end
      end
    when 'ExternalAdminUserSources'
      @external_admin_user_sources = {}
      if v.nil?
        @external_admin_user_sources = {}
      else
        v.each do |k1, v1|
          @external_admin_user_sources[k1] = Comet::ExternalAuthenticationSource.new
          @external_admin_user_sources[k1].from_hash(v1)
        end
      end
    when 'IPRateLimit'
      @iprate_limit = Comet::RatelimitOptions.new
      @iprate_limit.from_hash(v)
    when 'License'
      @license = Comet::LicenseOptions.new
      @license.from_hash(v)
    when 'ListenAddresses'
      if v.nil?
        @listen_addresses = []
      else
        @listen_addresses = Array.new(v.length)
        v.each_with_index do |v1, i1|
          @listen_addresses[i1] = Comet::HTTPConnectorOptions.new
          @listen_addresses[i1].from_hash(v1)
        end
      end
    when 'Organizations'
      @organizations = {}
      if v.nil?
        @organizations = {}
      else
        v.each do |k1, v1|
          @organizations[k1] = Comet::Organization.new
          @organizations[k1].from_hash(v1)
        end
      end
    when 'PSAConfigs'
      if v.nil?
        @psaconfigs = []
      else
        @psaconfigs = Array.new(v.length)
        v.each_with_index do |v1, i1|
          @psaconfigs[i1] = Comet::PSAConfig.new
          @psaconfigs[i1].from_hash(v1)
        end
      end
    when 'SelfBackup'
      @self_backup = Comet::SelfBackupOptions.new
      @self_backup.from_hash(v)
    when 'SessionSettings'
      @session_settings = Comet::SessionOptions.new
      @session_settings.from_hash(v)
    when 'SoftwareBuildRole'
      @software_build_role = Comet::SoftwareBuildRoleOptions.new
      @software_build_role.from_hash(v)
    when 'StorageRole'
      @storage_role = Comet::StorageRoleOptions.new
      @storage_role.from_hash(v)
    when 'TrustXForwardedFor'
      @trust_xforwarded_for = v
    when 'WebhookOptions'
      @webhook_options = {}
      if v.nil?
        @webhook_options = {}
      else
        v.each do |k1, v1|
          @webhook_options[k1] = Comet::WebhookOption.new
          @webhook_options[k1].from_hash(v1)
        end
      end
    when 'AuditFileOptions'
      @audit_file_options = {}
      if v.nil?
        @audit_file_options = {}
      else
        v.each do |k1, v1|
          @audit_file_options[k1] = Comet::FileOption.new
          @audit_file_options[k1].from_hash(v1)
        end
      end
    else
      @unknown_json_fields[k] = v
    end
  end
end

#from_json(json_string) ⇒ Object

Parameters:

  • json_string (String)

    The complete object in JSON format

Raises:

  • (TypeError)


120
121
122
123
124
# File 'lib/comet/models/server_config_options.rb', line 120

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_hHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



288
289
290
# File 'lib/comet/models/server_config_options.rb', line 288

def to_h
  to_hash
end

#to_hashHash

Returns The complete object as a Ruby hash.

Returns:

  • (Hash)

    The complete object as a Ruby hash



255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'lib/comet/models/server_config_options.rb', line 255

def to_hash
  ret = {}
  ret['AdminUsers'] = @admin_users
  ret['AuthenticationRole'] = @authentication_role
  ret['Branding'] = @branding
  ret['ConstellationRole'] = @constellation_role
  unless @constellation_role__legacy.nil?
    ret['OverseerRole'] = @constellation_role__legacy
  end
  ret['Email'] = @email
  unless @experimental_options.nil?
    ret['ExperimentalOptions'] = @experimental_options
  end
  ret['ExternalAdminUserSources'] = @external_admin_user_sources
  ret['IPRateLimit'] = @iprate_limit
  ret['License'] = @license
  ret['ListenAddresses'] = @listen_addresses
  ret['Organizations'] = @organizations
  ret['PSAConfigs'] = @psaconfigs
  ret['SelfBackup'] = @self_backup
  ret['SessionSettings'] = @session_settings
  ret['SoftwareBuildRole'] = @software_build_role
  ret['StorageRole'] = @storage_role
  ret['TrustXForwardedFor'] = @trust_xforwarded_for
  ret['WebhookOptions'] = @webhook_options
  ret['AuditFileOptions'] = @audit_file_options
  @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.

Returns:

  • (String)

    The complete object as a JSON string



293
294
295
# File 'lib/comet/models/server_config_options.rb', line 293

def to_json(options = {})
  to_hash.to_json(options)
end