Skip to content

Commit 091f988

Browse files
feat: [google-cloud-gke-backup] Add BackupChannel field in BackupPlan (#13905)
BEGIN_COMMIT_OVERRIDE feat: Add BackupChannel field in BackupPlan feat: Add RestoreChannel field in RestorePlan feat: Add BackupConfig of Backups in BackupPlanBinding feat: Add support for Project ID in BackupChannel and RestoreChannel docs: minor documentation fixes END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. feat: Add RestoreChannel field in RestorePlan feat: Add BackupConfig of Backups in BackupPlanBinding feat: Add support for Project ID in BackupChannel and RestoreChannel docs: minor documentation fixes PiperOrigin-RevId: 758503180 Source-Link: googleapis/googleapis@8a3ddf0 Source-Link: googleapis/googleapis-gen@9c42164 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZS1iYWNrdXAvLk93bEJvdC55YW1sIiwiaCI6IjljNDIxNjQ0YjNkMTUzM2UxODUzY2RhZTliNTI5NjNlNmNhZjgzZjYifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 2fe4678 commit 091f988

File tree

6 files changed

+178
-6
lines changed

6 files changed

+178
-6
lines changed

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/backup_channel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ class BackupChannel(proto.Message):
4040
``projects/*/locations/*/backupChannels/*``
4141
destination_project (str):
4242
Required. Immutable. The project where Backups are allowed
43-
to be stored. The format is ``projects/{project}``.
44-
Currently, {project} can only be the project number. Support
45-
for project IDs will be added in the future.
43+
to be stored. The format is ``projects/{projectId}`` or
44+
``projects/{projectNumber}``.
4645
uid (str):
4746
Output only. Server generated global unique identifier of
4847
`UUID <https://en.wikipedia.org/wiki/Universally_unique_identifier>`__

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/backup_plan.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ class BackupPlan(proto.Message):
121121
Output only. Human-readable description of why the
122122
BackupPlan is in the current rpo_risk_level and action items
123123
if any.
124+
backup_channel (str):
125+
Output only. The fully qualified name of the BackupChannel
126+
to be used to create a backup. This field is set only if the
127+
cluster being backed up is in a different project.
128+
``projects/*/locations/*/backupChannels/*``
124129
last_successful_backup_time (google.protobuf.timestamp_pb2.Timestamp):
125130
Output only. Completion time of the last successful Backup.
126131
This is sourced from a successful Backup's complete_time
@@ -439,6 +444,10 @@ class BackupConfig(proto.Message):
439444
proto.STRING,
440445
number=17,
441446
)
447+
backup_channel: str = proto.Field(
448+
proto.STRING,
449+
number=18,
450+
)
442451
last_successful_backup_time: timestamp_pb2.Timestamp = proto.Field(
443452
proto.MESSAGE,
444453
number=19,

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/backup_plan_binding.py

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
from google.protobuf import timestamp_pb2 # type: ignore
2121
import proto # type: ignore
2222

23+
from google.cloud.gke_backup_v1.types import common
24+
2325
__protobuf__ = proto.module(
2426
package="google.cloud.gkebackup.v1",
2527
manifest={
@@ -103,6 +105,14 @@ class BackupPlanDetails(proto.Message):
103105
Output only. The fully qualified name of the last successful
104106
Backup created under this BackupPlan.
105107
``projects/*/locations/*/backupPlans/*/backups/*``
108+
backup_config_details (google.cloud.gke_backup_v1.types.BackupPlanBinding.BackupPlanDetails.BackupConfigDetails):
109+
Output only. Contains details about the
110+
BackupConfig of Backups created via this
111+
BackupPlan.
112+
retention_policy_details (google.cloud.gke_backup_v1.types.BackupPlanBinding.BackupPlanDetails.RetentionPolicyDetails):
113+
Output only. Contains details about the
114+
RetentionPolicy of Backups created via this
115+
BackupPlan.
106116
"""
107117

108118
class State(proto.Enum):
@@ -135,6 +145,123 @@ class State(proto.Enum):
135145
DEACTIVATED = 5
136146
DELETING = 6
137147

148+
class BackupConfigDetails(proto.Message):
149+
r"""BackupConfigDetails defines the configuration of Backups
150+
created via this BackupPlan.
151+
152+
This message has `oneof`_ fields (mutually exclusive fields).
153+
For each oneof, at most one member field can be set at the same time.
154+
Setting any member of the oneof automatically clears all other
155+
members.
156+
157+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
158+
159+
Attributes:
160+
all_namespaces (bool):
161+
Output only. If True, include all namespaced
162+
resources
163+
164+
This field is a member of `oneof`_ ``backup_scope``.
165+
selected_namespaces (google.cloud.gke_backup_v1.types.Namespaces):
166+
Output only. If set, include just the
167+
resources in the listed namespaces.
168+
169+
This field is a member of `oneof`_ ``backup_scope``.
170+
selected_applications (google.cloud.gke_backup_v1.types.NamespacedNames):
171+
Output only. If set, include just the
172+
resources referenced by the listed
173+
ProtectedApplications.
174+
175+
This field is a member of `oneof`_ ``backup_scope``.
176+
include_volume_data (bool):
177+
Output only. This flag specifies whether
178+
volume data should be backed up when PVCs are
179+
included in the scope of a Backup.
180+
181+
Default: False
182+
include_secrets (bool):
183+
Output only. This flag specifies whether
184+
Kubernetes Secret resources should be included
185+
when they fall into the scope of Backups.
186+
187+
Default: False
188+
encryption_key (google.cloud.gke_backup_v1.types.EncryptionKey):
189+
Output only. This defines a customer managed
190+
encryption key that will be used to encrypt the
191+
"config" portion (the Kubernetes resources) of
192+
Backups created via this plan.
193+
194+
Default (empty): Config backup artifacts will
195+
not be encrypted.
196+
"""
197+
198+
all_namespaces: bool = proto.Field(
199+
proto.BOOL,
200+
number=1,
201+
oneof="backup_scope",
202+
)
203+
selected_namespaces: common.Namespaces = proto.Field(
204+
proto.MESSAGE,
205+
number=2,
206+
oneof="backup_scope",
207+
message=common.Namespaces,
208+
)
209+
selected_applications: common.NamespacedNames = proto.Field(
210+
proto.MESSAGE,
211+
number=3,
212+
oneof="backup_scope",
213+
message=common.NamespacedNames,
214+
)
215+
include_volume_data: bool = proto.Field(
216+
proto.BOOL,
217+
number=5,
218+
)
219+
include_secrets: bool = proto.Field(
220+
proto.BOOL,
221+
number=6,
222+
)
223+
encryption_key: common.EncryptionKey = proto.Field(
224+
proto.MESSAGE,
225+
number=7,
226+
message=common.EncryptionKey,
227+
)
228+
229+
class RetentionPolicyDetails(proto.Message):
230+
r"""RetentionPolicyDetails defines a Backup retention policy for
231+
a BackupPlan.
232+
233+
Attributes:
234+
backup_delete_lock_days (int):
235+
Optional. Minimum age for Backups created via this
236+
BackupPlan (in days). This field MUST be an integer value
237+
between 0-90 (inclusive). A Backup created under this
238+
BackupPlan will NOT be deletable until it reaches Backup's
239+
(create_time + backup_delete_lock_days). Updating this field
240+
of a BackupPlan does NOT affect existing Backups under it.
241+
Backups created AFTER a successful update will inherit the
242+
new value.
243+
244+
Default: 0 (no delete blocking)
245+
backup_retain_days (int):
246+
Optional. The default maximum age of a Backup created via
247+
this BackupPlan. This field MUST be an integer value >= 0
248+
and <= 365. If specified, a Backup created under this
249+
BackupPlan will be automatically deleted after its age
250+
reaches (create_time + backup_retain_days). If not
251+
specified, Backups created under this BackupPlan will NOT be
252+
subject to automatic deletion. Default: 0 (no automatic
253+
deletion)
254+
"""
255+
256+
backup_delete_lock_days: int = proto.Field(
257+
proto.INT32,
258+
number=1,
259+
)
260+
backup_retain_days: int = proto.Field(
261+
proto.INT32,
262+
number=2,
263+
)
264+
138265
protected_pod_count: int = proto.Field(
139266
proto.INT32,
140267
number=1,
@@ -162,6 +289,16 @@ class State(proto.Enum):
162289
proto.STRING,
163290
number=6,
164291
)
292+
backup_config_details: "BackupPlanBinding.BackupPlanDetails.BackupConfigDetails" = proto.Field(
293+
proto.MESSAGE,
294+
number=7,
295+
message="BackupPlanBinding.BackupPlanDetails.BackupConfigDetails",
296+
)
297+
retention_policy_details: "BackupPlanBinding.BackupPlanDetails.RetentionPolicyDetails" = proto.Field(
298+
proto.MESSAGE,
299+
number=8,
300+
message="BackupPlanBinding.BackupPlanDetails.RetentionPolicyDetails",
301+
)
165302

166303
name: str = proto.Field(
167304
proto.STRING,

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/restore_channel.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ class RestoreChannel(proto.Message):
4040
``projects/*/locations/*/restoreChannels/*``
4141
destination_project (str):
4242
Required. Immutable. The project into which the backups will
43-
be restored. The format is ``projects/{project}``.
44-
Currently, {project} can only be the project number. Support
45-
for project IDs will be added in the future.
43+
be restored. The format is ``projects/{projectId}`` or
44+
``projects/{projectNumber}``.
4645
uid (str):
4746
Output only. Server generated global unique identifier of
4847
`UUID <https://en.wikipedia.org/wiki/Universally_unique_identifier>`__

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/restore_plan.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,12 @@ class RestorePlan(proto.Message):
9393
is in the current ``state``. This field is only meant for
9494
human readability and should not be used programmatically as
9595
this field is not guaranteed to be consistent.
96+
restore_channel (str):
97+
Output only. The fully qualified name of the RestoreChannel
98+
to be used to create a RestorePlan. This field is set only
99+
if the ``backup_plan`` is in a different project than the
100+
RestorePlan. Format:
101+
``projects/*/locations/*/restoreChannels/*``
96102
"""
97103

98104
class State(proto.Enum):
@@ -171,6 +177,10 @@ class State(proto.Enum):
171177
proto.STRING,
172178
number=12,
173179
)
180+
restore_channel: str = proto.Field(
181+
proto.STRING,
182+
number=13,
183+
)
174184

175185

176186
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-gke-backup/tests/unit/gapic/gke_backup_v1/test_backup_for_gke.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2071,6 +2071,7 @@ def test_get_backup_plan(request_type, transport: str = "grpc"):
20712071
state_reason="state_reason_value",
20722072
rpo_risk_level=1504,
20732073
rpo_risk_reason="rpo_risk_reason_value",
2074+
backup_channel="backup_channel_value",
20742075
)
20752076
response = client.get_backup_plan(request)
20762077

@@ -2093,6 +2094,7 @@ def test_get_backup_plan(request_type, transport: str = "grpc"):
20932094
assert response.state_reason == "state_reason_value"
20942095
assert response.rpo_risk_level == 1504
20952096
assert response.rpo_risk_reason == "rpo_risk_reason_value"
2097+
assert response.backup_channel == "backup_channel_value"
20962098

20972099

20982100
def test_get_backup_plan_non_empty_request_with_auto_populated_field():
@@ -2229,6 +2231,7 @@ async def test_get_backup_plan_async(
22292231
state_reason="state_reason_value",
22302232
rpo_risk_level=1504,
22312233
rpo_risk_reason="rpo_risk_reason_value",
2234+
backup_channel="backup_channel_value",
22322235
)
22332236
)
22342237
response = await client.get_backup_plan(request)
@@ -2252,6 +2255,7 @@ async def test_get_backup_plan_async(
22522255
assert response.state_reason == "state_reason_value"
22532256
assert response.rpo_risk_level == 1504
22542257
assert response.rpo_risk_reason == "rpo_risk_reason_value"
2258+
assert response.backup_channel == "backup_channel_value"
22552259

22562260

22572261
@pytest.mark.asyncio
@@ -9806,6 +9810,7 @@ def test_get_restore_plan(request_type, transport: str = "grpc"):
98069810
etag="etag_value",
98079811
state=restore_plan.RestorePlan.State.CLUSTER_PENDING,
98089812
state_reason="state_reason_value",
9813+
restore_channel="restore_channel_value",
98099814
)
98109815
response = client.get_restore_plan(request)
98119816

@@ -9825,6 +9830,7 @@ def test_get_restore_plan(request_type, transport: str = "grpc"):
98259830
assert response.etag == "etag_value"
98269831
assert response.state == restore_plan.RestorePlan.State.CLUSTER_PENDING
98279832
assert response.state_reason == "state_reason_value"
9833+
assert response.restore_channel == "restore_channel_value"
98289834

98299835

98309836
def test_get_restore_plan_non_empty_request_with_auto_populated_field():
@@ -9960,6 +9966,7 @@ async def test_get_restore_plan_async(
99609966
etag="etag_value",
99619967
state=restore_plan.RestorePlan.State.CLUSTER_PENDING,
99629968
state_reason="state_reason_value",
9969+
restore_channel="restore_channel_value",
99639970
)
99649971
)
99659972
response = await client.get_restore_plan(request)
@@ -9980,6 +9987,7 @@ async def test_get_restore_plan_async(
99809987
assert response.etag == "etag_value"
99819988
assert response.state == restore_plan.RestorePlan.State.CLUSTER_PENDING
99829989
assert response.state_reason == "state_reason_value"
9990+
assert response.restore_channel == "restore_channel_value"
99839991

99849992

99859993
@pytest.mark.asyncio
@@ -26091,6 +26099,7 @@ async def test_get_backup_plan_empty_call_grpc_asyncio():
2609126099
state_reason="state_reason_value",
2609226100
rpo_risk_level=1504,
2609326101
rpo_risk_reason="rpo_risk_reason_value",
26102+
backup_channel="backup_channel_value",
2609426103
)
2609526104
)
2609626105
await client.get_backup_plan(request=None)
@@ -26660,6 +26669,7 @@ async def test_get_restore_plan_empty_call_grpc_asyncio():
2666026669
etag="etag_value",
2666126670
state=restore_plan.RestorePlan.State.CLUSTER_PENDING,
2666226671
state_reason="state_reason_value",
26672+
restore_channel="restore_channel_value",
2666326673
)
2666426674
)
2666526675
await client.get_restore_plan(request=None)
@@ -27278,6 +27288,7 @@ def test_create_backup_plan_rest_call_success(request_type):
2727827288
"state_reason": "state_reason_value",
2727927289
"rpo_risk_level": 1504,
2728027290
"rpo_risk_reason": "rpo_risk_reason_value",
27291+
"backup_channel": "backup_channel_value",
2728127292
"last_successful_backup_time": {},
2728227293
}
2728327294
# The version of a generated dependency at test runtime may differ from the version used during generation.
@@ -27616,6 +27627,7 @@ def test_get_backup_plan_rest_call_success(request_type):
2761627627
state_reason="state_reason_value",
2761727628
rpo_risk_level=1504,
2761827629
rpo_risk_reason="rpo_risk_reason_value",
27630+
backup_channel="backup_channel_value",
2761927631
)
2762027632

2762127633
# Wrap the value into a proper Response obj
@@ -27643,6 +27655,7 @@ def test_get_backup_plan_rest_call_success(request_type):
2764327655
assert response.state_reason == "state_reason_value"
2764427656
assert response.rpo_risk_level == 1504
2764527657
assert response.rpo_risk_reason == "rpo_risk_reason_value"
27658+
assert response.backup_channel == "backup_channel_value"
2764627659

2764727660

2764827661
@pytest.mark.parametrize("null_interceptor", [True, False])
@@ -27815,6 +27828,7 @@ def test_update_backup_plan_rest_call_success(request_type):
2781527828
"state_reason": "state_reason_value",
2781627829
"rpo_risk_level": 1504,
2781727830
"rpo_risk_reason": "rpo_risk_reason_value",
27831+
"backup_channel": "backup_channel_value",
2781827832
"last_successful_backup_time": {},
2781927833
}
2782027834
# The version of a generated dependency at test runtime may differ from the version used during generation.
@@ -30464,6 +30478,7 @@ def test_create_restore_plan_rest_call_success(request_type):
3046430478
"etag": "etag_value",
3046530479
"state": 1,
3046630480
"state_reason": "state_reason_value",
30481+
"restore_channel": "restore_channel_value",
3046730482
}
3046830483
# The version of a generated dependency at test runtime may differ from the version used during generation.
3046930484
# Delete any fields which are not present in the current runtime dependency
@@ -30800,6 +30815,7 @@ def test_get_restore_plan_rest_call_success(request_type):
3080030815
etag="etag_value",
3080130816
state=restore_plan.RestorePlan.State.CLUSTER_PENDING,
3080230817
state_reason="state_reason_value",
30818+
restore_channel="restore_channel_value",
3080330819
)
3080430820

3080530821
# Wrap the value into a proper Response obj
@@ -30824,6 +30840,7 @@ def test_get_restore_plan_rest_call_success(request_type):
3082430840
assert response.etag == "etag_value"
3082530841
assert response.state == restore_plan.RestorePlan.State.CLUSTER_PENDING
3082630842
assert response.state_reason == "state_reason_value"
30843+
assert response.restore_channel == "restore_channel_value"
3082730844

3082830845

3082930846
@pytest.mark.parametrize("null_interceptor", [True, False])
@@ -31008,6 +31025,7 @@ def test_update_restore_plan_rest_call_success(request_type):
3100831025
"etag": "etag_value",
3100931026
"state": 1,
3101031027
"state_reason": "state_reason_value",
31028+
"restore_channel": "restore_channel_value",
3101131029
}
3101231030
# The version of a generated dependency at test runtime may differ from the version used during generation.
3101331031
# Delete any fields which are not present in the current runtime dependency

0 commit comments

Comments
 (0)