{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/google-kubernetes-engine/json-schema/google-kubernetes-engine-backup-plan-schema.json",
  "title": "BackupPlan",
  "description": "Defines the configuration and scheduling for a \"line\" of Backups.",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/google-kubernetes-engine-gkebackup-projects-api-openapi.yml#/components/schemas/BackupPlan",
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "readOnly": true,
      "description": "Output only. Identifier. The full name of the BackupPlan resource. Format: `projects/*/locations/*/backupPlans/*`"
    },
    "backupConfig": {
      "$ref": "#/$defs/BackupConfig",
      "description": "Optional. Defines the configuration of Backups created via this BackupPlan."
    },
    "backupSchedule": {
      "$ref": "#/$defs/Schedule",
      "description": "Optional. Defines a schedule for automatic Backup creation via this BackupPlan."
    },
    "protectedPodCount": {
      "type": "integer",
      "description": "Output only. The number of Kubernetes Pods backed up in the last successful Backup created via this BackupPlan.",
      "format": "int32",
      "readOnly": true
    },
    "description": {
      "type": "string",
      "description": "Optional. User specified descriptive string for this BackupPlan."
    },
    "state": {
      "type": "string",
      "enum": [
        "STATE_UNSPECIFIED",
        "CLUSTER_PENDING",
        "PROVISIONING",
        "READY",
        "FAILED",
        "DEACTIVATED",
        "DELETING"
      ],
      "readOnly": true,
      "description": "Output only. State of the BackupPlan. This State field reflects the various stages a BackupPlan can be in during the Create operation. It will be set to \"DEACTIVATED\" if the BackupPlan is deactivated on an Update"
    },
    "rpoRiskLevel": {
      "type": "integer",
      "format": "int32",
      "description": "Output only. A number that represents the current risk level of this BackupPlan from RPO perspective with 1 being no risk and 5 being highest risk.",
      "readOnly": true
    },
    "backupChannel": {
      "type": "string",
      "readOnly": true,
      "description": "Output only. The fully qualified name of the BackupChannel to be used to create a backup. This field is set only if the cluster being backed up is in a different project. `projects/*/locations/*/backupChannels/*`"
    },
    "uid": {
      "description": "Output only. Server generated global unique identifier of [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) format.",
      "readOnly": true,
      "type": "string"
    },
    "createTime": {
      "format": "google-datetime",
      "readOnly": true,
      "description": "Output only. The timestamp when this BackupPlan resource was created.",
      "type": "string"
    },
    "protectedNamespaceCount": {
      "description": "Output only. The number of user managed namespaces backed up in the last successful Backup created via this BackupPlan.",
      "format": "int32",
      "type": "integer",
      "readOnly": true
    },
    "updateTime": {
      "description": "Output only. The timestamp when this BackupPlan resource was last updated.",
      "readOnly": true,
      "format": "google-datetime",
      "type": "string"
    },
    "rpoRiskReason": {
      "readOnly": true,
      "type": "string",
      "description": "Output only. Human-readable description of why the BackupPlan is in the current rpo_risk_level and action items if any."
    },
    "etag": {
      "description": "Output only. `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a backup plan from overwriting each other. It is strongly suggested that systems make use of the 'etag' in the read-modify-write cycle to perform BackupPlan updates in order to avoid race conditions: An `etag` is returned in the response to `GetBackupPlan`, and systems are expected to put that etag in the request to `UpdateBackupPlan` or `DeleteBackupPlan` to ensure that their change will be applied to the same version of the resource.",
      "type": "string",
      "readOnly": true
    },
    "lastSuccessfulBackupTime": {
      "readOnly": true,
      "format": "google-datetime",
      "description": "Output only. Completion time of the last successful Backup. This is sourced from a successful Backup's complete_time field. This field is added to maintain consistency with BackupPlanBinding to display last successful backup time.",
      "type": "string"
    },
    "cluster": {
      "description": "Required. Immutable. The source cluster from which Backups will be created via this BackupPlan. Valid formats: - `projects/*/locations/*/clusters/*` - `projects/*/zones/*/clusters/*`",
      "type": "string"
    },
    "deactivated": {
      "type": "boolean",
      "description": "Optional. This flag indicates whether this BackupPlan has been deactivated. Setting this field to True locks the BackupPlan such that no further updates will be allowed (except deletes), including the deactivated field itself. It also prevents any new Backups from being created via this BackupPlan (including scheduled Backups). Default: False"
    },
    "stateReason": {
      "type": "string",
      "description": "Output only. Human-readable description of why BackupPlan is in the current `state`. This field is only meant for human readability and should not be used programmatically as this field is not guaranteed to be consistent.",
      "readOnly": true
    },
    "labels": {
      "additionalProperties": {
        "type": "string"
      },
      "type": "object",
      "description": "Optional. A set of custom labels supplied by user."
    },
    "retentionPolicy": {
      "$ref": "#/$defs/RetentionPolicy",
      "description": "Optional. RetentionPolicy governs lifecycle of Backups created under this plan."
    }
  },
  "$defs": {
    "BackupConfig": {
      "properties": {
        "includeSecrets": {
          "type": "boolean",
          "description": "Optional. This flag specifies whether Kubernetes Secret resources should be included when they fall into the scope of Backups. Default: False"
        },
        "encryptionKey": {
          "$ref": "#/$defs/EncryptionKey",
          "description": "Optional. This defines a customer managed encryption key that will be used to encrypt the \"config\" portion (the Kubernetes resources) of Backups created via this plan. Default (empty): Config backup artifacts will not be encrypted."
        },
        "permissiveMode": {
          "description": "Optional. If false, Backups will fail when Backup for GKE detects Kubernetes configuration that is non-standard or requires additional setup to restore. Default: False",
          "type": "boolean"
        },
        "includeVolumeData": {
          "type": "boolean",
          "description": "Optional. This flag specifies whether volume data should be backed up when PVCs are included in the scope of a Backup. Default: False"
        },
        "selectedApplications": {
          "$ref": "#/$defs/NamespacedNames",
          "description": "If set, include just the resources referenced by the listed ProtectedApplications."
        },
        "allNamespaces": {
          "type": "boolean",
          "description": "If True, include all namespaced resources"
        },
        "selectedNamespaces": {
          "$ref": "#/$defs/Namespaces",
          "description": "If set, include just the resources in the listed namespaces."
        },
        "selectedNamespaceLabels": {
          "$ref": "#/$defs/ResourceLabels",
          "description": "If set, the list of labels whose constituent namespaces were included in the Backup."
        }
      },
      "description": "BackupConfig defines the configuration of Backups created via this BackupPlan.",
      "type": "object"
    },
    "Date": {
      "type": "object",
      "description": "Represents a whole or partial calendar date, such as a birthday. The time of day and time zone are either specified elsewhere or are insignificant. The date is relative to the Gregorian Calendar. This can represent one of the following: * A full date, with non-zero year, month, and day values. * A month and day, with a zero year (for example, an anniversary). * A year on its own, with a zero month and a zero day. * A year and month, with a zero day (for example, a credit card expiration date). Related types: * google.type.TimeOfDay * google.type.DateTime * google.protobuf.Timestamp",
      "properties": {
        "day": {
          "description": "Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant.",
          "type": "integer",
          "format": "int32"
        },
        "month": {
          "description": "Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day.",
          "format": "int32",
          "type": "integer"
        },
        "year": {
          "description": "Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year.",
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "DayOfWeekList": {
      "type": "object",
      "description": "Holds repeated DaysOfWeek values as a container.",
      "properties": {
        "daysOfWeek": {
          "description": "Optional. A list of days of week.",
          "items": {
            "type": "string",
            "enum": [
              "DAY_OF_WEEK_UNSPECIFIED",
              "MONDAY",
              "TUESDAY",
              "WEDNESDAY",
              "THURSDAY",
              "FRIDAY",
              "SATURDAY",
              "SUNDAY"
            ]
          },
          "type": "array"
        }
      }
    },
    "EncryptionKey": {
      "description": "Defined a customer managed encryption key that will be used to encrypt Backup artifacts.",
      "type": "object",
      "properties": {
        "gcpKmsEncryptionKey": {
          "type": "string",
          "description": "Optional. Google Cloud KMS encryption key. Format: `projects/*/locations/*/keyRings/*/cryptoKeys/*`"
        }
      }
    },
    "ExclusionWindow": {
      "description": "Defines a time window during which no backup should happen. All time and date are in UTC.",
      "type": "object",
      "properties": {
        "startTime": {
          "$ref": "#/$defs/TimeOfDay",
          "description": "Optional. Specifies the start time of the window using time of the day in UTC."
        },
        "duration": {
          "description": "Required. Specifies duration of the window. Duration must be >= 5 minutes and < (target RPO - 20 minutes). Additional restrictions based on the recurrence type to allow some time for backup to happen: - single_occurrence_date: no restriction, but UI may warn about this when duration >= target RPO - daily window: duration < 24 hours - weekly window: - days of week includes all seven days of a week: duration < 24 hours - all other weekly window: duration < 168 hours (i.e., 24 * 7 hours)",
          "type": "string",
          "format": "google-duration"
        },
        "singleOccurrenceDate": {
          "$ref": "#/$defs/Date",
          "description": "No recurrence. The exclusion window occurs only once and on this date in UTC."
        },
        "daysOfWeek": {
          "$ref": "#/$defs/DayOfWeekList",
          "description": "The exclusion window occurs on these days of each week in UTC."
        },
        "daily": {
          "description": "The exclusion window occurs every day if set to \"True\". Specifying this field to \"False\" is an error.",
          "type": "boolean"
        }
      }
    },
    "Label": {
      "properties": {
        "key": {
          "type": "string",
          "description": "Optional. The key/name of the label."
        },
        "value": {
          "description": "Optional. The value of the label.",
          "type": "string"
        }
      },
      "description": "A single Kubernetes label-value pair.",
      "type": "object"
    },
    "NamespacedName": {
      "description": "A reference to a namespaced resource in Kubernetes.",
      "type": "object",
      "properties": {
        "namespace": {
          "type": "string",
          "description": "Optional. The Namespace of the Kubernetes resource."
        },
        "name": {
          "description": "Optional. The name of the Kubernetes resource.",
          "type": "string"
        }
      }
    },
    "NamespacedNames": {
      "properties": {
        "namespacedNames": {
          "items": {
            "$ref": "#/$defs/NamespacedName"
          },
          "description": "Optional. A list of namespaced Kubernetes resources.",
          "type": "array"
        }
      },
      "description": "A list of namespaced Kubernetes resources.",
      "type": "object"
    },
    "Namespaces": {
      "type": "object",
      "properties": {
        "namespaces": {
          "description": "Optional. A list of Kubernetes Namespaces.",
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "description": "A list of Kubernetes Namespaces."
    },
    "ResourceLabels": {
      "properties": {
        "resourceLabels": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Label"
          },
          "description": "Optional. A list of Kubernetes label-value pairs."
        }
      },
      "description": "A list of Kubernetes labels.",
      "type": "object"
    },
    "RetentionPolicy": {
      "description": "RetentionPolicy defines a Backup retention policy for a BackupPlan.",
      "type": "object",
      "properties": {
        "locked": {
          "description": "Optional. This flag denotes whether the retention policy of this BackupPlan is locked. If set to True, no further update is allowed on this policy, including the `locked` field itself. Default: False",
          "type": "boolean"
        },
        "backupRetainDays": {
          "description": "Optional. The default maximum age of a Backup created via this BackupPlan. This field MUST be an integer value >= 0 and <= 365. If specified, a Backup created under this BackupPlan will be automatically deleted after its age reaches (create_time + backup_retain_days). If not specified, Backups created under this BackupPlan will NOT be subject to automatic deletion. Updating this field does NOT affect existing Backups under it. Backups created AFTER a successful update will automatically pick up the new value. NOTE: backup_retain_days must be >= backup_delete_lock_days. If cron_schedule is defined, then this must be <= 360 * the creation interval. If rpo_config is defined, then this must be <= 360 * target_rpo_minutes / (1440minutes/day). Default: 0 (no automatic deletion)",
          "type": "integer",
          "format": "int32"
        },
        "backupDeleteLockDays": {
          "type": "integer",
          "format": "int32",
          "description": "Optional. Minimum age for Backups created via this BackupPlan (in days). This field MUST be an integer value between 0-90 (inclusive). A Backup created under this BackupPlan will NOT be deletable until it reaches Backup's (create_time + backup_delete_lock_days). Updating this field of a BackupPlan does NOT affect existing Backups under it. Backups created AFTER a successful update will inherit the new value. Default: 0 (no delete blocking)"
        }
      }
    },
    "RpoConfig": {
      "type": "object",
      "description": "Defines RPO scheduling configuration for automatically creating Backups via this BackupPlan.",
      "properties": {
        "targetRpoMinutes": {
          "type": "integer",
          "format": "int32",
          "description": "Required. Defines the target RPO for the BackupPlan in minutes, which means the target maximum data loss in time that is acceptable for this BackupPlan. This must be at least 60, i.e., 1 hour, and at most 86400, i.e., 60 days."
        },
        "exclusionWindows": {
          "items": {
            "$ref": "#/$defs/ExclusionWindow"
          },
          "type": "array",
          "description": "Optional. User specified time windows during which backup can NOT happen for this BackupPlan - backups should start and finish outside of any given exclusion window. Note: backup jobs will be scheduled to start and finish outside the duration of the window as much as possible, but running jobs will not get canceled when it runs into the window. All the time and date values in exclusion_windows entry in the API are in UTC. We only allow <=1 recurrence (daily or weekly) exclusion window for a BackupPlan while no restriction on number of single occurrence windows."
        }
      }
    },
    "Schedule": {
      "description": "Defines scheduling parameters for automatically creating Backups via this BackupPlan.",
      "type": "object",
      "properties": {
        "paused": {
          "description": "Optional. This flag denotes whether automatic Backup creation is paused for this BackupPlan. Default: False",
          "type": "boolean"
        },
        "cronSchedule": {
          "type": "string",
          "description": "Optional. A standard [cron](https://wikipedia.com/wiki/cron) string that defines a repeating schedule for creating Backups via this BackupPlan. This is mutually exclusive with the rpo_config field since at most one schedule can be defined for a BackupPlan. If this is defined, then backup_retain_days must also be defined. Default (empty): no automatic backup creation will occur."
        },
        "rpoConfig": {
          "$ref": "#/$defs/RpoConfig",
          "description": "Optional. Defines the RPO schedule configuration for this BackupPlan. This is mutually exclusive with the cron_schedule field since at most one schedule can be defined for a BackupPLan. If this is defined, then backup_retain_days must also be defined. Default (empty): no automatic backup creation will occur."
        },
        "nextScheduledBackupTime": {
          "format": "google-datetime",
          "description": "Output only. Start time of next scheduled backup under this BackupPlan by either cron_schedule or rpo config.",
          "readOnly": true,
          "type": "string"
        }
      }
    },
    "TimeOfDay": {
      "type": "object",
      "properties": {
        "seconds": {
          "description": "Seconds of a minute. Must be greater than or equal to 0 and typically must be less than or equal to 59. An API may allow the value 60 if it allows leap-seconds.",
          "format": "int32",
          "type": "integer"
        },
        "nanos": {
          "type": "integer",
          "description": "Fractions of seconds, in nanoseconds. Must be greater than or equal to 0 and less than or equal to 999,999,999.",
          "format": "int32"
        },
        "hours": {
          "type": "integer",
          "format": "int32",
          "description": "Hours of a day in 24 hour format. Must be greater than or equal to 0 and typically must be less than or equal to 23. An API may choose to allow the value \"24:00:00\" for scenarios like business closing time."
        },
        "minutes": {
          "description": "Minutes of an hour. Must be greater than or equal to 0 and less than or equal to 59.",
          "format": "int32",
          "type": "integer"
        }
      },
      "description": "Represents a time of day. The date and time zone are either not significant or are specified elsewhere. An API may choose to allow leap seconds. Related types are google.type.Date and `google.protobuf.Timestamp`."
    }
  }
}