Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions cmd/kosli/createApiKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const createApiKeyShortDesc = `Create an API key for a service account.`

const createApiKeyLongDesc = createApiKeyShortDesc + `

The key value is only returned once, at creation time, so make sure to store it securely.`
The key value is only returned once, at creation time, so make sure to store it securely.

Every API key expires. Without ^--expires-at^ the key is given the maximum allowed
lifetime, and an ^--expires-at^ beyond that maximum is capped to it.`
Comment thread
dangrondahl marked this conversation as resolved.

const createApiKeyExample = `
# create an API key for a service account:
Expand Down Expand Up @@ -67,7 +70,7 @@ func newCreateApiKeyCmd(out io.Writer) *cobra.Command {

cmd.Flags().StringVarP(&o.serviceAccount, "service-account", "s", "", serviceAccountNameFlag)
cmd.Flags().StringVarP(&o.payload.Description, "description", "d", "", apiKeyDescriptionFlag)
cmd.Flags().StringVarP(&o.expiresAt, "expires-at", "e", "", apiKeyExpiresAtFlag)
cmd.Flags().StringVarP(&o.expiresAt, "expires-at", "e", "", createApiKeyExpiresAtFlag)
cmd.Flags().StringVarP(&o.output, "output", "o", "table", outputFlag)
addDryRunFlag(cmd)

Expand Down
5 changes: 3 additions & 2 deletions cmd/kosli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ Paths the list already matches stay excluded whatever is later added there, so k
serviceAccountPrivilegeFlag = "The privilege granted to the service account. One of: [" + validServiceAccountPrivilegesList + "]."
serviceAccountAssumeYesFlag = "[optional] Skip the confirmation prompt and delete the service account without asking. (alias: --yes)"
apiKeyDescriptionFlag = "A description for the API key."
apiKeyExpiresAtFlag = "[optional] When the API key expires. Accepts an epoch timestamp or a date like '2026-06-04', '2026-06-04 15:04:05', or an RFC3339 timestamp. Defaults to no expiry."
apiKeyGracePeriodHoursFlag = "[optional] How many hours the old API key remains valid after rotation, to allow time to update dependent systems. Defaults to the server-side value when not set."
createApiKeyExpiresAtFlag = "[optional] When the API key expires. Accepts an epoch timestamp or a date like '2026-06-04', '2026-06-04 15:04:05', or an RFC3339 timestamp. Keys always expire: when not set, the key gets the maximum allowed lifetime, which also caps later dates."
Comment thread
dangrondahl marked this conversation as resolved.
rotateApiKeyExpiresAtFlag = "[optional] When the new API key expires. Accepts an epoch timestamp or a date like '2026-06-04', '2026-06-04 15:04:05', or an RFC3339 timestamp. Defaults to the rotated key's current expiry, and is capped by the maximum allowed key lifetime."
Comment thread
dangrondahl marked this conversation as resolved.
apiKeyGracePeriodHoursFlag = "[optional] How many hours the old API key remains valid after rotation, to allow time to update dependent systems. Defaults to the standard grace period when not set."
apiKeyAssumeYesFlag = "[optional] Skip the confirmation prompt and delete the API key without asking. (alias: --yes)"
environmentNameFlag = "The environment name."
pageNumberFlag = "[defaulted] The page number of a response."
Expand Down
8 changes: 4 additions & 4 deletions cmd/kosli/rotateApiKey.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ const rotateApiKeyShortDesc = `Rotate one or more API keys for a service account
const rotateApiKeyLongDesc = rotateApiKeyShortDesc + `

A new API key is generated immediately. The old key remains valid for a grace period to
allow time to update dependent systems; the length of that grace period is server-managed
unless overridden with ^--grace-period-hours^. The new key value is only returned once, so
make sure to store it securely.`
allow time to update dependent systems; that grace period has a standard length unless
Comment thread
dangrondahl marked this conversation as resolved.
overridden with ^--grace-period-hours^. The new key value is only returned once, so make
sure to store it securely.`

const rotateApiKeyExample = `
# rotate an API key for a service account:
Expand Down Expand Up @@ -78,7 +78,7 @@ func newRotateApiKeyCmd(out io.Writer) *cobra.Command {
}

cmd.Flags().StringVarP(&o.serviceAccount, "service-account", "s", "", serviceAccountNameFlag)
cmd.Flags().StringVarP(&o.expiresAt, "expires-at", "e", "", apiKeyExpiresAtFlag)
cmd.Flags().StringVarP(&o.expiresAt, "expires-at", "e", "", rotateApiKeyExpiresAtFlag)
cmd.Flags().IntVarP(&o.gracePeriodHours, "grace-period-hours", "g", 0, apiKeyGracePeriodHoursFlag)
cmd.Flags().StringVarP(&o.output, "output", "o", "table", outputFlag)
addDryRunFlag(cmd)
Expand Down
Loading