Project

A “project” in the API is referred to as an environment in the UI and Rancher documentation. In the API documentation, we’ll use the UI terminology. All hosts and any Rancher resources (i.e. containers, load balancers, etc.) are created and belong to an environment. Access control to who can view and manage these resources are then defined by the owner of the environment. Rancher currently supports the capability for each user to manage and invite other users to their environment and allows for the ability to create multiple environments for different workloads. For example, you may want to create a “dev” environment and a separate “production” environment with its own set of resources and limited user access for your application deployment.

Resource Fields

Writeable Fields

Field Type Create Update Default Notes
allowSystemRole boolean Optional Yes -  
description string Optional Yes -  
hostRemoveDelaySeconds int Optional Yes -  
members array[projectMember] Optional - -  
name string Optional Yes -  
projectLinks array[project] Optional Yes -  
projectTemplateId projectTemplate Optional - -  
servicesPortRange servicesPortRange Optional Yes -  
virtualMachine boolean Optional Yes -  

Read Only Fields

Field Type Notes
data map[json]  
defaultNetworkId network  
healthState string  
id int The unique identifier for the project
orchestration string  
version string  


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}/projects

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"allowSystemRole": false,
	"description": "string",
	"hostRemoveDelaySeconds": 0,
	"members": "array[projectMember]",
	"name": "string",
	"projectLinks": "array[reference[project]]",
	"projectTemplateId": "reference[projectTemplate]",
	"servicesPortRange": {
		"endPort": 0,
		"startPort": 0
	},
	"uuid": "string",
	"virtualMachine": false
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/projects'

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

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

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

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X PUT \
-H 'Content-Type: application/json' \
-d '{
	"allowSystemRole": false,
	"description": "string",
	"hostRemoveDelaySeconds": 0,
	"name": "string",
	"projectLinks": "array[reference[project]]",
	"servicesPortRange": {
		"endPort": 0,
		"startPort": 0
	},
	"virtualMachine": false
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/projects/${ID}'

Actions

activate POST: /v2-beta/projects/${PROJECT_ID}/projects/${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}/projects/${ID}?action=activate'


Output: An updated copy of the account resource

deactivate POST: /v2-beta/projects/${PROJECT_ID}/projects/${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}/projects/${ID}?action=deactivate'


Output: An updated copy of the account resource

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


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}/projects/${ID}?action=defaultNetworkId'


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


Input: SetProjectMembersInput

Field Type Required Default Notes
members array[projectMember] Yes    


curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"members": "array[projectMember]"
}' 'http://${RANCHER_URL}:8080/v2-beta/projects/${PROJECT_ID}/projects/${ID}?action=setmembers'


Output: An updated copy of the setProjectMembersInput resource

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


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}/projects/${ID}?action=upgrade'


Output: An updated copy of the account resource

Edit this page