{
  "description": "Stanza is the Schema for the stanzas 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": "spec defines the desired state of Stanza",
      "properties": {
        "stanzaConfiguration": {
          "description": "Define pgbackrest stanza",
          "properties": {
            "archive": {
              "properties": {
                "async": {
                  "default": false,
                  "type": "boolean"
                },
                "getQueueMax": {
                  "pattern": "^[0-9]+ ?(B|KiB|MiB|GiB|TiB|PiB)$",
                  "type": "string"
                },
                "pushQueueMax": {
                  "pattern": "^(0B|[0-9]+(KiB|MiB|GiB|TiB)|([0-4])PiB)$",
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "azureRepositories": {
              "items": {
                "properties": {
                  "account": {
                    "description": "Azure repository account.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "container": {
                    "description": "Azure container used to store the repository.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "endpoint": {
                    "description": "Azure repository endpoint.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "keyType": {
                    "description": "Azure repository key type.",
                    "enum": [
                      "shared",
                      "sas",
                      "auto"
                    ],
                    "minLength": 1,
                    "type": "string"
                  },
                  "repoPath": {
                    "description": "Path where backups and archives are stored.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "retentionPolicy": {
                    "description": "Define retention strategy for a repository.",
                    "properties": {
                      "archive": {
                        "description": "Number of backups worth of continuous WAL to retain.\nCan be used to aggressively expire WAL segments and save disk space.\nHowever, doing so negates the ability to perform PITR from the backups\nwith expired WAL and is therefore not recommended.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "archiveType": {
                        "description": "Backup type for WAL retention.\nIt is recommended that this setting not be changed from the default which\nwill only expire WAL in conjunction with expiring full backups.\nAvailable options are `full` (default), `diff` or `incr`.",
                        "enum": [
                          "full",
                          "diff",
                          "incr"
                        ],
                        "type": "string"
                      },
                      "diff": {
                        "description": "Number of differential backups to retain.\nWhen a differential backup expires, all incremental backups associated\nwith the differential backup will also expire. When not defined all\ndifferential backups will be kept until the full backups they depend on expire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "full": {
                        "description": "Full backup retention count/time (in days)\nWhen a full backup expires, all differential and incremental backups associated\nwith the full backup will also expire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "fullType": {
                        "description": "Retention type for full backups.\n Determines whether the repo-retention-full setting represents a time period\n(days) or count of full backups to keep.\nAvailable options are `count` (default) and `time`.",
                        "enum": [
                          "count",
                          "time"
                        ],
                        "type": "string"
                      },
                      "history": {
                        "description": "Days of backup history manifests to retain.\nSet history to define the number of days of backup history manifests to\nretain. Unexpired backups are always kept in the backup history. Specify\nhistory=0 to retain the backup history only for unexpired backups. When\na full backup history manifest is expired, all differential and\nincremental backup history manifests associated with the full backup also\nexpire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "secretRef": {
                    "description": "Reference to a Kubernetes Secret containing the Azure repository key.",
                    "properties": {
                      "keyReference": {
                        "description": "The reference to the Azure key.",
                        "properties": {
                          "key": {
                            "description": "The key to select",
                            "type": "string"
                          },
                          "name": {
                            "description": "Name of the referent.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name"
                        ],
                        "type": "object",
                        "additionalProperties": false
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "uriStyle": {
                    "description": "Azure URI Style.",
                    "enum": [
                      "host",
                      "path"
                    ],
                    "type": "string"
                  },
                  "verifyTLS": {
                    "default": true,
                    "description": "Repository storage certificate verify.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "account",
                  "container",
                  "repoPath"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "compressConfig": {
              "description": "Define compression settings for file compression.",
              "properties": {
                "level": {
                  "description": "File compression level.",
                  "type": "integer"
                },
                "type": {
                  "default": "gz",
                  "description": "Type of compression to use.",
                  "enum": [
                    "bz2",
                    "gz",
                    "lz4",
                    "zst"
                  ],
                  "type": "string"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "customEnvVar": {
              "additionalProperties": {
                "type": "string"
              },
              "description": "Custom environnement variables to use when running pgbackrest.",
              "type": "object"
            },
            "delta": {
              "default": true,
              "description": "Restore or backup using checksums.\nDuring a restore, by default the PostgreSQL data and tablespace directories\nare expected to be present but empty. This option performs a delta restore\nusing checksums.\n\nDuring a backup, this option will use checksums instead of the timestamps to\ndetermine if files will be copied.",
              "type": "boolean"
            },
            "logLevel": {
              "default": "warn",
              "description": "Level for console logging.",
              "enum": [
                "error",
                "warn",
                "info",
                "detail",
                "debug",
                "trace"
              ],
              "type": "string"
            },
            "name": {
              "minLength": 1,
              "type": "string"
            },
            "processMax": {
              "default": 1,
              "type": "integer"
            },
            "s3Repositories": {
              "items": {
                "properties": {
                  "bucket": {
                    "description": "S3 bucket used to store the repository.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "cipherConfig": {
                    "properties": {
                      "encryptionPass": {
                        "description": "Reference to the secret containing the encryption key.",
                        "properties": {
                          "key": {
                            "description": "The key to select",
                            "type": "string"
                          },
                          "name": {
                            "description": "Name of the referent.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name"
                        ],
                        "type": "object",
                        "additionalProperties": false
                      },
                      "type": {
                        "default": "aes-256-cbc",
                        "description": "Cipher used to encrypt the repository.",
                        "enum": [
                          "aes-256-cbc"
                        ],
                        "type": "string"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "endpoint": {
                    "description": "S3 repository endpoint.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "region": {
                    "description": "S3 repository region.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "repoPath": {
                    "description": "Path where backups and archive are stored.",
                    "minLength": 1,
                    "type": "string"
                  },
                  "retentionPolicy": {
                    "description": "Define retention strategy for a repository.",
                    "properties": {
                      "archive": {
                        "description": "Number of backups worth of continuous WAL to retain.\nCan be used to aggressively expire WAL segments and save disk space.\nHowever, doing so negates the ability to perform PITR from the backups\nwith expired WAL and is therefore not recommended.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "archiveType": {
                        "description": "Backup type for WAL retention.\nIt is recommended that this setting not be changed from the default which\nwill only expire WAL in conjunction with expiring full backups.\nAvailable options are `full` (default), `diff` or `incr`.",
                        "enum": [
                          "full",
                          "diff",
                          "incr"
                        ],
                        "type": "string"
                      },
                      "diff": {
                        "description": "Number of differential backups to retain.\nWhen a differential backup expires, all incremental backups associated\nwith the differential backup will also expire. When not defined all\ndifferential backups will be kept until the full backups they depend on expire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "full": {
                        "description": "Full backup retention count/time (in days)\nWhen a full backup expires, all differential and incremental backups associated\nwith the full backup will also expire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 1,
                        "type": "integer"
                      },
                      "fullType": {
                        "description": "Retention type for full backups.\n Determines whether the repo-retention-full setting represents a time period\n(days) or count of full backups to keep.\nAvailable options are `count` (default) and `time`.",
                        "enum": [
                          "count",
                          "time"
                        ],
                        "type": "string"
                      },
                      "history": {
                        "description": "Days of backup history manifests to retain.\nSet history to define the number of days of backup history manifests to\nretain. Unexpired backups are always kept in the backup history. Specify\nhistory=0 to retain the backup history only for unexpired backups. When\na full backup history manifest is expired, all differential and\nincremental backup history manifests associated with the full backup also\nexpire.",
                        "format": "int32",
                        "maximum": 9999999,
                        "minimum": 0,
                        "type": "integer"
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "secretRef": {
                    "description": "Reference to a Kubernetes Secret containing S3 credentials.",
                    "properties": {
                      "accessKeyId": {
                        "description": "The reference to the access key ID",
                        "properties": {
                          "key": {
                            "description": "The key to select",
                            "type": "string"
                          },
                          "name": {
                            "description": "Name of the referent.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name"
                        ],
                        "type": "object",
                        "additionalProperties": false
                      },
                      "secretAccessKey": {
                        "description": "The reference to the secret access key",
                        "properties": {
                          "key": {
                            "description": "The key to select",
                            "type": "string"
                          },
                          "name": {
                            "description": "Name of the referent.",
                            "type": "string"
                          }
                        },
                        "required": [
                          "key",
                          "name"
                        ],
                        "type": "object",
                        "additionalProperties": false
                      }
                    },
                    "type": "object",
                    "additionalProperties": false
                  },
                  "uriStyle": {
                    "description": "S3 URI Style.",
                    "enum": [
                      "host",
                      "path"
                    ],
                    "type": "string"
                  },
                  "verifyTLS": {
                    "default": true,
                    "description": "Repository storage certificate verify.",
                    "type": "boolean"
                  }
                },
                "required": [
                  "bucket",
                  "endpoint",
                  "region",
                  "repoPath"
                ],
                "type": "object",
                "additionalProperties": false
              },
              "type": "array"
            },
            "startFast": {
              "default": true,
              "description": "Default behavior to Force a checkpoint to start backup quickly.\n\nForces a checkpoint (by passing y to the fast parameter of the backup start\nfunction) so the backup begins immediately. Otherwise the backup will start\nafter the next regular checkpoint.",
              "type": "boolean"
            }
          },
          "required": [
            "name"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "required": [
        "stanzaConfiguration"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "status defines the observed state of Stanza",
      "properties": {
        "backupsCount": {
          "properties": {
            "Diff": {
              "type": "integer"
            },
            "Full": {
              "type": "integer"
            },
            "Incr": {
              "type": "integer"
            }
          },
          "required": [
            "Diff",
            "Full",
            "Incr"
          ],
          "type": "object",
          "additionalProperties": false
        },
        "conditions": {
          "description": "conditions represent the current state of the Stanza resource.\nEach condition has a unique type and reflects the status of a specific aspect of the resource.\n\nStandard condition types include:\n- \"Available\": the resource is fully functional\n- \"Progressing\": the resource is being created or updated\n- \"Degraded\": the resource failed to reach or maintain its desired state\n\nThe status of each condition is one of True, False, or Unknown.",
          "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",
            "additionalProperties": false
          },
          "type": "array",
          "x-kubernetes-list-map-keys": [
            "type"
          ],
          "x-kubernetes-list-type": "map"
        },
        "recoveryWindow": {
          "properties": {
            "firstBackup": {
              "properties": {
                "archive": {
                  "properties": {
                    "start": {
                      "type": "string"
                    },
                    "stop": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "label": {
                  "type": "string"
                },
                "lsn": {
                  "properties": {
                    "start": {
                      "type": "string"
                    },
                    "stop": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "prior": {
                  "type": "string"
                },
                "timestamp": {
                  "properties": {
                    "start": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "stop": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "archive",
                "label",
                "lsn",
                "prior",
                "timestamp",
                "type"
              ],
              "type": "object",
              "additionalProperties": false
            },
            "lastBackup": {
              "properties": {
                "archive": {
                  "properties": {
                    "start": {
                      "type": "string"
                    },
                    "stop": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "label": {
                  "type": "string"
                },
                "lsn": {
                  "properties": {
                    "start": {
                      "type": "string"
                    },
                    "stop": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "prior": {
                  "type": "string"
                },
                "timestamp": {
                  "properties": {
                    "start": {
                      "format": "int64",
                      "type": "integer"
                    },
                    "stop": {
                      "format": "int64",
                      "type": "integer"
                    }
                  },
                  "required": [
                    "start",
                    "stop"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": {
                  "type": "string"
                }
              },
              "required": [
                "archive",
                "label",
                "lsn",
                "prior",
                "timestamp",
                "type"
              ],
              "type": "object",
              "additionalProperties": false
            }
          },
          "required": [
            "firstBackup",
            "lastBackup"
          ],
          "type": "object",
          "additionalProperties": false
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "required": [
    "spec"
  ],
  "type": "object"
}
