Skip to content

Commit

Permalink
feat: added new restore scope options (#68)
Browse files Browse the repository at this point in the history
* feat: added new restore scope options
feat: added transformation rules for restore
feat: added BackupPlan and RestorePlan state information

These features aim to do the following:
1. Improve flexibility of restore with new options to define new kinds of scope configurations.
2. Improve flexibility of restore by supporting Transformation Rules, which enable the removal and addition of spec fields of restored resources prior to their creation.
3. Improve observability by revealing the state information of BackupPlan and RestorePlan.

PiperOrigin-RevId: 543605700

Source-Link: googleapis/googleapis@d39c91b

Source-Link: googleapis/googleapis-gen@0cf7f93
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMGNmN2Y5M2Q0YTYwZmFlN2ZiZDFhOWFiMDNmN2RhNGM2MmZiMWJkMiJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Jul 4, 2023
1 parent 7c95975 commit d368751
Show file tree
Hide file tree
Showing 8 changed files with 577 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1873,7 +1873,7 @@ async def sample_create_restore_plan():
The result type for the operation will be :class:`google.cloud.gke_backup_v1.types.RestorePlan` The configuration of a potential series of Restore operations to be performed
against Backups belong to a particular BackupPlan.
Next id: 11
Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -2111,7 +2111,7 @@ async def sample_get_restore_plan():
The configuration of a potential
series of Restore operations to be
performed against Backups belong to a
particular BackupPlan. Next id: 11
particular BackupPlan. Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -2251,7 +2251,7 @@ async def sample_update_restore_plan():
The result type for the operation will be :class:`google.cloud.gke_backup_v1.types.RestorePlan` The configuration of a potential series of Restore operations to be performed
against Backups belong to a particular BackupPlan.
Next id: 11
Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2204,7 +2204,7 @@ def sample_create_restore_plan():
The result type for the operation will be :class:`google.cloud.gke_backup_v1.types.RestorePlan` The configuration of a potential series of Restore operations to be performed
against Backups belong to a particular BackupPlan.
Next id: 11
Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -2433,7 +2433,7 @@ def sample_get_restore_plan():
The configuration of a potential
series of Restore operations to be
performed against Backups belong to a
particular BackupPlan. Next id: 11
particular BackupPlan. Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down Expand Up @@ -2564,7 +2564,7 @@ def sample_update_restore_plan():
The result type for the operation will be :class:`google.cloud.gke_backup_v1.types.RestorePlan` The configuration of a potential series of Restore operations to be performed
against Backups belong to a particular BackupPlan.
Next id: 11
Next id: 13
"""
# Create or coerce a protobuf request object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2232,7 +2232,7 @@ def __call__(
The configuration of a potential
series of Restore operations to be
performed against Backups belong to a
particular BackupPlan. Next id: 11
particular BackupPlan. Next id: 13
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,47 @@ class BackupPlan(proto.Message):
Output only. The number of Kubernetes Pods
backed up in the last successful Backup created
via this BackupPlan.
state (google.cloud.gke_backup_v1.types.BackupPlan.State):
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
state_reason (str):
Output only. Human-readable description of why BackupPlan is
in the current ``state``
"""

class State(proto.Enum):
r"""State
Values:
STATE_UNSPECIFIED (0):
Default first value for Enums.
CLUSTER_PENDING (1):
Waiting for cluster state to be RUNNING.
PROVISIONING (2):
The BackupPlan is in the process of being
created.
READY (3):
The BackupPlan has successfully been created
and is ready for Backups.
FAILED (4):
BackupPlan creation has failed.
DEACTIVATED (5):
The BackupPlan has been deactivated.
DELETING (6):
The BackupPlan is in the process of being
deleted.
"""
STATE_UNSPECIFIED = 0
CLUSTER_PENDING = 1
PROVISIONING = 2
READY = 3
FAILED = 4
DEACTIVATED = 5
DELETING = 6

class RetentionPolicy(proto.Message):
r"""RetentionPolicy defines a Backup retention policy for a
BackupPlan.
Expand Down Expand Up @@ -152,8 +191,8 @@ class RetentionPolicy(proto.Message):
)

class Schedule(proto.Message):
r"""Schedule defines scheduling parameters for automatically
creating Backups via this BackupPlan.
r"""Defines scheduling parameters for automatically creating
Backups via this BackupPlan.
Attributes:
cron_schedule (str):
Expand Down Expand Up @@ -315,6 +354,15 @@ class BackupConfig(proto.Message):
proto.INT32,
number=13,
)
state: State = proto.Field(
proto.ENUM,
number=14,
enum=State,
)
state_reason: str = proto.Field(
proto.STRING,
number=15,
)


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

0 comments on commit d368751

Please sign in to comment.