infrahub_sdk.generator
Classes
InfrahubGenerator
Infrahub Generator class
Methods:
subscribers
subscribers(self) -> list[str] | None
client
client(self) -> InfrahubClient
client
client(self, value: InfrahubClient) -> None
collect_data
collect_data(self) -> dict
Query the result of the GraphQL Query defined in self.query and return the result
run
run(self, identifier: str, data: dict | None = None) -> None
Execute the generator after collecting the data from the GraphQL query.
generate
generate(self, data: dict) -> None
Code to run the generator
Any child class of the InfrahubGenerator us expected to provide this method. The method is expected to use the provided InfrahubClient contained in self.client to create or update any nodes in an idempotent way as the method could be executed multiple times. Typically this would be done by using:
await new_or_updated_object.save(allow_upsert=True)
The tracking system will be responsible for deleting nodes that are no longer required.