api key expiry date

Change-type: patch
This commit is contained in:
myarmolinsky 2024-12-02 16:56:27 -05:00
parent ccf97cfc9f
commit 8dea1333ca
2 changed files with 12 additions and 1 deletions

View File

@ -333,6 +333,10 @@ Examples:
the API key name
#### EXPIRYDATE
the API key expiry date
## api-key list
### Aliases

View File

@ -48,6 +48,10 @@ export default class GenerateCmd extends Command {
description: 'the API key name',
required: true,
}),
expiryDate: Args.string({
description: 'the API key expiry date',
required: true,
}),
};
public static authenticated = true;
@ -57,7 +61,10 @@ export default class GenerateCmd extends Command {
let key;
try {
key = await getBalenaSdk().models.apiKey.create(params.name);
key = await getBalenaSdk().models.apiKey.create(
params.name,
params.expiryDate,
);
} catch (e) {
if (e.name === 'BalenaNotLoggedIn') {
if (await isLoggedInWithJwt()) {