IF Commons GitHub

machine

concept

A program that acts for itself, with a person or a group accountable for it

Model identityMachine. Written in commons/data/models/identity-machine/mod.ts:21. Identified by principal.

Governance: attributes

environmentcode of environmentoptional

Where it runs

Becomes the column environment_code of machine.

Written at commons/data/models/identity-machine/mod.ts:26

isBreakGlassbooleanrequired

Whether it is an account kept for emergencies, whose every use is reviewed

Becomes the column is_break_glass of machine.

Written at commons/data/models/identity-machine/mod.ts:27

machineKindcode of machineKindrequired

What kind of program it is

Becomes the column machine_kind of machine.

Written at commons/data/models/identity-machine/mod.ts:24

maxCredentialDaysintegeroptional

The longest a credential of the machine may live

Becomes the column max_credential_days of machine.

Written at commons/data/models/identity-machine/mod.ts:28

purposetextrequired

What it is for

Becomes the column purpose of machine.

Written at commons/data/models/identity-machine/mod.ts:25

reviewByinstantoptional

When the machine must next be reviewed by its owner

Becomes the column review_by of machine.

Written at commons/data/models/identity-machine/mod.ts:29

Governance: relationships

principalone

The principal the machine is To principal. Written at commons/data/models/identity-machine/mod.ts:21

Logical: the table

Projects to the table machine with the primary key principal_id.

ColumnTypeNullRoleFrom
environment_codetexttruereferencemachine.environment
is_break_glassbooleanfalseattributemachine.isBreakGlass
machine_kindtextfalseattributemachine.machineKind
max_credential_daysintegertrueattributemachine.maxCredentialDays
principal_idtextfalsereferencemachine.principal
purposetextfalseattributemachine.purpose
review_bytimestamptrueattributemachine.reviewBy

Physical: SQL

CREATE TABLE IF NOT EXISTS "machine" (
    "principal_id" VARCHAR NOT NULL PRIMARY KEY,
    "machine_kind" VARCHAR NOT NULL,
    "purpose" VARCHAR NOT NULL,
    "environment_code" VARCHAR,
    "is_break_glass" BOOLEAN NOT NULL,
    "max_credential_days" INTEGER,
    "review_by" TIMESTAMPTZ,
    CONSTRAINT "machine_principal_id_fk" FOREIGN KEY ("principal_id") REFERENCES "principal" ("principal_id"),
    CONSTRAINT "machine_environment_code_fk" FOREIGN KEY ("environment_code") REFERENCES "environment" ("code"),
    CONSTRAINT "machine_machine_kind_ck" CHECK ("machine_kind" IN ('service', 'workload', 'pipeline', 'integration', 'bot'))
);

Physical: the typed table

Read and written from TypeScript with the types the model gives: import { machine } from "@intellectual-frontiers/data/sql/typed/models". Generated in commons/data/sql/typed/models/identity-machine.auto.ts: do not edit.

import { from } from "@intellectual-frontiers/data/sql/typed";
import { machine } from "@intellectual-frontiers/data/sql/typed/models";

const rows = await from(machine).select((s) => ({ principalId: s.machine.principalId, machineKind: s.machine.machineKind })).run(runner);

Titles, headings, exports, tables, columns and requirements. Esc closes.