{
  "description": "A Composition defines a collection of managed resources or functions that\nCrossplane uses to create and manage new composite resources.\n\nRead the Crossplane documentation for\n[more information about Compositions](https://docs.crossplane.io/latest/concepts/compositions).",
  "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": "CompositionSpec specifies desired state of a composition.",
      "properties": {
        "compositeTypeRef": {
          "description": "CompositeTypeRef specifies the type of composite resource that this\ncomposition is compatible with.",
          "properties": {
            "apiVersion": {
              "description": "APIVersion of the type.",
              "type": "string"
            },
            "kind": {
              "description": "Kind of the type.",
              "type": "string"
            }
          },
          "required": [
            "apiVersion",
            "kind"
          ],
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "Value is immutable",
              "rule": "self == oldSelf"
            }
          ],
          "additionalProperties": false
        },
        "mode": {
          "default": "Pipeline",
          "description": "Mode controls what type or \"mode\" of Composition will be used.\n\n\"Pipeline\" indicates that a Composition specifies a pipeline of\nfunctions, each of which is responsible for producing composed\nresources that Crossplane should create or update.",
          "enum": [
            "Pipeline"
          ],
          "type": "string"
        },
        "pipeline": {
          "description": "Pipeline is a list of composition function steps that will be used when a\ncomposite resource referring to this composition is created. One of\nresources and pipeline must be specified - you cannot specify both.\n\nThe Pipeline is only used by the \"Pipeline\" mode of Composition. It is\nignored by other modes.",
          "items": {
            "description": "A PipelineStep in a function pipeline.",
            "properties": {
              "credentials": {
                "description": "Credentials are optional credentials that the function needs.",
                "items": {
                  "description": "FunctionCredentials are optional credentials that a function\nneeds to run.",
                  "properties": {
                    "name": {
                      "description": "Name of this set of credentials.",
                      "type": "string"
                    },
                    "secretRef": {
                      "description": "A SecretRef is a reference to a secret containing credentials that should\nbe supplied to the function.",
                      "properties": {
                        "name": {
                          "description": "Name of the secret.",
                          "type": "string"
                        },
                        "namespace": {
                          "description": "Namespace of the secret.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "name",
                        "namespace"
                      ],
                      "type": "object",
                      "additionalProperties": false
                    },
                    "source": {
                      "description": "Source of the function credentials.",
                      "enum": [
                        "None",
                        "Secret"
                      ],
                      "type": "string"
                    }
                  },
                  "required": [
                    "name",
                    "source"
                  ],
                  "type": "object",
                  "x-kubernetes-validations": [
                    {
                      "message": "the Secret source requires a secretRef",
                      "rule": "self.source == 'Secret' && has(self.secretRef)"
                    }
                  ],
                  "additionalProperties": false
                },
                "type": "array",
                "x-kubernetes-list-map-keys": [
                  "name"
                ],
                "x-kubernetes-list-type": "map"
              },
              "functionRef": {
                "description": "FunctionRef is a reference to the function this step should\nexecute.",
                "properties": {
                  "name": {
                    "description": "Name of the referenced Function.",
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "input": {
                "description": "Input is an optional, arbitrary Kubernetes resource (i.e. a resource\nwith an apiVersion and kind) that will be passed to the function as\nthe 'input' of its RunFunctionRequest.",
                "type": "object",
                "x-kubernetes-embedded-resource": true,
                "x-kubernetes-preserve-unknown-fields": true
              },
              "requirements": {
                "description": "Requirements are resource requirements that will be satisfied before\nthis pipeline step is called for the first time. This allows\npre-populating required resources without requiring a function to\nrequest them first.",
                "properties": {
                  "requiredResources": {
                    "description": "RequiredResources is a list of resources that must be fetched before\nthis function is called.",
                    "items": {
                      "description": "RequiredResourceSelector selects a required resource.",
                      "properties": {
                        "apiVersion": {
                          "description": "APIVersion of the required resource.",
                          "type": "string"
                        },
                        "kind": {
                          "description": "Kind of the required resource.",
                          "type": "string"
                        },
                        "matchLabels": {
                          "additionalProperties": {
                            "type": "string"
                          },
                          "description": "MatchLabels specifies the set of labels to match for finding the\nrequired resource. When specified, Name is ignored.",
                          "type": "object"
                        },
                        "name": {
                          "description": "Name of the required resource.",
                          "type": "string"
                        },
                        "namespace": {
                          "description": "Namespace of the required resource if it is namespaced.",
                          "type": "string"
                        },
                        "requirementName": {
                          "description": "RequirementName is the unique name to identify this required resource\nin the Required Resources map in the function request.",
                          "type": "string"
                        }
                      },
                      "required": [
                        "apiVersion",
                        "kind",
                        "requirementName"
                      ],
                      "type": "object",
                      "x-kubernetes-validations": [
                        {
                          "message": "Either name or matchLabels must be specified, but not both",
                          "rule": "(has(self.name) && !has(self.matchLabels)) || (!has(self.name) && has(self.matchLabels))"
                        }
                      ],
                      "additionalProperties": false
                    },
                    "type": "array",
                    "x-kubernetes-list-map-keys": [
                      "requirementName"
                    ],
                    "x-kubernetes-list-type": "map"
                  }
                },
                "type": "object",
                "additionalProperties": false
              },
              "step": {
                "description": "Step name. Must be unique within its Pipeline.",
                "type": "string"
              }
            },
            "required": [
              "functionRef",
              "step"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "maxItems": 99,
          "minItems": 1,
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "step"
          ],
          "x-kubernetes-list-type": "map"
        },
        "writeConnectionSecretsToNamespace": {
          "description": "WriteConnectionSecretsToNamespace specifies the namespace in which the\nconnection secrets of composite resource dynamically provisioned using\nthis composition will be created.",
          "type": "string"
        }
      },
      "required": [
        "compositeTypeRef"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "an array of pipeline steps is required in Pipeline mode",
          "rule": "self.mode == 'Pipeline' && has(self.pipeline)"
        }
      ],
      "additionalProperties": false
    }
  },
  "type": "object"
}
