clowder-common-ruby 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 892ebe1bfde6f2e84b314886d6b0b66fcf110cc01f1dd6ce554de39c09d9a9b3
4
- data.tar.gz: ac45411ee564e2d6bd9d4b56f40dbfa972f559626878082ae53cdc388dd12947
3
+ metadata.gz: 0e5767791bccbe0f77d953de067609ecb60e5a21330f7dbbd15ea76d7dfc8f93
4
+ data.tar.gz: b8b1dcde02ca8bc832f2ac2ef052fad1f4197c490bf0c28dcc546587bf74991b
5
5
  SHA512:
6
- metadata.gz: 708a51e009bfdc3ae4d018a8df7933e5b7e06cfa2c0869389cde71f2449c3f735c71aa8828ecf7e9564d84f1da30ab6a06f844b79e02fe7fa5a2a5ca995e2a4d
7
- data.tar.gz: 2879a909f197ca8153d0db2f60de26bf16717a43c2076f966606bb1921c92ded3d4865d93f9d2e65015664881c273f34feb4ad758ced8b84bee327a3f1dfc9fe
6
+ metadata.gz: 50f962168c4d9118a836f173a4f83966a045d0f4656c3793485d641b4569078e92ea747a07f46e618f63d914186fc04374630fbdfe50078591cbcbecfc8734f8
7
+ data.tar.gz: 166f2b4204f869f5849e68d63f40ebc80d23ad4d8c7d059310eca988435b7780a84f5b9723d9f8ef7a2926c04f4256c33dbc4e4b908c0efe5f6ba88a3ae2f49f
data/bin/schema.json CHANGED
@@ -31,6 +31,9 @@
31
31
  "logging": {
32
32
  "$ref": "#/definitions/LoggingConfig"
33
33
  },
34
+ "metadata": {
35
+ "$ref": "#/definitions/AppMetadata"
36
+ },
34
37
  "kafka": {
35
38
  "$ref": "#/definitions/KafkaConfig"
36
39
  },
@@ -85,6 +88,40 @@
85
88
  "type"
86
89
  ]
87
90
  },
91
+ "AppMetadata": {
92
+ "title": "AppMetadata",
93
+ "type": "object",
94
+ "description": "Arbitrary metadata pertaining to the application application",
95
+ "properties": {
96
+ "deployments": {
97
+ "description": "Metadata pertaining to an application's deployments",
98
+ "type": "array",
99
+ "items": {
100
+ "$ref": "#/definitions/DeploymentMetadata"
101
+ }
102
+ }
103
+ },
104
+ "required": []
105
+ },
106
+ "DeploymentMetadata": {
107
+ "title": "DeploymentMetadata",
108
+ "type": "object",
109
+ "description": "Deployment Metadata",
110
+ "properties": {
111
+ "name": {
112
+ "description": "Name of deployment",
113
+ "type": "string"
114
+ },
115
+ "image": {
116
+ "description": "Image used by deployment",
117
+ "type": "string"
118
+ }
119
+ },
120
+ "required": [
121
+ "name",
122
+ "image"
123
+ ]
124
+ },
88
125
  "CloudWatchConfig": {
89
126
  "title": "CloudWatchConfig",
90
127
  "type": "object",
@@ -150,7 +187,8 @@
150
187
  "password": {
151
188
  "type": "string"
152
189
  }
153
- }
190
+ },
191
+ "required": []
154
192
  },
155
193
  "BrokerConfig": {
156
194
  "id": "brokerConfig",
@@ -336,11 +374,17 @@
336
374
  "clientAccessToken": {
337
375
  "description": "Defines the client access token to use when connect to the FeatureFlags server",
338
376
  "type": "string"
377
+ },
378
+ "scheme": {
379
+ "description": "Details the scheme to use for FeatureFlags http/https",
380
+ "type": "string",
381
+ "enum": ["http", "https"]
339
382
  }
340
383
  },
341
384
  "required":[
342
385
  "hostname",
343
- "port"
386
+ "port",
387
+ "scheme"
344
388
  ]
345
389
  },
346
390
  "InMemoryDBConfig": {
@@ -4,6 +4,7 @@ require 'ostruct'
4
4
  module ClowderCommonRuby
5
5
  class AppConfig < OpenStruct
6
6
  attr_accessor :logging
7
+ attr_accessor :metadata
7
8
  attr_accessor :kafka
8
9
  attr_accessor :database
9
10
  attr_accessor :objectStore
@@ -22,6 +23,7 @@ module ClowderCommonRuby
22
23
  end
23
24
 
24
25
  @logging = LoggingConfig.new(attributes.fetch(:logging, {}))
26
+ @metadata = AppMetadata.new(attributes.fetch(:metadata, {}))
25
27
  @kafka = KafkaConfig.new(attributes.fetch(:kafka, {}))
26
28
  @database = DatabaseConfig.new(attributes.fetch(:database, {}))
27
29
  @objectStore = ObjectStoreConfig.new(attributes.fetch(:objectStore, {}))
@@ -45,6 +47,7 @@ module ClowderCommonRuby
45
47
  keys << :metricsPort
46
48
  keys << :metricsPath
47
49
  keys << :logging
50
+ keys << :metadata
48
51
  keys << :kafka
49
52
  keys << :database
50
53
  keys << :objectStore
@@ -79,6 +82,52 @@ module ClowderCommonRuby
79
82
  end
80
83
  end
81
84
 
85
+ class AppMetadata < OpenStruct
86
+ attr_accessor :deployments
87
+
88
+ def initialize(attributes)
89
+ super
90
+ raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))
91
+
92
+ attributes = attributes.each_with_object({}) do |(k, v), h|
93
+ warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
94
+ h[k.to_sym] = v
95
+ end
96
+
97
+ @deployments = []
98
+ attributes.fetch(:deployments, []).each do |attr|
99
+ @deployments << DeploymentMetadata.new(attr)
100
+ end
101
+ end
102
+
103
+ def valid_keys
104
+ [].tap do |keys|
105
+ keys << :deployments
106
+ end
107
+ end
108
+ end
109
+
110
+ class DeploymentMetadata < OpenStruct
111
+
112
+ def initialize(attributes)
113
+ super
114
+ raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))
115
+
116
+ attributes = attributes.each_with_object({}) do |(k, v), h|
117
+ warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
118
+ h[k.to_sym] = v
119
+ end
120
+
121
+ end
122
+
123
+ def valid_keys
124
+ [].tap do |keys|
125
+ keys << :name
126
+ keys << :image
127
+ end
128
+ end
129
+ end
130
+
82
131
  class CloudWatchConfig < OpenStruct
83
132
 
84
133
  def initialize(attributes)
@@ -133,7 +182,29 @@ module ClowderCommonRuby
133
182
  end
134
183
  end
135
184
 
185
+ class KafkaSASLConfig < OpenStruct
186
+
187
+ def initialize(attributes)
188
+ super
189
+ raise 'The input argument (attributes) must be a hash' if (!attributes || !attributes.is_a?(Hash))
190
+
191
+ attributes = attributes.each_with_object({}) do |(k, v), h|
192
+ warn "The input [#{k}] is invalid" unless valid_keys.include?(k.to_sym)
193
+ h[k.to_sym] = v
194
+ end
195
+
196
+ end
197
+
198
+ def valid_keys
199
+ [].tap do |keys|
200
+ keys << :username
201
+ keys << :password
202
+ end
203
+ end
204
+ end
205
+
136
206
  class BrokerConfig < OpenStruct
207
+ attr_accessor :sasl
137
208
 
138
209
  def initialize(attributes)
139
210
  super
@@ -144,12 +215,16 @@ module ClowderCommonRuby
144
215
  h[k.to_sym] = v
145
216
  end
146
217
 
218
+ @sasl = KafkaSASLConfig.new(attributes.fetch(:sasl, {}))
147
219
  end
148
220
 
149
221
  def valid_keys
150
222
  [].tap do |keys|
151
223
  keys << :hostname
152
224
  keys << :port
225
+ keys << :cacert
226
+ keys << :authtype
227
+ keys << :sasl
153
228
  end
154
229
  end
155
230
  end
@@ -171,7 +246,6 @@ module ClowderCommonRuby
171
246
  [].tap do |keys|
172
247
  keys << :requestedName
173
248
  keys << :name
174
- keys << :consumerGroup
175
249
  end
176
250
  end
177
251
  end
@@ -199,6 +273,7 @@ module ClowderCommonRuby
199
273
  keys << :adminUsername
200
274
  keys << :adminPassword
201
275
  keys << :rdsCa
276
+ keys << :sslMode
202
277
  end
203
278
  end
204
279
  end
@@ -220,6 +295,7 @@ module ClowderCommonRuby
220
295
  [].tap do |keys|
221
296
  keys << :accessKey
222
297
  keys << :secretKey
298
+ keys << :region
223
299
  keys << :requestedName
224
300
  keys << :name
225
301
  end
@@ -273,6 +349,8 @@ module ClowderCommonRuby
273
349
  [].tap do |keys|
274
350
  keys << :hostname
275
351
  keys << :port
352
+ keys << :clientAccessToken
353
+ keys << :scheme
276
354
  end
277
355
  end
278
356
  end
@@ -1,3 +1,3 @@
1
1
  module ClowderCommonRuby
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.2.4'.freeze
3
3
  end
data/test.json CHANGED
@@ -1,13 +1,5 @@
1
1
  {
2
- "metadata": {
3
- "deployments": [
4
- {
5
- "name": "svc",
6
- "image": "quay.io/not_us/test_ruby_app:1337"
7
- }
8
- ]
9
- },
10
- "webPort": 8000,
2
+ "publicPort": 8000,
11
3
  "metricsPort": 9000,
12
4
  "metricsPath": "/metrics",
13
5
  "logging": {
@@ -29,8 +21,7 @@
29
21
  "topics": [
30
22
  {
31
23
  "requestedName": "originalName",
32
- "name": "someTopic",
33
- "consumerGroup": "someGroupName"
24
+ "name": "someTopic"
34
25
  }
35
26
  ]
36
27
  },
@@ -40,9 +31,11 @@
40
31
  "password": "password",
41
32
  "hostname": "hostname",
42
33
  "port": 5432,
34
+ "pgPass": "testing",
43
35
  "adminUsername": "adminusername",
44
36
  "adminPassword": "adminpassword",
45
- "rdsCa": "ca"
37
+ "rdsCa": "ca",
38
+ "sslMode": "verify-full"
46
39
  },
47
40
  "objectStore": {
48
41
  "hostname": "endpoint",
@@ -61,7 +54,8 @@
61
54
  },
62
55
  "featureFlags": {
63
56
  "hostname": "ff-server.server.example.com",
64
- "port": 4242
57
+ "port": 4242,
58
+ "scheme": "http"
65
59
  },
66
60
  "endpoints": [
67
61
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clowder-common-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Red Hat Developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2021-10-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is a ruby interface for preparing Clowder variables.
14
14
  email:
@@ -25,7 +25,6 @@ files:
25
25
  - bin/schema.json
26
26
  - lib/clowder-common-ruby.rb
27
27
  - lib/clowder-common-ruby/config.rb
28
- - lib/clowder-common-ruby/schema.json
29
28
  - lib/clowder-common-ruby/test.rb
30
29
  - lib/clowder-common-ruby/types.rb
31
30
  - lib/clowder-common-ruby/version.rb
@@ -1,401 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$ref": "#/definitions/AppConfig",
4
- "$id": "https://cloud.redhat.com/schemas/clowder-appconfig",
5
- "title": "AppConfig",
6
- "definitions": {
7
- "AppConfig": {
8
- "type": "object",
9
- "description": "ClowdApp deployment configuration for Clowder enabled apps.",
10
- "properties": {
11
- "privatePort": {
12
- "description": "Defines the private port that the app should be configured to listen on for API traffic.",
13
- "type": "integer"
14
- },
15
- "publicPort": {
16
- "description": "Defines the public port that the app should be configured to listen on for API traffic.",
17
- "type": "integer"
18
- },
19
- "webPort": {
20
- "description": "Deprecated: Use 'publicPort' instead.",
21
- "type": "integer"
22
- },
23
- "metricsPort": {
24
- "description": "Defines the metrics port that the app should be configured to listen on for metric traffic.",
25
- "type": "integer"
26
- },
27
- "metricsPath": {
28
- "description": "Defines the path to the metrics server that the app should be configured to listen on for metric traffic.",
29
- "type": "string"
30
- },
31
- "logging": {
32
- "$ref": "#/definitions/LoggingConfig"
33
- },
34
- "kafka": {
35
- "$ref": "#/definitions/KafkaConfig"
36
- },
37
- "database": {
38
- "$ref": "#/definitions/DatabaseConfig"
39
- },
40
- "objectStore": {
41
- "$ref": "#/definitions/ObjectStoreConfig"
42
- },
43
- "inMemoryDb": {
44
- "$ref": "#/definitions/InMemoryDBConfig"
45
- },
46
- "featureFlags": {
47
- "$ref": "#/definitions/FeatureFlagsConfig"
48
- },
49
- "endpoints": {
50
- "id": "endpoints",
51
- "type": "array",
52
- "items": {
53
- "$ref": "#/definitions/DependencyEndpoint"
54
- }
55
- },
56
- "privateEndpoints": {
57
- "id": "privateEndpoints",
58
- "type": "array",
59
- "items": {
60
- "$ref": "#/definitions/PrivateDependencyEndpoint"
61
- }
62
- }
63
-
64
- },
65
- "required": [
66
- "metricsPort",
67
- "metricsPath",
68
- "logging"
69
- ]
70
- },
71
- "LoggingConfig": {
72
- "title": "LoggingConfig",
73
- "type": "object",
74
- "description": "Logging Configuration",
75
- "properties": {
76
- "type": {
77
- "description": "Defines the type of logging configuration",
78
- "type": "string"
79
- },
80
- "cloudwatch": {
81
- "$ref": "#/definitions/CloudWatchConfig"
82
- }
83
- },
84
- "required": [
85
- "type"
86
- ]
87
- },
88
- "CloudWatchConfig": {
89
- "title": "CloudWatchConfig",
90
- "type": "object",
91
- "description": "Cloud Watch configuration",
92
- "properties": {
93
- "accessKeyId": {
94
- "description": "Defines the access key that the app should use for configuring CloudWatch.",
95
- "type": "string"
96
- },
97
- "secretAccessKey": {
98
- "description": "Defines the secret key that the app should use for configuring CloudWatch.",
99
- "type": "string"
100
- },
101
- "region": {
102
- "description": "Defines the region that the app should use for configuring CloudWatch.",
103
- "type": "string"
104
- },
105
- "logGroup": {
106
- "description": "Defines the logGroup that the app should use for configuring CloudWatch.",
107
- "type": "string"
108
- }
109
- },
110
- "required": [
111
- "accessKeyId",
112
- "secretAccessKey",
113
- "region",
114
- "logGroup"
115
- ]
116
- },
117
- "KafkaConfig": {
118
- "id": "kafkaConfig",
119
- "type": "object",
120
- "description": "Kafka Configuration",
121
- "properties": {
122
- "brokers": {
123
- "description": "Defines the brokers the app should connect to for Kafka services.",
124
- "type": "array",
125
- "items": {
126
- "$ref": "#/definitions/BrokerConfig"
127
- }
128
- },
129
- "topics": {
130
- "type": "array",
131
- "description": "Defines a list of the topic configurations available to the application.",
132
- "items": {
133
- "$ref": "#/definitions/TopicConfig"
134
- }
135
- }
136
- },
137
- "required": [
138
- "brokers",
139
- "topics"
140
- ]
141
- },
142
- "BrokerConfig": {
143
- "id": "brokerConfig",
144
- "type": "object",
145
- "description": "Broker Configuration",
146
- "properties": {
147
- "hostname": {
148
- "type": "string"
149
- },
150
- "port": {
151
- "type": "integer"
152
- }
153
- },
154
- "required": [
155
- "hostname"
156
- ]
157
- },
158
- "TopicConfig": {
159
- "id": "topicConfig",
160
- "type": "object",
161
- "description": "Topic Configuration",
162
- "properties": {
163
- "requestedName": {
164
- "description": "The name that the app requested in the ClowdApp definition.",
165
- "type": "string"
166
- },
167
- "name": {
168
- "description": "The name of the actual topic on the Kafka server.",
169
- "type": "string"
170
- },
171
- "consumerGroup": {
172
- "description": "Defines the consumer group that should be used for the topic.",
173
- "type": "string"
174
- }
175
- },
176
- "required": [
177
- "name",
178
- "requestedName"
179
- ]
180
- },
181
- "DatabaseConfig": {
182
- "id": "database",
183
- "title": "DatabaseConfig",
184
- "type": "object",
185
- "description": "Database Configuration",
186
- "properties": {
187
- "name": {
188
- "description": "Defines the database name.",
189
- "type": "string"
190
- },
191
- "username": {
192
- "description": "Defines a username with standard access to the database.",
193
- "type": "string"
194
- },
195
- "password": {
196
- "description": "Defines the password for the standard user.",
197
- "type": "string"
198
- },
199
- "hostname": {
200
- "description": "Defines the hostname of the database configured for the ClowdApp.",
201
- "type": "string"
202
- },
203
- "port": {
204
- "description": "Defines the port of the database configured for the ClowdApp.",
205
- "type": "integer"
206
- },
207
- "adminUsername": {
208
- "description": "Defines the pgAdmin username.",
209
- "type": "string"
210
- },
211
- "adminPassword": {
212
- "description": "Defines the pgAdmin password.",
213
- "type": "string"
214
- },
215
- "rdsCa": {
216
- "description": "Defines the CA used to access the database.",
217
- "type": "string"
218
- }
219
- },
220
- "required": [
221
- "name",
222
- "username",
223
- "password",
224
- "hostname",
225
- "port",
226
- "adminUsername",
227
- "adminPassword"
228
- ]
229
- },
230
- "ObjectStoreBucket": {
231
- "id": "objectStoreBucket",
232
- "type": "object",
233
- "description": "Object Storage Bucket",
234
- "properties": {
235
- "accessKey": {
236
- "description": "Defines the access key for specificed bucket.",
237
- "type": "string"
238
- },
239
- "secretKey": {
240
- "description": "Defines the secret key for the specified bucket.",
241
- "type": "string"
242
- },
243
- "requestedName": {
244
- "description": "The name that was requested for the bucket in the ClowdApp.",
245
- "type": "string"
246
- },
247
- "name": {
248
- "description": "The actual name of the bucket being accessed.",
249
- "type": "string"
250
- }
251
- },
252
- "required": [
253
- "name",
254
- "requestedName"
255
- ]
256
- },
257
- "ObjectStoreConfig": {
258
- "id": "objectStoreConfig",
259
- "type": "object",
260
- "description": "Object Storage Configuration",
261
- "properties": {
262
- "buckets": {
263
- "type": "array",
264
- "items": {
265
- "$ref": "#/definitions/ObjectStoreBucket"
266
- }
267
- },
268
- "accessKey": {
269
- "description": "Defines the access key for the Object Storage server configuration.",
270
- "type": "string"
271
- },
272
- "secretKey": {
273
- "description": "Defines the secret key for the Object Storage server configuration.",
274
- "type": "string"
275
- },
276
- "hostname": {
277
- "description": "Defines the hostname for the Object Storage server configuration.",
278
- "type": "string"
279
- },
280
- "port": {
281
- "description": "Defines the port for the Object Storage server configuration.",
282
- "type": "integer"
283
- },
284
- "tls": {
285
- "description": "Details if the Object Server uses TLS.",
286
- "type": "boolean"
287
- }
288
- },
289
- "required": [
290
- "hostname",
291
- "port",
292
- "tls"
293
- ]
294
- },
295
- "FeatureFlagsConfig": {
296
- "id": "featureFlagsConfig",
297
- "type": "object",
298
- "description": "Feature Flags Configuration",
299
- "properties": {
300
- "hostname": {
301
- "description": "Defines the hostname for the FeatureFlags server",
302
- "type": "string"
303
- },
304
- "port": {
305
- "description": "Defines the port for the FeatureFlags server",
306
- "type": "integer"
307
- }
308
- },
309
- "required":[
310
- "hostname",
311
- "port"
312
- ]
313
- },
314
- "InMemoryDBConfig": {
315
- "id": "inMemoryDbConfig",
316
- "type": "object",
317
- "description": "In Memory DB Configuration",
318
- "properties": {
319
- "hostname": {
320
- "description": "Defines the hostname for the In Memory DB server configuration.",
321
- "type": "string"
322
- },
323
- "port": {
324
- "description": "Defines the port for the In Memory DB server configuration.",
325
- "type": "integer"
326
- },
327
- "username": {
328
- "description": "Defines the username for the In Memory DB server configuration.",
329
- "type": "string"
330
- },
331
- "password": {
332
- "description": "Defines the password for the In Memory DB server configuration.",
333
- "type": "string"
334
- }
335
- },
336
- "required": [
337
- "hostname",
338
- "port"
339
-
340
- ]
341
- },
342
- "DependencyEndpoint": {
343
- "id": "dependency",
344
- "type": "object",
345
- "description": "Dependent service connection info",
346
- "properties": {
347
- "name": {
348
- "description": "The PodSpec name of the dependent service inside the ClowdApp.",
349
- "type": "string"
350
- },
351
- "hostname": {
352
- "description": "The hostname of the dependent service.",
353
- "type": "string"
354
- },
355
- "port": {
356
- "description": "The port of the dependent service.",
357
- "type": "integer"
358
- },
359
- "app": {
360
- "description": "The app name of the ClowdApp hosting the service.",
361
- "type": "string"
362
- }
363
- },
364
- "required": [
365
- "name",
366
- "hostname",
367
- "port",
368
- "app"
369
- ]
370
- },
371
- "PrivateDependencyEndpoint": {
372
- "id": "privateDependency",
373
- "type": "object",
374
- "description": "Dependent service connection info",
375
- "properties": {
376
- "name": {
377
- "description": "The PodSpec name of the dependent service inside the ClowdApp.",
378
- "type": "string"
379
- },
380
- "hostname": {
381
- "description": "The hostname of the dependent service.",
382
- "type": "string"
383
- },
384
- "port": {
385
- "description": "The port of the dependent service.",
386
- "type": "integer"
387
- },
388
- "app": {
389
- "description": "The app name of the ClowdApp hosting the service.",
390
- "type": "string"
391
- }
392
- },
393
- "required": [
394
- "name",
395
- "hostname",
396
- "port",
397
- "app"
398
- ]
399
- }
400
- }
401
- }