Environment

An “environment” in the API is referred to as a stack in the UI and the Rancher documentation. In the API documentation, we’ll use the UI terminology. A Rancher stack mirrors the same concept as a docker-compose project. It represents a group of services that make up a typical application or workload.

Resource Fields

Writeable Fields

Field Type Create Update Default Notes
description string Optional Yes -  
dockerCompose string Optional - -  
environment map[string] Optional - -  
externalId string Optional Yes -  
name string Yes Yes -  
outputs map[string] Optional Yes -  
previousEnvironment map[string] Optional Yes -  
previousExternalId string Optional Yes -  
rancherCompose string Optional - -  
startOnCreate boolean Optional - -  

Read Only Fields

Field Type Notes
data map[json]  
healthState string  
id int The unique identifier for the environment


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.

Actions

activateservices POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=activateservices

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=activateservices'

Output: An updated copy of the environment resource
cancelrollback POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelrollback

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelrollback'

Output: An updated copy of the environment resource
cancelupgrade POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelupgrade

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=cancelupgrade'

Output: An updated copy of the environment resource
deactivateservices POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=deactivateservices

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=deactivateservices'

Output: An updated copy of the environment resource
exportconfig POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=exportconfig

Input: ComposeConfigInput Field | Type | Required | Default | Notes ---|---|---|---|--- serviceIds | array[[service](/docs/rancher/v1.6/en/api/v1/api-resources/service/)] | No | |
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"serviceIds": "array[reference[service]]"
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=exportconfig'

Output: An updated copy of the composeConfig resource
finishupgrade POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=finishupgrade

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=finishupgrade'

Output: An updated copy of the environment resource
rollback POST: /v1/projects/${PROJECT_ID}/environments/${ID}?action=rollback

Input:This action has no inputs
curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/environments/${ID}?action=rollback'

Output: An updated copy of the environment resource
Edit this page