Phalanx internal API#
These pages document the Phalanx internal API, which may be of interest when extending the Phalanx command-line tool or documentation build infrastructure.
Phalanx does not provide a library or Python module for external use. This API is only intended for use within the Phalanx code itself.
phalanx Package#
Support tooling for Phalanx, SQuaRE’s application development platform.
Variables#
The version string, although |
phalanx.constants Module#
Constants for the Phalanx support code.
Things that arguably could be configurable but haven’t yet been made into actual configuration options.
Variables#
Annotation in |
|
Default lifetime to set for Vault write tokens. |
|
Remaining lifetime at which to warn that a token is about to expire. |
phalanx.docs.crossref Module#
Cross-referencing roles and directives for Phalanx topics.
Functions#
|
Set up the Phalan cross-referencing extensions. |
phalanx.docs.jinja Module#
Helper functions for Sphinx Jinja templating.
Functions#
Construct the Jinja contexts used for building Phalanx documentation. |
phalanx.exceptions Module#
Exceptions for the Phalanx command-line tool.
Classes#
|
Configuration for an application is invalid. |
|
Configuration for an environment is invalid. |
|
Secret configuration is invalid. |
|
No configuration found for an environment name. |
|
Some secrets could not be resolved. |
|
Secret could not be found in Vault. |
Class Inheritance Diagram#
phalanx.factory Module#
Factory for Phalanx support code components.
Classes#
|
Factory to create Phalanx components. |
Class Inheritance Diagram#
phalanx.models.applications Module#
Pydantic models for Phalanx applications.
Classes#
A Phalanx application that knows which environments use it. |
|
Configuration for a Phalanx application. |
|
A Phalanx application as configured for a specific environment. |
|
A documentation link for an application. |
Class Inheritance Diagram#
phalanx.models.environments Module#
Pydantic models for Phalanx environments.
Classes#
A Phalanx environment and its associated settings. |
|
Configuration for a Phalanx environment. |
|
Full details about an environment, including auth and Argo CD. |
|
Vault configuration for a specific environment. |
|
A group based on a GitHub team. |
|
Designates a GitHub team for use as a Gafaelfawr group. |
|
A Gafaelfawr scope and its associated groups. |
|
|
Type of identity provider used by Gafaelfawr. |
Root container for the entire Phalanx configuration. |
Class Inheritance Diagram#
phalanx.models.gafaelfawr Module#
Models for Gafaelfawr data structures.
Ideally, these should use the same models Gafaelfawr itself uses. Until that’s possible via a PyPI library, these models are largely copied from Gafaelfawr.
Classes#
An opaque token. |
Class Inheritance Diagram#
phalanx.models.secrets Module#
Pydantic models for Phalanx application secrets.
Classes#
Mix-in class for elements that may have a condition. |
|
Possibly conditional specification for an application secret. |
|
Possibly conditional rules for copying a secret value from another. |
|
Conditional rules for generating a secret value with no source. |
|
Conditional rules for generating a secret from another secret. |
|
A secret that has been resolved for a given application instance. |
|
Specification for an application secret for a specific environment. |
|
Specification for an application secret. |
|
Rules for copying a secret value from another secret. |
|
|
Type of secret for generated secrets. |
Rules for generating a secret value with no source information. |
|
Rules for generating a secret from another secret. |
|
Value of a static secret provided in a YAML file. |
Variables#
Represent a PEP 604 union type |
|
Represent a PEP 604 union type |
Class Inheritance Diagram#
phalanx.models.vault Module#
Models representing Vault objects.
Classes#
Newly-created Vault AppRole for secret access. |
|
Metadata about a new or existing Vault AppRole. |
|
Newly-created Vault token for secret access. |
|
Metadata about a new or existing Vault token. |
Class Inheritance Diagram#
phalanx.services.secrets Module#
Service to manipulate Phalanx secrets.
Classes#
|
Service to manipulate Phalanx secrets. |
Class Inheritance Diagram#
phalanx.services.vault Module#
Service to manage Vault authentication.
Classes#
|
Service to manage Vault authentication. |
Class Inheritance Diagram#
phalanx.storage.config Module#
Parsing and analysis of Phalanx configuration.
Classes#
|
Analyze Phalanx configuration and convert it to models. |
Class Inheritance Diagram#
phalanx.storage.vault Module#
Store, retrieve, and manipulate data stored in Vault.
Classes#
|
Store, retrieve, and manipulate data stored in Vault. |
Create Vault clients for specific environments. |
Class Inheritance Diagram#
phalanx.yaml Module#
Utility functions for manipulating YAML.
In several places in the Phalanx code, we want to be able to wrap long strings to make them more readable or be able to dump collections.defaultdict objects without adding special object tagging. This module collects utility functions to make this easier.
Classes#
A string that will be folded when encoded in YAML. |