License Manager API Reference
Configuration Routes
lm_api.api.routes.configurations
create_configuration
async
create_configuration(configuration: ConfigurationCompleteCreateSchema = Body(..., description='Configuration to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_CREATE)))
Create a new configuration.
The features for the configuration will be specified in the request body. If the feature's product doesn't exist, it will be created.
delete_configuration
async
delete_configuration(configuration_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_DELETE)))
Delete a configuration from the database.
This will also delete the features and license servers associated.
read_all_configurations
async
read_all_configurations(search: Optional[str] = Query(None), sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_READ, commit=False)))
Return all configurations with the associated license servers and features.
read_configuration
async
read_configuration(configuration_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_READ, commit=False)))
Return a configuration with the associated license severs and features with a given id.
read_configurations_by_client_id
async
read_configurations_by_client_id(secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_READ, commit=False)))
Return the configurations with the specified client_id.
update_configuration
async
update_configuration(configuration_id: int, configuration_update: ConfigurationCompleteUpdateSchema, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.CONFIG_UPDATE)))
Update a configuration in the database.
If there are features in the payload, they'll be updated if they have an id, or they will be created if the id is None.
If there are license servers in the payload, they'll updated if they have an id, or they will be created if the id is None.
All resources related to the configuration that aren't present in the payload will be deleted.
Configuration Schemas
lm_api.api.schemas.configuration
Configuration schemas for the License Manager API.
ConfigurationCompleteCreateSchema
pydantic-model
Bases: BaseCreateSchema
Represents the data to create a complete configuration.
Includes the features and the license servers.
Fields:
-
name
(str
) -
cluster_client_id
(str
) -
grace_time
(int
) -
type
(LicenseServerType
) -
features
(List[FeatureWithoutConfigIdCreateSchema]
) -
license_servers
(List[LicenseServerWithoutConfigIdCreateSchema]
)
cluster_client_id
pydantic-field
The client ID of the cluster that will use this configuration.
features
pydantic-field
The features of the configuration.
grace_time
pydantic-field
The grace time in seconds for the license's bookings to be retained.
license_servers
pydantic-field
The license servers of the configuration.
ConfigurationCompleteUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
Represents the data to update a complete configuration.
Includes the features and the license servers.
Fields:
-
name
(Optional[str]
) -
cluster_client_id
(Optional[str]
) -
grace_time
(Optional[int]
) -
type
(Optional[LicenseServerType]
) -
features
(Optional[List[FeatureWithOptionalIdUpdateSchema]]
) -
license_servers
(Optional[List[LicenseServerWithOptionalIdUpdateSchema]]
)
cluster_client_id
pydantic-field
The client ID of the cluster that will use this configuration.
features
pydantic-field
The features of the configuration.
grace_time
pydantic-field
The grace time in seconds for the license's bookings to be retained.
license_servers
pydantic-field
The license servers of the configuration.
ConfigurationCreateSchema
pydantic-model
Bases: BaseCreateSchema
Represents the configuration for a set of features.
Fields:
-
name
(str
) -
cluster_client_id
(str
) -
grace_time
(int
) -
type
(LicenseServerType
)
cluster_client_id
pydantic-field
The client ID of the cluster that will use this configuration.
grace_time
pydantic-field
The grace time in seconds for the license's bookings to be retained.
ConfigurationSchema
pydantic-model
Bases: BaseModel
Represents the configuration for a set of features.
Config:
from_attributes
:True
Fields:
-
id
(int
) -
name
(str
) -
cluster_client_id
(str
) -
features
(List[FeatureSchema]
) -
license_servers
(List[LicenseServerSchema]
) -
grace_time
(PositiveInt
) -
type
(LicenseServerType
)
cluster_client_id
pydantic-field
The client ID of the cluster that will use this configuration.
grace_time
pydantic-field
The grace time in seconds for the license's bookings to be retained.
license_servers
pydantic-field
The license servers of the configuration.
ConfigurationUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
Represents the data for a configuration update.
Fields:
-
name
(Optional[str]
) -
cluster_client_id
(Optional[str]
) -
grace_time
(Optional[int]
) -
type
(Optional[LicenseServerType]
)
cluster_client_id
pydantic-field
The client ID of the cluster that will use this configuration.
grace_time
pydantic-field
The grace time in seconds for the license's bookings to be retained.
License Servers Routes
lm_api.api.routes.license_servers
create_license_server
async
create_license_server(license_server: LicenseServerCreateSchema = Body(..., description='License server to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_CREATE)))
Create a new license server.
delete_license_server
async
delete_license_server(license_server_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_DELETE)))
Delete a license server from the database.
get_license_server_types
async
get_license_server_types(secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_READ, commit=False)))
Return a list of the available license server types.
read_all_license_servers
async
read_all_license_servers(search: Optional[str] = Query(None), sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_READ, commit=False)))
Return all license servers.
License Servers Schemas
lm_api.api.schemas.license_server
License Server schemas for the License Manager API.
LicenseServerCreateSchema
pydantic-model
Bases: BaseCreateSchema
License server to be created in the database.
Fields:
Validators:
LicenseServerSchema
pydantic-model
Bases: BaseModel
License server response from the database.
Config:
from_attributes
:True
Fields:
LicenseServerUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
License server to be updated in the database.
Fields:
Validators:
LicenseServerWithOptionalIdUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
License server to be updated in the database.
Fields:
Validators:
LicenseServerWithoutConfigIdCreateSchema
pydantic-model
Bases: BaseCreateSchema
License server to be created by configurations endpoint.
The config_id will be handled in the endpoint.
Fields:
Validators:
Products Routes
lm_api.api.routes.products
create_product
async
create_product(product: ProductCreateSchema = Body(..., description='Product to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.PRODUCT_CREATE)))
Create a new product.
delete_product
async
delete_product(product_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.PRODUCT_DELETE)))
Delete a product from the database and associated features.
read_all_products
async
read_all_products(search: Optional[str] = Query(None), sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.PRODUCT_READ, commit=False)))
Return all products with associated features.
Products Schemas
lm_api.api.schemas.product
Product schemas for the License Manager API.
Features Routes
lm_api.api.routes.features
bulk_update_feature
async
bulk_update_feature(features: List[FeatureUpdateByNameSchema], secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_UPDATE)))
Update a list of features in the database using the name of each feature. Since the name is not unique across clusters, the client_id in the token is used to identify the cluster.
create_feature
async
create_feature(feature: FeatureCreateSchema = Body(..., description='Feature to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_CREATE)))
Create a new feature
delete_feature
async
delete_feature(feature_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_DELETE)))
Delete a feature from the database.
read_all_features
async
read_all_features(search: Optional[str] = Query(None), sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_READ, commit=False)))
Return all features with associated bookings.
Features Schemas
lm_api.api.schemas.feature
Feature schemas for the License Manager API.
FeatureCreateSchema
pydantic-model
Bases: BaseCreateSchema
Represents the features in a feature configuration.
Fields:
-
name
(str
) -
product_id
(int
) -
config_id
(int
) -
reserved
(int
)
FeatureSchema
pydantic-model
Bases: BaseModel
Represents the features in a feature configuration.
Config:
from_attributes
:True
Fields:
-
id
(int
) -
name
(str
) -
product
(ProductSchema
) -
config_id
(int
) -
reserved
(NonNegativeInt
) -
total
(NonNegativeInt
) -
used
(NonNegativeInt
) -
booked_total
(Optional[NonNegativeInt]
)
booked_total
pydantic-field
The total quantity of licenses that are booked.
reserved
pydantic-field
The quantity of the feature that is reserved for usage in desktop environments.
FeatureUpdateByNameSchema
pydantic-model
Bases: BaseUpdateSchema
Represents the feature usage data that will be updated using the product and feature name as a filter.
Fields:
-
product_name
(str
) -
feature_name
(str
) -
total
(int
) -
used
(int
)
FeatureUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
Represents the features in a feature configuration.
Fields:
-
name
(Optional[str]
) -
product_id
(Optional[int]
) -
config_id
(Optional[int]
) -
reserved
(Optional[int]
) -
total
(Optional[int]
) -
used
(Optional[int]
)
config_id
pydantic-field
The ID of the configuration that the feature belongs to.
reserved
pydantic-field
The quantity of the feature that is reserved for usage in desktop environments.
FeatureWithOptionalIdUpdateSchema
pydantic-model
Bases: BaseUpdateSchema
Feature to be updated in the database.
Fields:
-
id
(Optional[int]
) -
name
(Optional[str]
) -
product_id
(Optional[int]
) -
reserved
(Optional[int]
)
FeatureWithoutConfigIdCreateSchema
pydantic-model
Bases: BaseCreateSchema
Represents the features in a feature configuration.
Fields:
-
name
(str
) -
product_id
(int
) -
reserved
(int
)
Jobs Routes
lm_api.api.routes.jobs
create_job
async
create_job(job: JobWithBookingCreateSchema = Body(..., description='Job to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_CREATE)))
Create a new job.
delete_job
async
delete_job(job_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_DELETE)))
Delete a job from the database and associated bookings.
delete_job_by_slurm_id
async
delete_job_by_slurm_id(slurm_job_id: str, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_DELETE)))
Delete a job from the database and associated bookings.
Uses the slurm_job_id and the cluster client_id to filter the job.
Since the slurm_job_id can be the same across clusters, we need the cluster client_id to validate.
read_all_jobs
async
read_all_jobs(search: Optional[str] = Query(None), sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_READ, commit=False)))
Return all jobs.
read_job
async
read_job(job_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_READ, commit=False)))
Return a job with associated bookings with the given id.
read_job_by_slurm_id
async
read_job_by_slurm_id(slurm_job_id: str, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_READ, commit=False)))
Read a job from the database and associated bookings.
Uses the slurm_job_id and the cluster client_id to filter the job.
Since the slurm_job_id can be the same across clusters, we need the cluster client_id to validate.
Jobs Schemas
lm_api.api.routes.bookings
create_booking
async
create_booking(booking: BookingCreateSchema = Body(..., description='Booking to be created'), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.BOOKING_CREATE)))
Create a new booking.
delete_booking
async
delete_booking(booking_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.BOOKING_DELETE)))
Delete a booking from the database.