GitHubProjectTemplateStore#
- class gafaelfawr.storage.github_project.GitHubProjectTemplateStore(session)#
Bases:
objectStores and retrieves GitHub project templates.
As with
GitHubProjectStore, the rules of the registry are the responsibility of the service. Writes must be made under the registry lock taken byGitHubProjectStore.lock.- Parameters:
session (
AsyncSession) – The database session proxy.
Methods Summary
add(create, *, owners, max_lifetime, created_by)Store a new GitHub project template.
delete(name)Delete a GitHub project template.
get(name)Retrieve a GitHub project template.
list()List GitHub project templates.
update(name, update, *, owners, modified, ...)Modify a GitHub project template.
Methods Documentation
- async add(create, *, owners, max_lifetime, created_by)#
Store a new GitHub project template.
- Parameters:
create (
GitHubProjectTemplateCreate) – Fields of the new template.owners (
list[GitHubOwner]) – Allowed owners with their pinned IDs, as looked up on GitHub.max_lifetime (
timedelta) – Maximum lifetime of tokens minted for provisioned projects, either as given or as defaulted by the service.created_by (
str) – Username of the person creating the template.
- Returns:
The stored template.
- Return type:
- async delete(name)#
Delete a GitHub project template.
The caller must first ensure that no project records the template, since the database enforces that reference.
- async get(name)#
Retrieve a GitHub project template.
- async list()#
List GitHub project templates.
- Returns:
All templates, ordered by name.
- Return type:
- async update(name, update, *, owners, modified, modified_by)#
Modify a GitHub project template.
Only the fields set in the update are changed. The owners are taken from the separate argument rather than from the update, since the service resolves them. Each field is assigned explicitly, so a new field of the template must be added here as well as to
add.- Parameters:
name (
str) – Name of the template.update (
GitHubProjectTemplateUpdate) – Changes to apply.owners (
list[GitHubOwner] |None) – New allowed owners with their pinned IDs, as resolved by the service, orNoneto leave the owners unchanged.modified (
datetime) – Time of the change.modified_by (
str) – Username of the person making the change.
- Returns:
Trueif the template was found and updated,Falseotherwise.- Return type: