Skip to content

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:

cluster_client_id pydantic-field
cluster_client_id: str

The client ID of the cluster that will use this configuration.

features pydantic-field
features: List[FeatureWithoutConfigIdCreateSchema]

The features of the configuration.

grace_time pydantic-field
grace_time: int = 60

The grace time in seconds for the license's bookings to be retained.

license_servers pydantic-field
license_servers: List[LicenseServerWithoutConfigIdCreateSchema]

The license servers of the configuration.

name pydantic-field
name: str

The name of the configuration.

type pydantic-field
type: LicenseServerType

The type of license server that provides the license.

ConfigurationCompleteUpdateSchema pydantic-model

Bases: BaseUpdateSchema

Represents the data to update a complete configuration.

Includes the features and the license servers.

Fields:

cluster_client_id pydantic-field
cluster_client_id: Optional[str] = None

The client ID of the cluster that will use this configuration.

features pydantic-field
features: Optional[List[FeatureWithOptionalIdUpdateSchema]] = None

The features of the configuration.

grace_time pydantic-field
grace_time: Optional[int] = None

The grace time in seconds for the license's bookings to be retained.

license_servers pydantic-field
license_servers: Optional[List[LicenseServerWithOptionalIdUpdateSchema]] = None

The license servers of the configuration.

name pydantic-field
name: Optional[str] = None

The name of the configuration.

type pydantic-field
type: Optional[LicenseServerType] = None

The type of license server that provides the license.

ConfigurationCreateSchema pydantic-model

Bases: BaseCreateSchema

Represents the configuration for a set of features.

Fields:

cluster_client_id pydantic-field
cluster_client_id: str

The client ID of the cluster that will use this configuration.

grace_time pydantic-field
grace_time: int = 60

The grace time in seconds for the license's bookings to be retained.

name pydantic-field
name: str

The name of the configuration.

type pydantic-field
type: LicenseServerType

The type of license server that provides the license.

ConfigurationSchema pydantic-model

Bases: BaseModel

Represents the configuration for a set of features.

Config:

  • from_attributes: True

Fields:

cluster_client_id pydantic-field
cluster_client_id: str

The client ID of the cluster that will use this configuration.

features pydantic-field
features: List[FeatureSchema]

The features of the configuration.

grace_time pydantic-field
grace_time: PositiveInt

The grace time in seconds for the license's bookings to be retained.

id pydantic-field
id: int

The ID of the configuration.

license_servers pydantic-field
license_servers: List[LicenseServerSchema]

The license servers of the configuration.

name pydantic-field
name: str

The name of the configuration.

type pydantic-field
type: LicenseServerType

The type of license server that provides the license.

ConfigurationUpdateSchema pydantic-model

Bases: BaseUpdateSchema

Represents the data for a configuration update.

Fields:

cluster_client_id pydantic-field
cluster_client_id: Optional[str] = None

The client ID of the cluster that will use this configuration.

grace_time pydantic-field
grace_time: Optional[int] = None

The grace time in seconds for the license's bookings to be retained.

name pydantic-field
name: Optional[str] = None

The name of the configuration.

type pydantic-field
type: Optional[LicenseServerType] = None

The type of license server that provides the license.

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.

read_license_server async

read_license_server(license_server_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_READ, commit=False)))

Return a license server with the given id.

update_license_server async

update_license_server(license_server_id: int, license_server_update: LicenseServerUpdateSchema, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.LICENSE_SERVER_UPDATE)))

Update a license server in the database.

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:

  • validate_hosthost
  • validate_portport
config_id pydantic-field
config_id: int

The ID of the configuration that the license server belongs to.

host pydantic-field
host: str

The host of the license server.

port pydantic-field
port: PositiveInt

The port of the license server.

LicenseServerSchema pydantic-model

Bases: BaseModel

License server response from the database.

Config:

  • from_attributes: True

Fields:

config_id pydantic-field
config_id: int

The ID of the configuration that the license server belongs to.

host pydantic-field
host: str

The host of the license server.

id pydantic-field
id: int

The ID of the license server.

port pydantic-field
port: PositiveInt

The port of the license server.

LicenseServerUpdateSchema pydantic-model

Bases: BaseUpdateSchema

License server to be updated in the database.

Fields:

Validators:

  • validate_hosthost
  • validate_portport
config_id pydantic-field
config_id: Optional[int] = None

The ID of the configuration that the license server belongs to.

host pydantic-field
host: Optional[str] = None

The host of the license server.

port pydantic-field
port: Optional[PositiveInt] = None

The port of the license server.

LicenseServerWithOptionalIdUpdateSchema pydantic-model

Bases: BaseUpdateSchema

License server to be updated in the database.

Fields:

  • id (Optional[int])
  • host (Optional[str])
  • port (Optional[PositiveInt])

Validators:

  • validate_hosthost
  • validate_portport
host pydantic-field
host: Optional[str] = None

The host of the license server.

id pydantic-field
id: Optional[int] = None

The ID of the license server.

port pydantic-field
port: Optional[PositiveInt] = None

The port of the license server.

LicenseServerWithoutConfigIdCreateSchema pydantic-model

Bases: BaseCreateSchema

License server to be created by configurations endpoint.

The config_id will be handled in the endpoint.

Fields:

Validators:

  • validate_hosthost
  • validate_portport
host pydantic-field
host: str

The host of the license server.

port pydantic-field
port: PositiveInt

The port of the license server.

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.

read_product async

read_product(product_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.PRODUCT_READ, commit=False)))

Return a product with associated features with the given id.

update_product async

update_product(product_id: int, product_update: ProductUpdateSchema, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.PRODUCT_UPDATE)))

Update a product in the database.

Products Schemas

lm_api.api.schemas.product

Product schemas for the License Manager API.

ProductCreateSchema pydantic-model

Bases: BaseCreateSchema

Represents a feature's product.

Fields:

name pydantic-field
name: str

The name of the product.

ProductSchema pydantic-model

Bases: BaseModel

Represents a feature's product.

Config:

  • from_attributes: True

Fields:

id pydantic-field
id: int

The ID of the product.

name pydantic-field
name: str

The name of the product.

ProductUpdateSchema pydantic-model

Bases: BaseUpdateSchema

Represents a feature's product.

Fields:

  • name (Optional[str])
name pydantic-field
name: Optional[str] = None

The name of the product.

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.

read_feature async

read_feature(feature_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_READ, commit=False)))

Return a feature with associated bookings with the given id.

update_feature async

update_feature(feature_id: int, feature_update: FeatureUpdateSchema, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.FEATURE_UPDATE)))

Update a feature in the database.

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:

config_id pydantic-field
config_id: int

The ID of the configuration that the feature belongs to.

name pydantic-field
name: str

The name of the feature.

product_id pydantic-field
product_id: int

The ID of the product of the feature.

reserved pydantic-field
reserved: int = 0

The quantity of the feature that is reserved for usage in desktop environments.

FeatureSchema pydantic-model

Bases: BaseModel

Represents the features in a feature configuration.

Config:

  • from_attributes: True

Fields:

booked_total pydantic-field
booked_total: Optional[NonNegativeInt] = 0

The total quantity of licenses that are booked.

config_id pydantic-field
config_id: int

The ID of the configuration that the feature belongs to.

id pydantic-field
id: int

The ID of the feature.

name pydantic-field
name: str

The name of the feature.

product pydantic-field
product: ProductSchema

The product of the feature.

reserved pydantic-field
reserved: NonNegativeInt = 0

The quantity of the feature that is reserved for usage in desktop environments.

total pydantic-field
total: NonNegativeInt = 0

The total quantity of licenses.

used pydantic-field
used: NonNegativeInt = 0

The quantity of the feature that is used.

FeatureUpdateByNameSchema pydantic-model

Bases: BaseUpdateSchema

Represents the feature usage data that will be updated using the product and feature name as a filter.

Fields:

feature_name pydantic-field
feature_name: str

The name of the feature.

product_name pydantic-field
product_name: str

The name of the product.

total pydantic-field
total: int = 0

The total quantity of licenses.

used pydantic-field
used: int = 0

The quantity of the feature that is used.

FeatureUpdateSchema pydantic-model

Bases: BaseUpdateSchema

Represents the features in a feature configuration.

Fields:

config_id pydantic-field
config_id: Optional[int] = None

The ID of the configuration that the feature belongs to.

name pydantic-field
name: Optional[str] = None

The name of the feature.

product_id pydantic-field
product_id: Optional[int] = None

The ID of the product of the feature.

reserved pydantic-field
reserved: Optional[int] = None

The quantity of the feature that is reserved for usage in desktop environments.

total pydantic-field
total: Optional[int] = None

The total quantity of licenses.

used pydantic-field
used: Optional[int] = None

The quantity of the feature that is used.

FeatureWithOptionalIdUpdateSchema pydantic-model

Bases: BaseUpdateSchema

Feature to be updated in the database.

Fields:

id pydantic-field
id: Optional[int] = None

The ID of the feature.

name pydantic-field
name: Optional[str] = None

The name of the feature.

product_id pydantic-field
product_id: Optional[int] = None

The ID of the product of the feature.

reserved pydantic-field
reserved: Optional[int] = None

The quantity of the feature that is reserved for usage in desktop environments.

FeatureWithoutConfigIdCreateSchema pydantic-model

Bases: BaseCreateSchema

Represents the features in a feature configuration.

Fields:

name pydantic-field
name: str

The name of the feature.

product_id pydantic-field
product_id: int

The ID of the product of the feature.

reserved pydantic-field
reserved: int = 0

The quantity of the feature that is reserved for usage in desktop environments.

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.

read_jobs_by_client_id async

read_jobs_by_client_id(secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.JOB_READ, commit=False)))

Return the jobs with the specified OIDC client_id retrieved from the request.

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.

read_all_bookings async

read_all_bookings(sort_field: Optional[str] = Query(None), sort_ascending: bool = Query(True), secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.BOOKING_READ, commit=False)))

Return all bookings.

read_booking async

read_booking(booking_id: int, secure_session: SecureSession = Depends(secure_session(Permissions.ADMIN, Permissions.BOOKING_READ, commit=False)))

Return a booking with associated bookings with the given id.