# API Reference

This section contains the Kamaji Customer Resource Definitions,
as well as the Cluster API Control Plane provider ones.

Packages:
{{range .Groups}}
- [{{.Group}}/{{.Version}}](#{{ anchorize (printf "%s/%s" .Group .Version) }})
{{- end -}}{{/* range .Groups */}}

{{- range .Groups }}
{{- $group := . }}

## {{.Group}}/{{.Version}}

Resource Types:
{{range .Kinds}}
- [{{.Name}}](#{{ anchorize .Name }})
{{end}}{{/* range .Kinds */}}

{{range .Kinds}}
{{$kind := .}}
### {{.Name}}

{{range .Types}}

{{if not .IsTopLevel}}
<span id="{{ anchorize .Name }}">`{{.Name}}`</span>
{{end}}

{{.Description}}

<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Type</th>
            <th>Description</th>
            <th>Required</th>
        </tr>
    </thead>
    <tbody>
      {{- if .IsTopLevel -}}
      <tr>
      <td><b>apiVersion</b></td>
      <td>string</td>
      <td>{{$group.Group}}/{{$group.Version}}</td>
      <td>true</td>
      </tr>
      <tr>
      <td><b>kind</b></td>
      <td>string</td>
      <td>{{$kind.Name}}</td>
      <td>true</td>
      </tr>
      <tr>
      <td><b><a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#objectmeta-v1-meta">metadata</a></b></td>
      <td>object</td>
      <td>Refer to the Kubernetes API documentation for the fields of the `metadata` field.</td>
      <td>true</td>
      </tr>
      {{- end -}}
      {{- range .Fields -}}
      <tr>
        <td><b>{{if .TypeKey}}<a href="#{{.TypeKey}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}</b></td>
        <td>{{.Type}}</td>
        <td>
          {{.Description}}<br/>
          {{- if or .Schema.Format .Schema.Enum .Schema.Default .Schema.Minimum .Schema.Maximum }}
          <br/>
          {{- end}}
          {{- if .Schema.Format }}
            <i>Format</i>: {{ .Schema.Format }}<br/>
          {{- end }}
          {{- if .Schema.Enum }}
            <i>Enum</i>: {{ .Schema.Enum | toStrings | join ", " }}<br/>
          {{- end }}
          {{- if .Schema.Default }}
            <i>Default</i>: {{ .Schema.Default }}<br/>
          {{- end }}
          {{- if .Schema.Minimum }}
            <i>Minimum</i>: {{ .Schema.Minimum }}<br/>
          {{- end }}
          {{- if .Schema.Maximum }}
            <i>Maximum</i>: {{ .Schema.Maximum }}<br/>
          {{- end }}
        </td>
        <td>{{.Required}}</td>
      </tr>
      {{- end -}}
    </tbody>
</table>

{{- end}}{{/* range .Types */}}
{{- end}}{{/* range .Kinds */}}
{{- end}}{{/* range .Groups */}}