{
  "description": "An Operation defines a pipeline of functions that together constitute a day\ntwo operation.",
  "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": "OperationSpec specifies desired state of an operation.",
      "properties": {
        "mode": {
          "default": "Pipeline",
          "description": "Mode controls what type or \"mode\" of operation will be used.\n\n\"Pipeline\" indicates that an Operation specifies a pipeline of\nfunctions, each of which is responsible for implementing its logic.",
          "enum": [
            "Pipeline"
          ],
          "type": "string"
        },
        "pipeline": {
          "description": "Pipeline is a list of operation function steps that will be used when\nthis operation runs.",
          "items": {
            "description": "A PipelineStep in an operation function pipeline.",
            "properties": {
              "credentials": {
                "description": "Credentials are optional credentials that the operation 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",
                  "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 unction 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 that will be fetched before this pipeline step\nis called for the first time.",
                    "items": {
                      "description": "RequiredResourceSelector selects resources that should be fetched before\na pipeline step runs.",
                      "properties": {
                        "apiVersion": {
                          "description": "APIVersion of resources to select.",
                          "type": "string"
                        },
                        "kind": {
                          "description": "Kind of resources to select.",
                          "type": "string"
                        },
                        "matchLabels": {
                          "additionalProperties": {
                            "type": "string"
                          },
                          "description": "MatchLabels matches resources by label selector. Only one of Name or\nMatchLabels may be specified.",
                          "type": "object"
                        },
                        "name": {
                          "description": "Name matches a single resource by name. Only one of Name or\nMatchLabels may be specified.",
                          "type": "string"
                        },
                        "namespace": {
                          "description": "Namespace to search for resources. Optional for cluster-scoped resources.",
                          "type": "string"
                        },
                        "requirementName": {
                          "description": "RequirementName uniquely identifies this group of resources.\nThis name will be used as the key in RunFunctionRequest.required_resources.",
                          "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"
        },
        "retryLimit": {
          "description": "RetryLimit configures how many times the operation may fail. When the\nfailure limit is exceeded, the operation will not be retried.",
          "format": "int64",
          "type": "integer"
        }
      },
      "required": [
        "mode",
        "pipeline"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "OperationStatus represents the observed state of an operation.",
      "properties": {
        "appliedResourceRefs": {
          "description": "AppliedResourceRefs references all resources the Operation applied.",
          "items": {
            "description": "An AppliedResourceRef is a reference to a resource an Operation applied.",
            "properties": {
              "apiVersion": {
                "description": "APIVersion of the applied resource.",
                "type": "string"
              },
              "kind": {
                "description": "Kind of the applied resource.",
                "type": "string"
              },
              "name": {
                "description": "Name of the applied resource.",
                "type": "string"
              },
              "namespace": {
                "description": "Namespace of the applied resource.",
                "type": "string"
              }
            },
            "required": [
              "apiVersion",
              "kind",
              "name"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "conditions": {
          "description": "Conditions of the resource.",
          "items": {
            "description": "A Condition that may apply to a resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "LastTransitionTime is the last time this condition transitioned from one\nstatus to another.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "A Message containing details about this condition's last transition from\none status to another, if any.",
                "type": "string"
              },
              "observedGeneration": {
                "description": "ObservedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "type": "integer"
              },
              "reason": {
                "description": "A Reason for this condition's last transition from one status to another.",
                "type": "string"
              },
              "status": {
                "description": "Status of this condition; is it currently True, False, or Unknown?",
                "type": "string"
              },
              "type": {
                "description": "Type of this condition. At most one of each condition type may apply to\na resource at any point in time.",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "failures": {
          "description": "Number of operation failures.",
          "format": "int64",
          "type": "integer"
        },
        "pipeline": {
          "description": "Pipeline represents the output of the pipeline steps that this operation\nran.",
          "items": {
            "description": "PipelineStepStatus represents the status of an individual pipeline step.",
            "properties": {
              "output": {
                "description": "Output of this step.",
                "type": "object",
                "x-kubernetes-preserve-unknown-fields": true
              },
              "step": {
                "description": "Step name. Unique within its Pipeline.",
                "type": "string"
              }
            },
            "required": [
              "step"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
