public sealed class BackupPlan.Types.RetentionPolicy : IMessage<BackupPlan.Types.RetentionPolicy>, IEquatable<BackupPlan.Types.RetentionPolicy>, IDeepCloneable<BackupPlan.Types.RetentionPolicy>, IBufferMessage, IMessage
Reference documentation and code samples for the Backup for GKE v1 API class BackupPlan.Types.RetentionPolicy.
RetentionPolicy defines a Backup retention policy for a BackupPlan.
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.
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][google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days].
If
[cron_schedule][google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule]
is defined, then this must be
<= 360 * the creation interval. If
[rpo_config][google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config] is
defined, then this must be
<= 360 * [target_rpo_minutes][Schedule.rpo_config.target_rpo_minutes] /
(1440minutes/day).
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThe latest version of the \u003ccode\u003eBackupPlan.Types.RetentionPolicy\u003c/code\u003e class is 2.6.0, with multiple previous versions also available for reference, including versions down to 1.0.0-beta01.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRetentionPolicy\u003c/code\u003e is a class that defines how backups are retained within a \u003ccode\u003eBackupPlan\u003c/code\u003e, providing settings for managing the lifecycle of the backups.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eBackupDeleteLockDays\u003c/code\u003e property allows setting a minimum age in days before a backup can be deleted, with a default of 0 (no lock) and a range between 0-90 days.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eBackupRetainDays\u003c/code\u003e sets the maximum age in days for a backup, after which it is automatically deleted, with a default of 0 (no automatic deletion) and a range between 0-365 days.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eLocked\u003c/code\u003e property of \u003ccode\u003eRetentionPolicy\u003c/code\u003e determines whether further updates are permitted to the policy, and when set to \u003ccode\u003etrue\u003c/code\u003e, the policy is considered locked and cannot be changed.\u003c/p\u003e\n"]]],[],null,["# Backup for GKE v1 API - Class BackupPlan.Types.RetentionPolicy (2.8.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.8.0 (latest)](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.7.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.7.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.6.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.6.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.5.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.5.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.4.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.4.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.3.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.3.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.2.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.2.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.1.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.1.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [2.0.0](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/2.0.0/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy)\n- [1.0.0-beta01](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/1.0.0-beta01/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy) \n\n public sealed class BackupPlan.Types.RetentionPolicy : IMessage\u003cBackupPlan.Types.RetentionPolicy\u003e, IEquatable\u003cBackupPlan.Types.RetentionPolicy\u003e, IDeepCloneable\u003cBackupPlan.Types.RetentionPolicy\u003e, IBufferMessage, IMessage\n\nReference documentation and code samples for the Backup for GKE v1 API class BackupPlan.Types.RetentionPolicy.\n\nRetentionPolicy defines a Backup retention policy for a BackupPlan. \n\nInheritance\n-----------\n\n[object](https://learn.microsoft.com/dotnet/api/system.object) \\\u003e BackupPlan.Types.RetentionPolicy \n\nImplements\n----------\n\n[IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage-1.html)[BackupPlan](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan)[Types](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types)[RetentionPolicy](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy), [IEquatable](https://learn.microsoft.com/dotnet/api/system.iequatable-1)[BackupPlan](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan)[Types](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types)[RetentionPolicy](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy), [IDeepCloneable](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IDeepCloneable-1.html)[BackupPlan](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan)[Types](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types)[RetentionPolicy](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1.BackupPlan.Types.RetentionPolicy), [IBufferMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IBufferMessage.html), [IMessage](https://cloud.google.com/dotnet/docs/reference/Google.Protobuf/latest/Google.Protobuf.IMessage.html) \n\nInherited Members\n-----------------\n\n[object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode) \n[object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype) \n[object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)\n\nNamespace\n---------\n\n[Google.Cloud.GkeBackup.V1](/dotnet/docs/reference/Google.Cloud.GkeBackup.V1/latest/Google.Cloud.GkeBackup.V1)\n\nAssembly\n--------\n\nGoogle.Cloud.GkeBackup.V1.dll\n\nConstructors\n------------\n\n### RetentionPolicy()\n\n public RetentionPolicy()\n\n### RetentionPolicy(RetentionPolicy)\n\n public RetentionPolicy(BackupPlan.Types.RetentionPolicy other)\n\nProperties\n----------\n\n### BackupDeleteLockDays\n\n public int BackupDeleteLockDays { get; set; }\n\nOptional. Minimum age for Backups created via this BackupPlan (in days).\nThis field MUST be an integer value between 0-90 (inclusive).\nA Backup created under this BackupPlan will NOT be deletable until it\nreaches Backup's (create_time + backup_delete_lock_days).\nUpdating this field of a BackupPlan does NOT affect existing Backups\nunder it. Backups created AFTER a successful update will inherit\nthe new value.\n\nDefault: 0 (no delete blocking)\n\n### BackupRetainDays\n\n public int BackupRetainDays { get; set; }\n\nOptional. The default maximum age of a Backup created via this\nBackupPlan. This field MUST be an integer value \\\u003e= 0 and \\\u003c= 365. If\nspecified, a Backup created under this BackupPlan will be automatically\ndeleted after its age reaches (create_time + backup_retain_days). If not\nspecified, Backups created under this BackupPlan will NOT be subject to\nautomatic deletion. Updating this field does NOT affect existing Backups\nunder it. Backups created AFTER a successful update will automatically\npick up the new value. NOTE: backup_retain_days must be \\\u003e=\n\\[backup_delete_lock_days\\]\\[google.cloud.gkebackup.v1.BackupPlan.RetentionPolicy.backup_delete_lock_days\\].\nIf\n\\[cron_schedule\\]\\[google.cloud.gkebackup.v1.BackupPlan.Schedule.cron_schedule\\]\nis defined, then this must be\n\\\u003c= 360 \\* the creation interval. If\n\\[rpo_config\\]\\[google.cloud.gkebackup.v1.BackupPlan.Schedule.rpo_config\\] is\ndefined, then this must be\n\\\u003c= 360 \\* \\[target_rpo_minutes\\]\\[Schedule.rpo_config.target_rpo_minutes\\] /\n(1440minutes/day).\n\nDefault: 0 (no automatic deletion)\n\n### Locked\n\n public bool Locked { get; set; }\n\nOptional. This flag denotes whether the retention policy of this\nBackupPlan is locked. If set to True, no further update is allowed on\nthis policy, including the `locked` field itself.\n\nDefault: False"]]