{
  "description": "RemoteApiSubscription is the Schema for the remoteapisubscriptions API",
  "properties": {
    "apiVersion": {
      "type": "string",
      "description": "Must be \"api.cp.ei.telekom.de/v1\".",
      "const": "api.cp.ei.telekom.de/v1"
    },
    "kind": {
      "type": "string",
      "description": "Must be \"RemoteApiSubscription\".",
      "const": "RemoteApiSubscription"
    },
    "metadata": {
      "type": "object",
      "description": "Standard Kubernetes object metadata. See https://kubernetes.io/docs/reference/kubernetes-api/common-definitions/object-meta/",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name must be unique within a namespace. Is required when creating resources."
        },
        "namespace": {
          "type": "string",
          "description": "Namespace defines the space within which each name must be unique."
        },
        "labels": {
          "type": "object",
          "description": "Map of string keys and values that can be used to organize and categorize objects.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "annotations": {
          "type": "object",
          "description": "Annotations is an unstructured key value map stored with a resource that may be set by external tools.",
          "additionalProperties": {
            "type": "string"
          }
        },
        "generateName": {
          "type": "string",
          "description": "GenerateName is an optional prefix, used by the server, to generate a unique name only if the Name field has not been provided."
        }
      }
    },
    "spec": {
      "description": "RemoteApiSubscriptionSpec defines the desired state of RemoteApiSubscription",
      "properties": {
        "apiBasePath": {
          "type": "string"
        },
        "requester": {
          "description": "Requester is the entity that is requesting the subscription",
          "properties": {
            "application": {
              "description": "Application is the name of the application that is requesting the subscription",
              "type": "string"
            },
            "team": {
              "description": "Team is the team that is requesting the subscription",
              "properties": {
                "email": {
                  "description": "Email is the email address of the team",
                  "type": "string"
                },
                "name": {
                  "description": "Name is the logical name of the team",
                  "type": "string"
                }
              },
              "required": [
                "email",
                "name"
              ],
              "type": "object"
            }
          },
          "required": [
            "application",
            "team"
          ],
          "type": "object"
        },
        "security": {
          "description": "Security is the security configuration for the subscription",
          "properties": {
            "m2m": {
              "description": "M2M defines machine-to-machine authentication configuration",
              "properties": {
                "basic": {
                  "description": "Basic defines basic authentication configuration",
                  "properties": {
                    "password": {
                      "description": "Password for basic authentication",
                      "minLength": 1,
                      "type": "string"
                    },
                    "username": {
                      "description": "Username for basic authentication",
                      "minLength": 1,
                      "type": "string"
                    }
                  },
                  "required": [
                    "password",
                    "username"
                  ],
                  "type": "object"
                },
                "client": {
                  "description": "Client defines client credentials for OAuth2",
                  "properties": {
                    "clientId": {
                      "description": "ClientId identifies the client for OAuth2 client credentials flow",
                      "minLength": 1,
                      "type": "string"
                    },
                    "clientKey": {
                      "description": "ClientKey is the private key associated with the client ID",
                      "type": "string"
                    },
                    "clientSecret": {
                      "description": "ClientSecret is the secret associated with the client ID",
                      "type": "string"
                    }
                  },
                  "required": [
                    "clientId"
                  ],
                  "type": "object",
                  "x-kubernetes-validations": [
                    {
                      "message": "ClientSecret and ClientKey cannot be used together",
                      "rule": "self == null || (has(self.clientKey) ? (!has(self.clientSecret)) : true)"
                    },
                    {
                      "message": "At least one of clientSecret or clientKey must be provided",
                      "rule": "self == null || has(self.clientSecret) || has(self.clientKey)"
                    }
                  ]
                },
                "scopes": {
                  "description": "Scopes defines additional OAuth2 scopes that are added to the LMS token",
                  "items": {
                    "type": "string"
                  },
                  "maxItems": 10,
                  "type": "array"
                }
              },
              "type": "object",
              "x-kubernetes-validations": [
                {
                  "message": "Client and basic authentication cannot be used together",
                  "rule": "self == null || (has(self.client) ? (!has(self.basic)) : true)"
                },
                {
                  "message": "Scopes and basic authentication cannot be used together",
                  "rule": "self == null || (has(self.scopes) ? (!has(self.basic)) : true)"
                },
                {
                  "message": "At least one of client, basic, or scopes must be provided",
                  "rule": "self == null || has(self.client) || has(self.basic) || has(self.scopes)"
                }
              ]
            }
          },
          "type": "object"
        },
        "sourceOrganization": {
          "type": "string"
        },
        "targetOrganization": {
          "type": "string"
        }
      },
      "required": [
        "apiBasePath",
        "requester",
        "targetOrganization"
      ],
      "type": "object"
    },
    "status": {
      "description": "RemoteApiSubscriptionStatus defines the observed state of RemoteApiSubscription",
      "properties": {
        "apiSubscription": {
          "description": "ApiSubscription is only present if we are the target organization",
          "properties": {
            "name": {
              "type": "string"
            },
            "namespace": {
              "type": "string"
            },
            "uid": {
              "description": "UID is a type that holds unique ID values, including UUIDs.  Because we\ndon't ONLY use UUIDs, this is an alias to string.  Being a type captures\nintent and helps make sure that UIDs and names do not get conflated.",
              "type": "string"
            }
          },
          "required": [
            "name",
            "namespace"
          ],
          "type": "object"
        },
        "application": {
          "description": "Application is only present if we are the target organization",
          "properties": {
            "name": {
              "type": "string"
            },
            "namespace": {
              "type": "string"
            },
            "uid": {
              "description": "UID is a type that holds unique ID values, including UUIDs.  Because we\ndon't ONLY use UUIDs, this is an alias to string.  Being a type captures\nintent and helps make sure that UIDs and names do not get conflated.",
              "type": "string"
            }
          },
          "required": [
            "name",
            "namespace"
          ],
          "type": "object"
        },
        "approval": {
          "properties": {
            "approvalState": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "approvalState",
            "message"
          ],
          "type": "object"
        },
        "approvalRequest": {
          "properties": {
            "approvalState": {
              "type": "string"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "approvalState",
            "message"
          ],
          "type": "object"
        },
        "conditions": {
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "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",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object"
          },
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "gatewayUrl": {
          "type": "string"
        },
        "route": {
          "description": "Route is only present if we are the source organization",
          "properties": {
            "name": {
              "type": "string"
            },
            "namespace": {
              "type": "string"
            },
            "uid": {
              "description": "UID is a type that holds unique ID values, including UUIDs.  Because we\ndon't ONLY use UUIDs, this is an alias to string.  Being a type captures\nintent and helps make sure that UIDs and names do not get conflated.",
              "type": "string"
            }
          },
          "required": [
            "name",
            "namespace"
          ],
          "type": "object"
        }
      },
      "required": [
        "gatewayUrl"
      ],
      "type": "object"
    }
  },
  "type": "object",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://telekom.github.io/controlplane/schemas/api.cp.ei.telekom.de/remoteapisubscription_v1.json",
  "title": "RemoteApiSubscription",
  "required": [
    "apiVersion",
    "kind",
    "metadata"
  ]
}
