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 -  
kubernetes boolean Optional Yes -  
members array[projectMember] Optional - -  
mesos boolean Optional Yes -  
name string Optional Yes -  
publicDns boolean Optional Yes -  
servicesPortRange servicesPortRange Optional Yes -  
swarm boolean Optional Yes -  
virtualMachine boolean Optional Yes -  

Read Only Fields

Field Type Notes
data map[json]  
id int The unique identifier for the project


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: /v1/projects/${PROJECT_ID}/projects

curl -u "${RANCHER_ACCESS_KEY}:${RANCHER_SECRET_KEY}" \
-X POST \
-H 'Content-Type: application/json' \
-d '{
	"allowSystemRole": false,
	"description": "string",
	"kubernetes": false,
	"members": "array[projectMember]",
	"mesos": false,
	"name": "string",
	"publicDns": false,
	"servicesPortRange": {
		"endPort": 0,
		"startPort": 0
	},
	"swarm": false,
	"uuid": "string",
	"virtualMachine": false
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/projects'

DeleteDELETE: /v1/projects/${PROJECT_ID}/projects/${ID}

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

UpdatePUT: /v1/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",
	"kubernetes": false,
	"mesos": false,
	"name": "string",
	"publicDns": false,
	"servicesPortRange": {
		"endPort": 0,
		"startPort": 0
	},
	"swarm": false,
	"virtualMachine": false
}' 'http://${RANCHER_URL}:8080/v1/projects/${PROJECT_ID}/projects/${ID}'

Actions

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


Output: An updated copy of the account resource

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


Output: An updated copy of the account resource

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


Output: An updated copy of the setProjectMembersInput resource

Edit this page