ApiKey

An API Key provides access to the Rancher API if access control has been turned on. The access key and secret key pair are created per environment and can be used to directly call the API or used with rancher-compose.

Resource Fields

Writeable Fields

Field Type Create Update Default Notes
description string Optional Yes -  
name string Optional Yes -  

Read Only Fields

Field Type Notes
id int The unique identifier for the apiKey
publicValue string The public value of the apiKey
secretValue password The secret value of the apiKey


Please read more about the common resource fields. These fields are read only and applicable to almost every resource. We have segregated them from the list above.

Operations

CreatePOST: /v2-beta/projects/${PROJECT_ID}/apiKeys

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"description": "string",
	"name": "string"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/apiKeys'

DeleteDELETE: /v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X DELETE \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}'

UpdatePUT: /v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X PUT \
-H 'Content-Type: application/json' \
-d '{
	"description": "string",
	"name": "string"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}'

Actions

activate POST: /v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}?action=activate


Input:This action has no inputs


curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}?action=activate'


Output: An updated copy of the credential resource

deactivate POST: /v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}?action=deactivate


Input:This action has no inputs


curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/apiKeys/${ID}?action=deactivate'


Output: An updated copy of the credential resource