The page you navigated to () does not exist, so we brought you to the closest page to it.
You have switched from the to the variant of this site. There is no equivalent of . We have taken you to the closest page in the variant.
ApiKey
Package: flyteplugins.union.remote
Represents a Union API Key (OAuth Application).
API Keys in Union are OAuth 2.0 applications that can be used for headless authentication. They support client credentials flow for machine-to-machine authentication.
Parameters
class ApiKey(
pb2: App,
organization: str | None,
encoded_credentials: str | None,
)| Parameter | Type | Description |
|---|---|---|
pb2 |
App |
The underlying protobuf App message |
organization |
str | None |
The organization this API key belongs to (for serverless) |
encoded_credentials |
str | None |
Base64-encoded credentials for UNION_API_KEY env var |
Properties
| Property | Type | Description |
|---|---|---|
client_id |
None |
The OAuth client ID. |
client_name |
None |
The human-readable name of the API key. |
client_secret |
None |
The OAuth client secret (only available on creation). |
Methods
| Method | Description |
|---|---|
create() |
Create a new API key. |
delete() |
Delete an API key. |
get() |
Get an API key by client ID. |
listall() |
List all API keys. |
to_dict() |
Convert the object to a JSON-serializable dictionary. |
to_json() |
Convert the object to a JSON string. |
update() |
Update an API key. |
create()
Default invocation is sync and will block.
To call it asynchronously, use the function .aio() on the method name itself, e.g.,:
result = await ApiKey.create.aio().
def create(
cls,
name: str,
redirect_uris: list[str] | None,
) -> ApiKeyCreate a new API key.
| Parameter | Type | Description |
|---|---|---|
cls |
||
name |
str |
Human-readable name for the API key |
redirect_uris |
list[str] | None |
OAuth redirect URIs (defaults to localhost callback) |
Returns
ApiKey instance with client_secret populated
Raises
| Exception | Description |
|---|---|
Exception |
If API key creation fails |
delete()
Default invocation is sync and will block.
To call it asynchronously, use the function .aio() on the method name itself, e.g.,:
result = await ApiKey.delete.aio().
def delete(
cls,
client_id: str,
)Delete an API key.
| Parameter | Type | Description |
|---|---|---|
cls |
||
client_id |
str |
The OAuth client ID to delete |
Raises
| Exception | Description |
|---|---|
Exception |
If deletion fails |
get()
Default invocation is sync and will block.
To call it asynchronously, use the function .aio() on the method name itself, e.g.,:
result = await ApiKey.get.aio().
def get(
cls,
client_id: str,
) -> ApiKeyGet an API key by client ID.
| Parameter | Type | Description |
|---|---|---|
cls |
||
client_id |
str |
The OAuth client ID |
Returns
ApiKey instance
Raises
| Exception | Description |
|---|---|
Exception |
If API key not found |
listall()
Default invocation is sync and will block.
To call it asynchronously, use the function .aio() on the method name itself, e.g.,:
result = await ApiKey.listall.aio().
def listall(
cls,
limit: int,
) -> AsyncIterator[ApiKey]List all API keys.
Yields: ApiKey instances
| Parameter | Type | Description |
|---|---|---|
cls |
||
limit |
int |
Maximum number of keys to return |
to_dict()
def to_dict()Convert the object to a JSON-serializable dictionary.
Returns: dict: A dictionary representation of the object.
to_json()
def to_json()Convert the object to a JSON string.
Returns: str: A JSON string representation of the object.
update()
Default invocation is sync and will block.
To call it asynchronously, use the function .aio() on the method name itself, e.g.,:
result = await ApiKey.update.aio().
def update(
cls,
client_id: str,
client_name: str | None,
redirect_uris: list[str] | None,
) -> ApiKeyUpdate an API key.
| Parameter | Type | Description |
|---|---|---|
cls |
||
client_id |
str |
The OAuth client ID to update |
client_name |
str | None |
New name for the API key |
redirect_uris |
list[str] | None |
New redirect URIs |
Returns
Updated ApiKey instance
Raises
| Exception | Description |
|---|---|
Exception |
If update fails |