{
  "description": "AgentToken manages HCP Terraform Agent Tokens.\nMore information:\n- https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/api-tokens#agent-api-tokens",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "AgentTokenSpec defines the desired state of AgentToken.",
      "properties": {
        "agentPool": {
          "description": "The Agent Pool name or ID where the tokens will be managed.",
          "properties": {
            "id": {
              "description": "Agent Pool ID.\nMust match pattern: `^apool-[a-zA-Z0-9]+$`",
              "pattern": "^apool-[a-zA-Z0-9]+$",
              "type": "string"
            },
            "name": {
              "description": "Agent Pool name.",
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "agentTokens": {
          "description": "List of the HCP Terraform Agent tokens to manage.",
          "items": {
            "description": "Agent Token is a secret token that a HCP Terraform Agent is used to connect to the HCP Terraform Agent Pool.\nIn `spec` only the field `Name` is allowed, the rest are used in `status`.\nMore infromation:\n  - https://developer.hashicorp.com/terraform/cloud-docs/agents",
            "properties": {
              "createdAt": {
                "description": "Timestamp of when the agent token was created.",
                "format": "int64",
                "type": "integer"
              },
              "id": {
                "description": "Agent Token ID.",
                "pattern": "^at-[a-zA-Z0-9]+$",
                "type": "string"
              },
              "lastUsedAt": {
                "description": "Timestamp of when the agent token was last used.",
                "format": "int64",
                "type": "integer"
              },
              "name": {
                "description": "Agent Token name.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "minItems": 1,
          "type": "array"
        },
        "deletionPolicy": {
          "default": "retain",
          "description": "The Deletion Policy defines how managed tokens and Kubernetes Secrets should be handled when the custom resource is deleted.\n- `retain`: When the custom resource is deleted, the operator will remove only the resource itself.\n  The managed HCP Terraform Agent tokens will remain active on the HCP Terraform side, and the corresponding Kubernetes Secret will not be modified.\n- `destroy`: The operator will attempt to delete the managed HCP Terraform Agent tokens and remove the corresponding Kubernetes Secret.\nDefault: `retain`.",
          "enum": [
            "retain",
            "destroy"
          ],
          "type": "string"
        },
        "managementPolicy": {
          "default": "merge",
          "description": "The Management Policy defines how the controller will manage tokens in the specified Agent Pool.\n- `merge`  \u2014 the controller will manage its tokens alongside any existing tokens in the pool, without modifying or deleting tokens it does not own.\n- `owner`  \u2014 the controller assumes full ownership of all agent tokens in the pool, managing and potentially modifying or deleting all tokens, including those not created by it.\nDefault: `merge`.",
          "enum": [
            "merge",
            "owner"
          ],
          "type": "string"
        },
        "organization": {
          "description": "Organization name where the Workspace will be created.\nMore information:\n  - https://developer.hashicorp.com/terraform/cloud-docs/users-teams-organizations/organizations",
          "minLength": 1,
          "type": "string"
        },
        "secretName": {
          "description": "secretName specifies the name of the Kubernetes Secret\nwhere the HCP Terraform Agent tokens are stored.",
          "minLength": 1,
          "type": "string"
        },
        "token": {
          "description": "API Token to be used for API calls.",
          "properties": {
            "secretKeyRef": {
              "description": "Selects a key of a secret in the workspace's namespace",
              "properties": {
                "key": {
                  "description": "The key of the secret to select from.  Must be a valid secret key.",
                  "type": "string"
                },
                "name": {
                  "default": "",
                  "description": "Name of the referent.\nThis field is effectively required, but due to backwards compatibility is\nallowed to be empty. Instances of this type with an empty value here are\nalmost certainly wrong.\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
                  "type": "string"
                },
                "optional": {
                  "description": "Specify whether the Secret or its key must be defined",
                  "type": "boolean"
                }
              },
              "required": [
                "key"
              ],
              "type": "object",
              "x-kubernetes-map-type": "atomic",
              "additionalProperties": false
            }
          },
          "required": [
            "secretKeyRef"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "agentPool",
        "agentTokens",
        "organization",
        "secretName",
        "token"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "AgentTokenStatus defines the observed state of AgentToken.",
      "properties": {
        "agentPool": {
          "description": "Agent Pool where tokens are managed by the controller.",
          "properties": {
            "id": {
              "description": "Agent Pool ID.\nMust match pattern: `^apool-[a-zA-Z0-9]+$`",
              "pattern": "^apool-[a-zA-Z0-9]+$",
              "type": "string"
            },
            "name": {
              "description": "Agent Pool name.",
              "minLength": 1,
              "type": "string"
            }
          },
          "type": "object",
          "additionalProperties": false
        },
        "agentTokens": {
          "description": "List of the agent tokens managed by the controller.",
          "items": {
            "description": "Agent Token is a secret token that a HCP Terraform Agent is used to connect to the HCP Terraform Agent Pool.\nIn `spec` only the field `Name` is allowed, the rest are used in `status`.\nMore infromation:\n  - https://developer.hashicorp.com/terraform/cloud-docs/agents",
            "properties": {
              "createdAt": {
                "description": "Timestamp of when the agent token was created.",
                "format": "int64",
                "type": "integer"
              },
              "id": {
                "description": "Agent Token ID.",
                "pattern": "^at-[a-zA-Z0-9]+$",
                "type": "string"
              },
              "lastUsedAt": {
                "description": "Timestamp of when the agent token was last used.",
                "format": "int64",
                "type": "integer"
              },
              "name": {
                "description": "Agent Token name.",
                "minLength": 1,
                "type": "string"
              }
            },
            "required": [
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "observedGeneration": {
          "description": "Real world state generation.",
          "format": "int64",
          "type": "integer"
        }
      },
      "required": [
        "observedGeneration"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
