Skip to content

Commit

Permalink
wip config vars
Browse files Browse the repository at this point in the history
wip
  • Loading branch information
Page- committed Oct 9, 2023
1 parent 1bba0e4 commit d60b2e6
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 144 deletions.
8 changes: 7 additions & 1 deletion src/abstract-sql-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,13 @@ export const renameResourceField = (
};

export const renameVarResourcesName = (abstractSql: AbstractSqlModel) => {
for (const resource of ['device', 'application']) {
for (const resource of [
'device',
'application',
'device-installs-application-has-service name',
'application-has-service name',
'image-is part of-release',
]) {
renameResourceField(abstractSql, resource, 'config var name', 'name');
renameResourceField(abstractSql, resource, 'env var name', 'name');
}
Expand Down
36 changes: 33 additions & 3 deletions src/balena.sbvr
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,14 @@ Term: application
Term Form: service label
Database Table Name: service label

Fact type: service has name (Auth)
Fact type: service has env var name
Term Form: service environment variable
Database Table Name: service environment variable

Fact type: service has config var name
Term Form: service config variable
Database Table Name: service config variable

Fact type: application has tag key
Term Form: application tag
Database Table Name: application tag
Expand Down Expand Up @@ -380,10 +384,14 @@ Term: device
Term Form: service install
Database Table Name: service install

Fact type: service install has name (Auth)
Fact type: service install has env var name
Term Form: device service environment variable
Database Table Name: device service environment variable

Fact type: service install has config var name
Term Form: device service config variable
Database Table Name: device service config variable

Fact type: device has tag key
Term Form: device tag
Database Table Name: device tag
Expand All @@ -404,10 +412,14 @@ Fact type: image is part of release
Term Form: image label
Database Table Name: image label

Fact type: release image has name (Auth)
Fact type: release image has env var name
Term Form: image environment variable
Database Table Name: image environment variable

Fact type: release image has config var name
Term Form: image config variable
Database Table Name: image config variable

Fact type: user (Auth) is member of organization
Synonymous Form: organization includes user (Auth)
Database Table Name: organization membership
Expand Down Expand Up @@ -711,6 +723,12 @@ Fact type: service environment variable has value
Necessity: each service environment variable has exactly one value.


-- service config variable

Fact type: service config variable has value
Necessity: each service config variable has exactly one value.


-- image

Fact type: image has start timestamp
Expand Down Expand Up @@ -774,12 +792,24 @@ Fact type: image environment variable has value
Necessity: each image environment variable has exactly one value.


-- image config variable

Fact type: image config variable has value
Necessity: each image config variable has exactly one value.


-- device service environment variable

Fact type: device service environment variable has value
Necessity: each device service environment variable has exactly one value.


-- device service config variable

Fact type: device service config variable has value
Necessity: each device service config variable has exactly one value.


-- application tag

Fact type: application tag has value
Expand Down
3 changes: 3 additions & 0 deletions src/features/vars-schema/hooks/config-var-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const configVarHook: hooks.Hooks = {
for (const resource of [
'application_config_variable',
'device_config_variable',
'service_config_variable',
'device_service_config_variable',
'image_config_variable',
]) {
for (const method of ['POST', 'PATCH', 'PUT'] as const) {
hooks.addPureHook(method, 'resin', resource, configVarHook);
Expand Down
Loading

0 comments on commit d60b2e6

Please sign in to comment.