--- title: Rancher API - {{.schemaId}} layout: {{.layout}} version: {{.version}} lang: {{.language}} --- ## {{.schemaId | capitalize}} {{.resourceDescription}} {{if or $.writeableFieldMap $.readOnlyFieldMap}} ### Resource Fields {{if $.writeableFieldMap}} #### Writeable Fields Field | Type | Create | Update | Default | Notes ---|---|---|---|---|--- {{range $key, $value := .writeableFieldMap}}{{$key}} | {{if $value.TypeURL}}{{$value.TypeURL}}{{else}}{{$value.Type}}{{end}} | {{if $value.Create}}{{if $value.Required}}Yes{{else}}Optional{{end}}{{else}}-{{end}} | {{if $value.Update}}Yes{{else}}-{{end}} | {{if $value.Default}}{{$value.Default}}{{else}}-{{end}} | {{$value.Description}} {{end}}{{end}} {{if $.readOnlyFieldMap}} #### Read Only Fields Field | Type | Notes ---|---|--- {{range $key, $value := .readOnlyFieldMap}}{{$key}} | {{if $value.TypeURL}}{{$value.TypeURL}}{{else}}{{$value.Type}}{{end}} | {{$value.Description}} {{end}}{{end}}
Please read more about the [common resource fields]({{"{{"}}site.baseurl{{"}}"}}/rancher/{{"{{"}}page.version{{"}}"}}/{{"{{"}}page.lang{{"}}"}}/api/common/). These fields are read only and applicable to almost every resource. We have segregated them from the list above.{{end}} {{if .operationMap }} ### Operations {::options parse_block_html="true" /}{{end}} {{range $key, $value := .operationMap}}{{if eq $key "Create"}}{{end}}{{if eq $key "Update"}}{{end}}{{if eq $key "Delete"}}{{end}}
{{$key}}{{$value.Method}}: {{$value.ActionURL}}
{% highlight json %} curl -u "${{"{"}}RANCHER_ACCESS_KEY{{"}"}}:${{"{"}}RANCHER_SECRET_KEY{{"}"}}" \ -X {{$value.Method}} \ {{if ne $value.Input.InputJSON ""}}-H 'Content-Type: application/json' \ -d '{{$value.Input.InputJSON}}' {{end}}'http://${{"{"}}RANCHER_URL{{"}"}}:8080{{$value.ActionURL}}' {% endhighlight %}
{{end}} {{if $.actionMap}} ### Actions {{range $actionName, $action := .actionMap}}
{{$actionName}} {{$action.Method}}: {{$action.ActionURL}}
{{$action.Description}}
Input:{{if ne $action.Input.Name "" }} {{$action.Input.Name | capitalize}} {{if $action.Input.FieldMap}} Field | Type | Required | Default | Notes ---|---|---|---|--- {{range $key, $value := $action.Input.FieldMap}}{{$key}} | {{$value.TypeURL}} | {{if $value.Required}}Yes{{else}}No{{end}} | {{$value.Default}} | {{$value.Description}}{{end}}
{{end}}{{else}}This action has no inputs{{end}}
{% highlight json %} curl -u "${{"{"}}RANCHER_ACCESS_KEY{{"}"}}:${{"{"}}RANCHER_SECRET_KEY{{"}"}}" \ -X {{$action.Method}} \ {{if ne $action.Input.InputJSON "{}"}}-H 'Content-Type: application/json' \ -d '{{$action.Input.InputJSON}}' {{end}}'http://${{"{"}}RANCHER_URL{{"}"}}:8080{{$action.ActionURL}}' {% endhighlight %}
{{if ne $action.Output "" }}Output: An updated copy of the {{$action.Output}} resource{{end}}
{{end}} {{end}}