{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "apiVersion": {
      "type": "string"
    },
    "kind": {
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "properties": {
        "cluster": {
          "properties": {
            "name": {
              "type": "string"
            }
          },
          "required": [
            "name"
          ],
          "type": "object"
        },
        "method": {
          "default": "barmanObjectStore",
          "enum": [
            "barmanObjectStore",
            "volumeSnapshot",
            "plugin"
          ],
          "type": "string"
        },
        "online": {
          "type": "boolean"
        },
        "onlineConfiguration": {
          "properties": {
            "immediateCheckpoint": {
              "type": "boolean"
            },
            "waitForArchive": {
              "default": true,
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "pluginConfiguration": {
          "properties": {
            "name": {
              "type": "string"
            },
            "parameters": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            }
          },
          "required": [
            "name"
          ],
          "type": "object"
        },
        "target": {
          "enum": [
            "primary",
            "prefer-standby"
          ],
          "type": "string"
        }
      },
      "required": [
        "cluster"
      ],
      "type": "object",
      "x-kubernetes-validations": [
        {
          "message": "BackupSpec is immutable once set",
          "rule": "oldSelf == self"
        }
      ]
    },
    "status": {
      "properties": {
        "azureCredentials": {
          "properties": {
            "connectionString": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "inheritFromAzureAD": {
              "type": "boolean"
            },
            "storageAccount": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "storageKey": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "storageSasToken": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "backupId": {
          "type": "string"
        },
        "backupLabelFile": {
          "format": "byte",
          "type": "string"
        },
        "backupName": {
          "type": "string"
        },
        "beginLSN": {
          "type": "string"
        },
        "beginWal": {
          "type": "string"
        },
        "commandError": {
          "type": "string"
        },
        "commandOutput": {
          "type": "string"
        },
        "destinationPath": {
          "type": "string"
        },
        "encryption": {
          "type": "string"
        },
        "endLSN": {
          "type": "string"
        },
        "endWal": {
          "type": "string"
        },
        "endpointCA": {
          "properties": {
            "key": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          },
          "required": [
            "key",
            "name"
          ],
          "type": "object"
        },
        "endpointURL": {
          "type": "string"
        },
        "error": {
          "type": "string"
        },
        "googleCredentials": {
          "properties": {
            "applicationCredentials": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "gkeEnvironment": {
              "type": "boolean"
            }
          },
          "type": "object"
        },
        "instanceID": {
          "properties": {
            "ContainerID": {
              "type": "string"
            },
            "podName": {
              "type": "string"
            }
          },
          "type": "object"
        },
        "majorVersion": {
          "type": "integer"
        },
        "method": {
          "type": "string"
        },
        "online": {
          "type": "boolean"
        },
        "phase": {
          "type": "string"
        },
        "pluginMetadata": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        "s3Credentials": {
          "properties": {
            "accessKeyId": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "inheritFromIAMRole": {
              "type": "boolean"
            },
            "region": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "secretAccessKey": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            },
            "sessionToken": {
              "properties": {
                "key": {
                  "type": "string"
                },
                "name": {
                  "type": "string"
                }
              },
              "required": [
                "key",
                "name"
              ],
              "type": "object"
            }
          },
          "type": "object"
        },
        "serverName": {
          "type": "string"
        },
        "snapshotBackupStatus": {
          "properties": {
            "elements": {
              "items": {
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "tablespaceName": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string"
                  }
                },
                "required": [
                  "name",
                  "type"
                ],
                "type": "object"
              },
              "type": "array"
            }
          },
          "type": "object"
        },
        "startedAt": {
          "format": "date-time",
          "type": "string"
        },
        "stoppedAt": {
          "format": "date-time",
          "type": "string"
        },
        "tablespaceMapFile": {
          "format": "byte",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "metadata",
    "spec"
  ],
  "type": "object"
}
