{
  "description": "AtlasCustomRole is the Schema for the AtlasCustomRole API",
  "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": "AtlasCustomRoleSpec defines the target state of CustomRole in Atlas.",
      "properties": {
        "connectionSecret": {
          "description": "Name of the secret containing Atlas API private and public keys.",
          "properties": {
            "name": {
              "description": "Name of the resource being referred to\nMore info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "externalProjectRef": {
          "description": "externalProjectRef holds the parent Atlas project ID.\nMutually exclusive with the \"projectRef\" field.",
          "properties": {
            "id": {
              "description": "ID is the Atlas project ID.",
              "type": "string"
            }
          },
          "required": [
            "id"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "projectRef": {
          "description": "projectRef is a reference to the parent AtlasProject resource.\nMutually exclusive with the \"externalProjectRef\" field.",
          "properties": {
            "name": {
              "description": "Name of the Kubernetes Resource",
              "type": "string"
            },
            "namespace": {
              "description": "Namespace of the Kubernetes Resource",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "role": {
          "description": "Role represents a Custom Role in Atlas.",
          "properties": {
            "actions": {
              "description": "List of the individual privilege actions that the role grants.",
              "items": {
                "properties": {
                  "name": {
                    "description": "Human-readable label that identifies the privilege action.",
                    "type": "string"
                  },
                  "resources": {
                    "description": "List of resources on which you grant the action.",
                    "items": {
                      "properties": {
                        "cluster": {
                          "description": "Flag that indicates whether to grant the action on the cluster resource. If true, MongoDB Cloud ignores Database and Collection parameters.",
                          "type": "boolean"
                        },
                        "collection": {
                          "description": "Human-readable label that identifies the collection on which you grant the action to one MongoDB user.",
                          "type": "string"
                        },
                        "database": {
                          "description": "Human-readable label that identifies the database on which you grant the action to one MongoDB user.",
                          "type": "string"
                        }
                      },
                      "type": "object",
                      "additionalProperties": false
                    },
                    "type": "array"
                  }
                },
                "required": [
                  "name",
                  "resources"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "inheritedRoles": {
              "description": "List of the built-in roles that this custom role inherits.",
              "items": {
                "properties": {
                  "database": {
                    "description": "Human-readable label that identifies the database on which someone grants the action to one MongoDB user.",
                    "type": "string"
                  },
                  "name": {
                    "description": "Human-readable label that identifies the role inherited.",
                    "type": "string"
                  }
                },
                "required": [
                  "database",
                  "name"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "name": {
              "description": "Human-readable label that identifies the role. This name must be unique for this custom role in this project.",
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "role"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "must define only one project reference through externalProjectRef or projectRef",
          "rule": "(has(self.externalProjectRef) && !has(self.projectRef)) || (!has(self.externalProjectRef) && has(self.projectRef))"
        },
        {
          "message": "must define a local connection secret when referencing an external project",
          "rule": "(has(self.externalProjectRef) && has(self.connectionSecret)) || !has(self.externalProjectRef)"
        }
      ],
      "additionalProperties": false
    },
    "status": {
      "description": "AtlasCustomRoleStatus is a status for the AtlasCustomRole Custom resource.\nNot the one included in the AtlasProject",
      "properties": {
        "conditions": {
          "description": "Conditions is the list of statuses showing the current state of the Atlas Custom Resource",
          "items": {
            "description": "Condition describes the state of an Atlas Custom Resource at a certain point.",
            "properties": {
              "lastTransitionTime": {
                "description": "Last time the condition transitioned from one status to another.\nRepresented in ISO 8601 format.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "A message providing details about the transition.",
                "type": "string"
              },
              "reason": {
                "description": "The reason for the condition's last transition.",
                "type": "string"
              },
              "status": {
                "description": "Status of the condition; one of True, False, Unknown.",
                "type": "string"
              },
              "type": {
                "description": "Type of Atlas Custom Resource condition.",
                "type": "string"
              }
            },
            "required": [
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "observedGeneration": {
          "description": "ObservedGeneration indicates the generation of the resource specification of which the Atlas Operator is aware.\nThe Atlas Operator updates this field to the value of 'metadata.generation' as soon as it starts reconciliation of the resource.",
          "format": "int64",
          "type": "integer"
        }
      },
      "required": [
        "conditions"
      ],
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
