Key Lifecycle Rules

A KeyLifecycleRule represents a rule that applies to API keys, GPG keys, and SSH keys (also called User Public Keys) based on their inactivity or age.

Keys that have been unused for the specified number of days will be deleted. SSH keys can also be configured to expire after a specified number of days. SSH key expiration applies only to User Public Keys used for inbound SFTP/SSH login, not Remote Server outbound SSH keys.

List Key Lifecycle Rules

Command

files-cli key-lifecycle-rules list

Output

Outputs a list of KeyLifecycleRule objects according to the output format.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Additional Arguments

Example Request

files-cli key-lifecycle-rules list

Show Key Lifecycle Rule

Command

files-cli key-lifecycle-rules find

Output

Outputs a KeyLifecycleRule object according to the output format.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Flags

FlagDescription
--id=
int64
Required
Key Lifecycle Rule ID.

Example Request

files-cli key-lifecycle-rules find \
  --id=1

Create Key Lifecycle Rule

Command

files-cli key-lifecycle-rules create

Output

Outputs a KeyLifecycleRule object according to the output format.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Flags

FlagDefaultDescription
--apply-to-all-workspaces
boolean
falseIf true, a default-workspace rule also applies to keys in all workspaces.
--expiration-days=
int64
Number of days after creation before an SSH key expires. Applies only to SSH keys.
--key-type=
string
Key type for which the rule will apply (gpg, ssh, or api).
Possible values: gpg, ssh, api
--inactivity-days=
int64
Number of days of inactivity before the rule applies.
--name=
string
Key Lifecycle Rule name
--workspace-id=
int64
0Workspace ID. 0 means the default workspace.

Example Request

files-cli key-lifecycle-rules create

Update Key Lifecycle Rule

Command

files-cli key-lifecycle-rules update

Output

Outputs a KeyLifecycleRule object according to the output format.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Flags

FlagDescription
--id=
int64
Required
Key Lifecycle Rule ID.
--apply-to-all-workspaces
boolean
If true, a default-workspace rule also applies to keys in all workspaces.
--expiration-days=
int64
Number of days after creation before an SSH key expires. Applies only to SSH keys.
--key-type=
string
Key type for which the rule will apply (gpg, ssh, or api).
Possible values: gpg, ssh, api
--inactivity-days=
int64
Number of days of inactivity before the rule applies.
--name=
string
Key Lifecycle Rule name
--workspace-id=
int64
Workspace ID. 0 means the default workspace.

Example Request

files-cli key-lifecycle-rules update \
  --id=1

Delete Key Lifecycle Rule

Command

files-cli key-lifecycle-rules delete

Output

No output is returned.

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

Flags

FlagDescription
--id=
int64
Required
Key Lifecycle Rule ID.

Example Request

files-cli key-lifecycle-rules delete \
  --id=1

The KeyLifecycleRule Object

Some of the commands above return a KeyLifecycleRule object. The attributes of this object are listed below.

AttributeDescription
id
int64
Key Lifecycle Rule ID
key_type
string
Key type for which the rule will apply (gpg, ssh, or api).
Possible values: gpg, ssh, api
inactivity_days
int64
Number of days of inactivity before the rule applies.
expiration_days
int64
Number of days after creation before an SSH key expires. Applies only to SSH keys.
apply_to_all_workspaces
boolean
If true, a default-workspace rule also applies to keys in all workspaces.
name
string
Key Lifecycle Rule name
workspace_id
int64
Workspace ID. 0 means the default workspace.