Clients
- class flame_hub._base_client.BaseClient(base_url: str, auth: PasswordAuth | RobotAuth = None, **kwargs: Unpack[ClientKwargs])
Bases:
object
The base class for other client classes.
This class implements fundamental methods to get, find, create, update and delete resources from a FLAME Hub instance. If the default instantiation of the internally used HTTP client should be bypassed, pass your own
httpx.Client
via**kwargs
to the class.- Parameters:
- base_url
str
Base URL of the Hub service.
- auth
PasswordAuth
|RobotAuth
, optional Authenticator which is used to authenticate the client at the FLAME Hub instance. Defaults to
None
.- **kwargs
Unpack
[ClientKwargs
] Currently used to pass an already instantiated HTTP client via the
client
keyword argument to bypass the default instantiation. This overridesbase_url
andauth
.
- base_url
See also
- _get_all_resources(resource_type: type[ResourceT], *path: str, include: str | Iterable[str] = None, **params: Unpack[GetKwargs]) list[ResourceT] | tuple[list[ResourceT], ResourceListMeta]
Retrieve all resources of a certain type at the specified path from the FLAME Hub.
This method passes its arguments through to
_find_all_resources()
. Check the documentation of that method for all information.See also
Notes
Default pagination parameters are applied as explained in the return section of
_find_all_resources()
.
- _find_all_resources(resource_type: type[ResourceT], *path: str, include: str | Iterable[str] = None, **params: Unpack[FindAllKwargs]) list[ResourceT] | tuple[list[ResourceT], ResourceListMeta]
Find all resources at the specified path on the FLAME Hub that match certain criteria.
This method accesses the endpoint
*path
and returns all resources of typeresource_type
that match certain criteria defined in**params
. Further fields and nested resources can be added to responses via thefields
andinclude
argument. Meta information can be returned with themeta
argument.- Parameters:
- resource_type
type
[ResourceT
] A Pydantic subclass used to validate the response from the FLAME Hub. This should be a model that validates all attributes a resource can have. In other terms, do not pass one of the models that start with Create or Update since this method performs a
GET
request.- *path
str
A string or multiple strings that define the endpoint.
- fields
FieldParams
, optional Extend the default resource field selection by explicitly name one or more field names.
- include
IncludeParams
, optional Extend the default resource fields by explicitly list resource names to nest in the response. See the model specifications which resources can be included in other resources.
- **params
Unpack
[FindAllKwargs
] Further keyword arguments to define filtering, sorting and pagination conditions, adding optional fields to a response and returning meta information.
- resource_type
- Returns:
list
[ResourceT
] |tuple
[list
[ResourceT
],ResourceListMeta
]All resources of type
resource_type
that match the criteria defined in**params
. If no criteria are defined, it returns the default paginated resources according toDEFAULT_PAGE_PARAMS
. Ifmeta=True
, this method returns meta information about the result and the requested resource type as a second value.
- Raises:
HubAPIError
If the status code of the response does not match 200.
ValidationError
If the resources returned by the Hub instance do not validate with the given
resource_type
.
See also
- _create_resource(resource_type: type[ResourceT], resource: BaseModel, *path: str) ResourceT
Create a resource of a certain type at the specified path.
The FLAME Hub responds with the created resource which is then validated with
resource_type
and returned by this method.- Parameters:
- resource_type
type
[ResourceT
] A Pydantic subclass used to validate the response from the FLAME Hub. This should be a model that validates all attributes a resource can have. In other terms, do not pass one of the models that start with Create or Update since this method performs a
GET
request.- resource
BaseModel
This has to be the corresponding creation model for
resource_type
. All creation models follow a naming convention with a prefixed Create. See the model specifications for a list of all available models.- *path
str
Path to the endpoint where the resource should be created.
- resource_type
- Returns:
ResourceT
Validated resource that was just created.
- Raises:
HubAPIError
If the status code of the response does not match 201.
ValidationError
If the resource returned by the Hub instance does not validate with the given
resource_type
.
- _get_single_resource(resource_type: type[ResourceT], *path: str | UuidModel | UUID, include: str | Iterable[str] = None, **params: Unpack[GetKwargs]) ResourceT | None
Get a single resource of a certain type at the specified path.
This method accesses the endpoint
*path
and returns the resource of typeresource_type
. In contrast to_get_all_resources()
*path
must point to one specific resource of the specified type.- Parameters:
- resource_type
type
[ResourceT
] A Pydantic subclass used to validate the response from the FLAME Hub. This should be a model that validates all attributes a resource can have. In other terms, do not pass one of the models that start with Create or Update since this method performs a
GET
request.- *path
str
|UuidIdentifiable
A string or multiple strings that define the endpoint. Since the last component of the path is a UUID of a specific resource, it is also possible to pass in an
UUID
object or a model with anid
attribute.- fields
FieldParams
, optional Extend the default resource field selection by explicitly name one or more field names.
- include
IncludeParams
, optional Extend the default resource fields by explicitly list resource names to nest in the response. See the model specifications which resources can be included in other resources.
- resource_type
- Returns:
- Raises:
HubAPIError
If the status code of the response does not match 200 or 404.
ValidationError
If the resource returned by the Hub instance does not validate with the given
resource_type
.
See also
Notes
meta
has no relevance for this method.
- _update_resource(resource_type: type[ResourceT], resource: BaseModel, *path: str | UuidModel | UUID) ResourceT
Update a resource of a certain type at the specified path.
The FLAME Hub responds with the updated resource which is then validated with
resource_type
and returned by this method.- Parameters:
- resource_type
type
[ResourceT
] A Pydantic subclass used to validate the response from the FLAME Hub. This should be a model that validates all attributes a resource can have. In other terms, do not pass one of the models that start with Create or Update since this method performs a
GET
request.- resource
BaseModel
This has to be the corresponding update model for
resource_type
. All update models follow a naming convention with a prefixed Update. See the model specifications for a list of all available models.- *path
str
|UuidIdentifiable
A string or multiple strings that define the endpoint. Since the last component of the path is a UUID of a specific resource, it is also possible to pass in an
UUID
object or a model with anid
attribute.
- resource_type
- Returns:
ResourceT
Validated resource that was just updated.
- Raises:
HubAPIError
If the status code of the response does not match 202.
ValidationError
If the resource returned by the Hub instance does not validate with the given
resource_type
.
- _delete_resource(*path: str | UuidModel | UUID)
Delete a resource of a certain type at the specified path.
- Parameters:
- *path
str
|UuidIdentifiable
A string or multiple strings that define the endpoint. Since the last component of the path is a UUID of a specific resource, it is also possible to pass in an
UUID
object or a model with anid
attribute.
- *path
- Raises:
HubAPIError
If the status code of the response does not match 202.
- class flame_hub.AuthClient(base_url='https://auth.privateaim.dev', auth: RobotAuth | PasswordAuth = None, **kwargs: Unpack[ClientKwargs])
Bases:
BaseClient
The client which implements all auth endpoints.
This class passes its arguments through to
BaseClient
. Check the documentation of that class for further information. Note thatbase_url
defaultsDEFAULT_AUTH_BASE_URL
.See also
- find_realms(**params: Unpack[FindAllKwargs]) list[Realm]
- update_realm(realm_id: ~flame_hub._auth_client.Realm | str | ~uuid.UUID, name: str = <class 'flame_hub._base_client._UNSET'>, display_name: str = <class 'flame_hub._base_client._UNSET'>, description: str = <class 'flame_hub._base_client._UNSET'>) Realm
- create_robot(name: str, realm_id: Realm | str | UUID, secret: str, display_name: str = None) Robot
- update_robot(robot_id: ~flame_hub._auth_client.Robot | str | ~uuid.UUID, name: str = <class 'flame_hub._base_client._UNSET'>, display_name: str = <class 'flame_hub._base_client._UNSET'>, realm_id: ~flame_hub._auth_client.Realm | str | ~uuid.UUID = <class 'flame_hub._base_client._UNSET'>, secret: str = <class 'flame_hub._base_client._UNSET'>) Robot
- find_robots(**params: Unpack[FindAllKwargs]) list[Robot]
- create_permission(name: str, display_name: str = None, description: str = None, realm_id: Realm | UUID | str = None) Permission
- get_permission(permission_id: Permission | UUID | str, **params: Unpack[GetKwargs]) Permission | None
- delete_permission(permission_id: Permission | UUID | str)
- update_permission(permission_id: ~flame_hub._auth_client.Permission | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, display_name: str = <class 'flame_hub._base_client._UNSET'>, description: str = <class 'flame_hub._base_client._UNSET'>, realm_id: ~flame_hub._auth_client.Realm | ~uuid.UUID | str = <class 'flame_hub._base_client._UNSET'>) Permission
- get_permissions(**params: Unpack[GetKwargs]) list[Permission]
- find_permissions(**params: Unpack[FindAllKwargs]) list[Permission]
- update_role(role_id: ~flame_hub._auth_client.Role | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, display_name: str = <class 'flame_hub._base_client._UNSET'>, description: str = <class 'flame_hub._base_client._UNSET'>) Role
- find_roles(**params: Unpack[FindAllKwargs]) list[Role]
- create_role_permission(role_id: Role | UUID | str, permission_id: Permission | UUID | str) RolePermission
- get_role_permission(role_permission_id: RolePermission | UUID | str, **params: Unpack[GetKwargs]) RolePermission | None
- delete_role_permission(role_permission_id: RolePermission | UUID | str)
- get_role_permissions(**params: Unpack[GetKwargs]) list[RolePermission]
- find_role_permissions(**params: Unpack[FindAllKwargs]) list[RolePermission]
- create_user(name: str, display_name: str = None, email: str = None, active: bool = True, name_locked: bool = True, first_name: str = None, last_name: str = None, password: str = None) User
- update_user(user_id: ~flame_hub._auth_client.User | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, display_name: str = <class 'flame_hub._base_client._UNSET'>, email: str = <class 'flame_hub._base_client._UNSET'>, active: bool = <class 'flame_hub._base_client._UNSET'>, name_locked: bool = <class 'flame_hub._base_client._UNSET'>, first_name: str = <class 'flame_hub._base_client._UNSET'>, last_name: str = <class 'flame_hub._base_client._UNSET'>, password: str = <class 'flame_hub._base_client._UNSET'>) User
- find_users(**params: Unpack[FindAllKwargs]) list[User]
- create_user_permission(user_id: User | UUID | str, permission_id: Permission | UUID | str) UserPermission
- get_user_permission(user_permission_id: UserPermission | UUID | str, **params: Unpack[GetKwargs]) UserPermission | None
- delete_user_permission(user_permission_id: UserPermission | UUID | str)
- get_user_permissions(**params: Unpack[GetKwargs]) list[UserPermission]
- find_user_permissions(**params: Unpack[FindAllKwargs]) list[UserPermission]
- find_user_roles(**params: Unpack[FindAllKwargs]) list[UserRole]
- create_robot_permission(robot_id: Robot | UUID | str, permission_id: Permission | UUID | str) RobotPermission
- get_robot_permission(robot_permission_id: RobotPermission | UUID | str, **params: Unpack[GetKwargs]) RobotPermission | None
- delete_robot_permission(robot_permission_id: RobotPermission | UUID | str)
- get_robot_permissions(**params: Unpack[GetKwargs]) list[RobotPermission]
- find_robot_permissions(**params: Unpack[FindAllKwargs]) list[RobotPermission]
- get_robot_role(robot_role_id: RobotRole | UUID | str, **params: Unpack[GetKwargs]) RobotRole | None
- find_robot_roles(**params: Unpack[FindAllKwargs]) list[RobotRole]
- class flame_hub.CoreClient(base_url: str = 'https://core.privateaim.dev', auth: PasswordAuth | RobotAuth = None, **kwargs: Unpack[ClientKwargs])
Bases:
BaseClient
The client which implements all core endpoints.
This class passes its arguments through to
BaseClient
. Check the documentation of that class for further information. Note thatbase_url
defaultsDEFAULT_CORE_BASE_URL
.See also
- find_nodes(**params: Unpack[FindAllKwargs]) list[Node]
- create_node(name: str, realm_id: Realm | str | UUID = None, registry_id: Registry | UUID | str = None, external_name: str | None = None, node_type: flame_hub.types.NodeType = 'default', hidden: bool = False) Node
- update_node(node_id: ~flame_hub._core_client.Node | ~uuid.UUID | str, external_name: str = <class 'flame_hub._base_client._UNSET'>, hidden: bool = <class 'flame_hub._base_client._UNSET'>, node_type: flame_hub.types.NodeType = <class 'flame_hub._base_client._UNSET'>, realm_id: ~flame_hub._auth_client.Realm | str | ~uuid.UUID = <class 'flame_hub._base_client._UNSET'>, registry_id: ~flame_hub._core_client.Registry | str | ~uuid.UUID = <class 'flame_hub._base_client._UNSET'>, public_key: str = <class 'flame_hub._base_client._UNSET'>) Node
- get_master_image_groups(**params: Unpack[GetKwargs]) list[MasterImageGroup]
- get_master_image_group(master_image_group_id: MasterImageGroup | UUID | str, **params: Unpack[GetKwargs]) MasterImageGroup | None
- find_master_image_groups(**params: Unpack[FindAllKwargs]) list[MasterImageGroup]
- get_master_images(**params: Unpack[GetKwargs]) list[MasterImage]
- get_master_image(master_image_id: MasterImage | UUID | str, **params: Unpack[GetKwargs]) MasterImage | None
- find_master_images(**params: Unpack[FindAllKwargs]) list[MasterImage]
- get_master_image_event_log(master_image_event_log_id: MasterImageEventLog | UUID | str, **params: Unpack[GetKwargs]) MasterImageEventLog | None
- get_master_image_event_logs(**params: Unpack[GetKwargs]) list[MasterImageEventLog]
- find_master_image_event_logs(**params: Unpack[FindAllKwargs]) list[MasterImageEventLog]
- find_projects(**params: Unpack[FindAllKwargs]) list[Project]
- sync_master_images()
This method will start to synchronize the master images. Note that an error is raised if you request a synchronization while the Hub instance is still synchronizing master images.
- create_project(name: str, master_image_id: MasterImage | UUID | str = None, description: str = None) Project
- update_project(project_id: ~flame_hub._core_client.Project | ~uuid.UUID | str, description: str = <class 'flame_hub._base_client._UNSET'>, master_image_id: ~flame_hub._core_client.MasterImage | str | ~uuid.UUID = <class 'flame_hub._base_client._UNSET'>, name: str = <class 'flame_hub._base_client._UNSET'>) Project
- delete_project_node(project_node_id: ProjectNode | UUID | str)
- get_project_nodes(**params: Unpack[GetKwargs]) list[ProjectNode]
- find_project_nodes(**params: Unpack[FindAllKwargs]) list[ProjectNode]
- get_project_node(project_node_id: ProjectNode | UUID | str, **params: Unpack[GetKwargs]) ProjectNode | None
- update_project_node(project_node_id: ~flame_hub._core_client.ProjectNode | ~uuid.UUID | str, comment: str = <class 'flame_hub._base_client._UNSET'>, approval_status: flame_hub.types.ProjectNodeApprovalStatus = <class 'flame_hub._base_client._UNSET'>)
- create_analysis(project_id: Project | UUID | str, name: str = None, description: str = None, master_image_id: MasterImage | UUID | str = None, registry_id: Registry | UUID | str = None, image_command_arguments: list[MasterImageCommandArgument] = ()) Analysis
- find_analyses(**params: Unpack[FindAllKwargs]) list[Analysis]
- update_analysis(analysis_id: ~flame_hub._core_client.Analysis | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, description: str = <class 'flame_hub._base_client._UNSET'>, master_image_id: ~flame_hub._core_client.MasterImage | ~uuid.UUID | str = <class 'flame_hub._base_client._UNSET'>, image_command_arguments: list[~flame_hub._core_client.MasterImageCommandArgument] = <class 'flame_hub._base_client._UNSET'>) Analysis
- send_analysis_command(analysis_id: Analysis | UUID | str, command: flame_hub.types.AnalysisCommand) Analysis
- delete_analysis_node(analysis_node_id: AnalysisNode | UUID | str)
- update_analysis_node(analysis_node_id: ~flame_hub._core_client.AnalysisNode | ~uuid.UUID | str, comment: str = <class 'flame_hub._base_client._UNSET'>, approval_status: flame_hub.types.AnalysisNodeApprovalStatus = <class 'flame_hub._base_client._UNSET'>, run_status: flame_hub.types.AnalysisNodeRunStatus = <class 'flame_hub._base_client._UNSET'>) AnalysisNode
- get_analysis_node(analysis_node_id: AnalysisNode | UUID | str, **params: Unpack[GetKwargs]) AnalysisNode | None
- get_analysis_nodes(**params: Unpack[GetKwargs]) list[AnalysisNode]
- find_analysis_nodes(**params: Unpack[FindAllKwargs]) list[AnalysisNode]
- create_analysis_node_log(analysis_id: Analysis | UUID | str, node_id: Node | UUID | str, error: bool, error_code: str = None, status: str = '', status_message: str = None) AnalysisNodeLog
- get_analysis_node_log(analysis_node_log_id: AnalysisNodeLog | UUID | str, **params: Unpack[GetKwargs]) AnalysisNodeLog | None
- delete_analysis_node_log(analysis_node_log_id: AnalysisNodeLog | UUID | str)
- get_analysis_node_logs(**params: Unpack[GetKwargs]) list[AnalysisNodeLog]
- find_analysis_node_logs(**params: Unpack[FindAllKwargs]) list[AnalysisNodeLog]
- update_analysis_node_log(analysis_node_log_id: ~flame_hub._core_client.AnalysisNodeLog | ~uuid.UUID | str, error: bool = <class 'flame_hub._base_client._UNSET'>, error_code: str = <class 'flame_hub._base_client._UNSET'>, status: str = <class 'flame_hub._base_client._UNSET'>, status_message: str = <class 'flame_hub._base_client._UNSET'>) AnalysisNodeLog
- get_analysis_buckets(**params: Unpack[GetKwargs]) list[AnalysisBucket]
- find_analysis_buckets(**params: Unpack[FindAllKwargs]) list[AnalysisBucket]
- get_analysis_bucket(analysis_bucket_id: AnalysisBucket | UUID | str, **params: Unpack[GetKwargs]) AnalysisBucket | None
- get_analysis_bucket_files(**params: Unpack[GetKwargs]) list[AnalysisBucketFile]
- find_analysis_bucket_files(**params: Unpack[FindAllKwargs]) list[AnalysisBucketFile]
- get_analysis_bucket_file(analysis_bucket_file_id: AnalysisBucketFile | UUID | str, **params: Unpack[GetKwargs]) AnalysisBucketFile | None
- delete_analysis_bucket_file(analysis_bucket_file_id: AnalysisBucketFile | UUID | str) AnalysisBucketFile | None
- create_analysis_bucket_file(name: str, bucket_file_id: BucketFile | UUID | str, analysis_bucket_id: AnalysisBucket | UUID | str, is_entrypoint: bool = False) AnalysisBucketFile
- update_analysis_bucket_file(analysis_bucket_file_id: ~flame_hub._core_client.AnalysisBucketFile | ~uuid.UUID | str, is_entrypoint: bool = <class 'flame_hub._base_client._UNSET'>) AnalysisBucketFile
- create_registry(name: str, host: str, account_name: str = None, account_secret: str = None) Registry
- update_registry(registry_id: ~flame_hub._core_client.Registry | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, host: str = <class 'flame_hub._base_client._UNSET'>, account_name: str = <class 'flame_hub._base_client._UNSET'>, account_secret: str = <class 'flame_hub._base_client._UNSET'>) Registry
- find_registries(**params: Unpack[FindAllKwargs]) list[Registry]
- create_registry_project(name: str, registry_project_type: flame_hub.types.RegistryProjectType, registry_id: Registry | UUID | str, external_name: str) RegistryProject
- get_registry_project(registry_project_id: RegistryProject | UUID | str, **params: Unpack[GetKwargs]) RegistryProject | None
- delete_registry_project(registry_project_id: RegistryProject | UUID | str)
- update_registry_project(registry_project_id: ~flame_hub._core_client.RegistryProject | ~uuid.UUID | str, name: str = <class 'flame_hub._base_client._UNSET'>, registry_project_type: flame_hub.types.RegistryProjectType = <class 'flame_hub._base_client._UNSET'>, registry_id: ~flame_hub._core_client.Registry | ~uuid.UUID | str = <class 'flame_hub._base_client._UNSET'>, external_name: str = <class 'flame_hub._base_client._UNSET'>) RegistryProject
- get_registry_projects(**params: Unpack[GetKwargs]) list[RegistryProject]
- find_registry_projects(**params: Unpack[FindAllKwargs]) list[RegistryProject]
- get_analysis_log(analysis_log_id: AnalysisLog | UUID | str, **params: Unpack[GetKwargs]) AnalysisLog | None
- delete_analysis_log(analysis_log_id: AnalysisLog | UUID | str)
- get_analysis_logs(**params: Unpack[GetKwargs]) list[AnalysisLog]
- find_analysis_logs(**params: Unpack[FindAllKwargs]) list[AnalysisLog]
- class flame_hub.StorageClient(base_url: str = 'https://storage.privateaim.dev', auth: PasswordAuth | RobotAuth = None, **kwargs: Unpack[ClientKwargs])
Bases:
BaseClient
The client which implements all storage endpoints.
This class passes its arguments through to
BaseClient
. Check the documentation of that class for further information. Note thatbase_url
defaultsDEFAULT_STORAGE_BASE_URL
.See also
- find_buckets(**params: Unpack[FindAllKwargs]) list[Bucket]
- upload_to_bucket(bucket_id: Bucket | str | UUID, *upload_file: UploadFile) list[BucketFile]
- delete_bucket_file(bucket_file_id: BucketFile | str | UUID)
- get_bucket_file(bucket_file_id: BucketFile | str | UUID, **params: Unpack[GetKwargs]) BucketFile | None
- get_bucket_files(**params: Unpack[GetKwargs]) list[BucketFile]
- find_bucket_files(**params: Unpack[FindAllKwargs]) list[BucketFile]