From f7470ad3e053ad29b3ea9956b04c64c796a94881 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 13 Nov 2024 11:40:14 -0500 Subject: [PATCH] feat: [google-cloud-deploy] A new field `timed_promote_release_rule` is added to message `.google.cloud.deploy.v1.AutomationRule` (#13274) - [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: A new field `timed_promote_release_rule` is added to message `.google.cloud.deploy.v1.AutomationRule` feat: A new message `TimedPromoteReleaseRule` is added feat: A new field `timed_promote_release_condition` is added to message `.google.cloud.deploy.v1.AutomationRuleCondition` feat: A new message `TimedPromoteReleaseCondition` is added feat: A new field `timed_promote_release_operation` is added to message `.google.cloud.deploy.v1.AutomationRun` feat: A new message `TimedPromoteReleaseOperation` is added docs: A comment for field `target_id` in message `.google.cloud.deploy.v1.AutomationRun` is changed END_COMMIT_OVERRIDE PiperOrigin-RevId: 695827924 Source-Link: https://github.com/googleapis/googleapis/commit/4805138ac78844e11fe6af603374b18adb435902 Source-Link: https://github.com/googleapis/googleapis-gen/commit/2b3fa48d4a3fd09e5766fe2dd65aa66dd97c172a Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRlcGxveS8uT3dsQm90LnlhbWwiLCJoIjoiMmIzZmE0OGQ0YTNmZDA5ZTU3NjZmZTJkZDY1YWE2NmRkOTdjMTcyYSJ9 --------- Co-authored-by: Owl Bot --- .../google/cloud/deploy/__init__.py | 6 + .../google/cloud/deploy/gapic_version.py | 2 +- .../google/cloud/deploy_v1/__init__.py | 6 + .../google/cloud/deploy_v1/gapic_version.py | 2 +- .../google/cloud/deploy_v1/types/__init__.py | 6 + .../cloud/deploy_v1/types/cloud_deploy.py | 186 +++++++++++++++++- ...ippet_metadata_google.cloud.deploy.v1.json | 2 +- .../unit/gapic/deploy_v1/test_cloud_deploy.py | 38 +++- 8 files changed, 240 insertions(+), 8 deletions(-) diff --git a/packages/google-cloud-deploy/google/cloud/deploy/__init__.py b/packages/google-cloud-deploy/google/cloud/deploy/__init__.py index e4cc21aeab87..cc1961be8f0b 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy/__init__.py +++ b/packages/google-cloud-deploy/google/cloud/deploy/__init__.py @@ -176,6 +176,9 @@ TargetsTypeCondition, TerminateJobRunRequest, TerminateJobRunResponse, + TimedPromoteReleaseCondition, + TimedPromoteReleaseOperation, + TimedPromoteReleaseRule, TimeWindows, UpdateAutomationRequest, UpdateCustomTargetTypeRequest, @@ -367,6 +370,9 @@ "TargetsTypeCondition", "TerminateJobRunRequest", "TerminateJobRunResponse", + "TimedPromoteReleaseCondition", + "TimedPromoteReleaseOperation", + "TimedPromoteReleaseRule", "TimeWindows", "UpdateAutomationRequest", "UpdateCustomTargetTypeRequest", diff --git a/packages/google-cloud-deploy/google/cloud/deploy/gapic_version.py b/packages/google-cloud-deploy/google/cloud/deploy/gapic_version.py index 38b74a960221..558c8aab67c5 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy/gapic_version.py +++ b/packages/google-cloud-deploy/google/cloud/deploy/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.3.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-deploy/google/cloud/deploy_v1/__init__.py b/packages/google-cloud-deploy/google/cloud/deploy_v1/__init__.py index 1c2b034046fb..493c7edd6417 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy_v1/__init__.py +++ b/packages/google-cloud-deploy/google/cloud/deploy_v1/__init__.py @@ -173,6 +173,9 @@ TargetsTypeCondition, TerminateJobRunRequest, TerminateJobRunResponse, + TimedPromoteReleaseCondition, + TimedPromoteReleaseOperation, + TimedPromoteReleaseRule, TimeWindows, UpdateAutomationRequest, UpdateCustomTargetTypeRequest, @@ -366,6 +369,9 @@ "TerminateJobRunRequest", "TerminateJobRunResponse", "TimeWindows", + "TimedPromoteReleaseCondition", + "TimedPromoteReleaseOperation", + "TimedPromoteReleaseRule", "Type", "UpdateAutomationRequest", "UpdateCustomTargetTypeRequest", diff --git a/packages/google-cloud-deploy/google/cloud/deploy_v1/gapic_version.py b/packages/google-cloud-deploy/google/cloud/deploy_v1/gapic_version.py index 38b74a960221..558c8aab67c5 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy_v1/gapic_version.py +++ b/packages/google-cloud-deploy/google/cloud/deploy_v1/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "2.3.0" # {x-release-please-version} +__version__ = "0.0.0" # {x-release-please-version} diff --git a/packages/google-cloud-deploy/google/cloud/deploy_v1/types/__init__.py b/packages/google-cloud-deploy/google/cloud/deploy_v1/types/__init__.py index baf15d3a4001..ff4c1d11dcfa 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy_v1/types/__init__.py +++ b/packages/google-cloud-deploy/google/cloud/deploy_v1/types/__init__.py @@ -167,6 +167,9 @@ TargetsTypeCondition, TerminateJobRunRequest, TerminateJobRunResponse, + TimedPromoteReleaseCondition, + TimedPromoteReleaseOperation, + TimedPromoteReleaseRule, TimeWindows, UpdateAutomationRequest, UpdateCustomTargetTypeRequest, @@ -340,6 +343,9 @@ "TargetsTypeCondition", "TerminateJobRunRequest", "TerminateJobRunResponse", + "TimedPromoteReleaseCondition", + "TimedPromoteReleaseOperation", + "TimedPromoteReleaseRule", "TimeWindows", "UpdateAutomationRequest", "UpdateCustomTargetTypeRequest", diff --git a/packages/google-cloud-deploy/google/cloud/deploy_v1/types/cloud_deploy.py b/packages/google-cloud-deploy/google/cloud/deploy_v1/types/cloud_deploy.py index d84d4966c326..f5f9b84bf6ca 100644 --- a/packages/google-cloud-deploy/google/cloud/deploy_v1/types/cloud_deploy.py +++ b/packages/google-cloud-deploy/google/cloud/deploy_v1/types/cloud_deploy.py @@ -162,6 +162,7 @@ "Automation", "AutomationResourceSelector", "AutomationRule", + "TimedPromoteReleaseRule", "PromoteReleaseRule", "AdvanceRolloutRule", "RepairRolloutRule", @@ -169,6 +170,7 @@ "Retry", "Rollback", "AutomationRuleCondition", + "TimedPromoteReleaseCondition", "CreateAutomationRequest", "UpdateAutomationRequest", "DeleteAutomationRequest", @@ -179,6 +181,7 @@ "PromoteReleaseOperation", "AdvanceRolloutOperation", "RepairRolloutOperation", + "TimedPromoteReleaseOperation", "RepairPhase", "RetryPhase", "RetryAttempt", @@ -6517,6 +6520,12 @@ class AutomationRule(proto.Message): Optional. The ``RepairRolloutRule`` will automatically repair a failed rollout. + This field is a member of `oneof`_ ``rule``. + timed_promote_release_rule (google.cloud.deploy_v1.types.TimedPromoteReleaseRule): + Optional. The ``TimedPromoteReleaseRule`` will automatically + promote a release from the current target(s) to the + specified target(s) on a configured schedule. + This field is a member of `oneof`_ ``rule``. """ @@ -6538,6 +6547,73 @@ class AutomationRule(proto.Message): oneof="rule", message="RepairRolloutRule", ) + timed_promote_release_rule: "TimedPromoteReleaseRule" = proto.Field( + proto.MESSAGE, + number=4, + oneof="rule", + message="TimedPromoteReleaseRule", + ) + + +class TimedPromoteReleaseRule(proto.Message): + r"""The ``TimedPromoteReleaseRule`` will automatically promote a release + from the current target(s) to the specified target(s) on a + configured schedule. + + Attributes: + id (str): + Required. ID of the rule. This ID must be unique in the + ``Automation`` resource to which this rule belongs. The + format is ``[a-z]([a-z0-9-]{0,61}[a-z0-9])?``. + destination_target_id (str): + Optional. The ID of the stage in the pipeline to which this + ``Release`` is deploying. If unspecified, default it to the + next stage in the promotion flow. The value of this field + could be one of the following: + + - The last segment of a target name + - "@next", the next target in the promotion sequence + schedule (str): + Required. Schedule in crontab format. e.g. "0 9 \* \* 1" for + every Monday at 9am. + time_zone (str): + Required. The time zone in IANA format `IANA Time Zone + Database `__ (e.g. + America/New_York). + condition (google.cloud.deploy_v1.types.AutomationRuleCondition): + Output only. Information around the state of + the Automation rule. + destination_phase (str): + Optional. The starting phase of the rollout + created by this rule. Default to the first + phase. + """ + + id: str = proto.Field( + proto.STRING, + number=1, + ) + destination_target_id: str = proto.Field( + proto.STRING, + number=2, + ) + schedule: str = proto.Field( + proto.STRING, + number=3, + ) + time_zone: str = proto.Field( + proto.STRING, + number=4, + ) + condition: "AutomationRuleCondition" = proto.Field( + proto.MESSAGE, + number=5, + message="AutomationRuleCondition", + ) + destination_phase: str = proto.Field( + proto.STRING, + number=6, + ) class PromoteReleaseRule(proto.Message): @@ -6791,10 +6867,20 @@ class AutomationRuleCondition(proto.Message): r"""``AutomationRuleCondition`` contains conditions relevant to an ``Automation`` rule. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: targets_present_condition (google.cloud.deploy_v1.types.TargetsPresentCondition): Optional. Details around targets enumerated in the rule. + timed_promote_release_condition (google.cloud.deploy_v1.types.TimedPromoteReleaseCondition): + Optional. TimedPromoteReleaseCondition + contains rule conditions specific to a an + Automation with a timed promote release rule + defined. + + This field is a member of `oneof`_ ``rule_type_condition``. """ targets_present_condition: "TargetsPresentCondition" = proto.Field( @@ -6802,6 +6888,56 @@ class AutomationRuleCondition(proto.Message): number=1, message="TargetsPresentCondition", ) + timed_promote_release_condition: "TimedPromoteReleaseCondition" = proto.Field( + proto.MESSAGE, + number=2, + oneof="rule_type_condition", + message="TimedPromoteReleaseCondition", + ) + + +class TimedPromoteReleaseCondition(proto.Message): + r"""``TimedPromoteReleaseCondition`` contains conditions specific to an + Automation with a Timed Promote Release rule defined. + + Attributes: + next_promotion_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. When the next scheduled + promotion(s) will occur. + targets_list (MutableSequence[google.cloud.deploy_v1.types.TimedPromoteReleaseCondition.Targets]): + Output only. A list of targets involved in + the upcoming timed promotion(s). + """ + + class Targets(proto.Message): + r"""The targets involved in a single timed promotion. + + Attributes: + source_target_id (str): + Optional. The source target ID. + destination_target_id (str): + Optional. The destination target ID. + """ + + source_target_id: str = proto.Field( + proto.STRING, + number=1, + ) + destination_target_id: str = proto.Field( + proto.STRING, + number=2, + ) + + next_promotion_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + targets_list: MutableSequence[Targets] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=Targets, + ) class CreateAutomationRequest(proto.Message): @@ -7131,9 +7267,9 @@ class AutomationRun(proto.Message): Output only. Snapshot of the Automation taken at AutomationRun creation time. target_id (str): - Output only. The ID of the target that represents the - promotion stage that initiates the ``AutomationRun``. The - value of this field is the last segment of a target name. + Output only. The ID of the source target that initiates the + ``AutomationRun``. The value of this field is the last + segment of a target name. state (google.cloud.deploy_v1.types.AutomationRun.State): Output only. Current state of the ``AutomationRun``. state_description (str): @@ -7166,6 +7302,12 @@ class AutomationRun(proto.Message): repair_rollout_operation (google.cloud.deploy_v1.types.RepairRolloutOperation): Output only. Repairs a failed 'Rollout'. + This field is a member of `oneof`_ ``operation``. + timed_promote_release_operation (google.cloud.deploy_v1.types.TimedPromoteReleaseOperation): + Output only. Promotes a release to a + specified 'Target' as defined in a Timed Promote + Release rule. + This field is a member of `oneof`_ ``operation``. wait_until_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Earliest time the ``AutomationRun`` will @@ -7276,6 +7418,12 @@ class State(proto.Enum): oneof="operation", message="RepairRolloutOperation", ) + timed_promote_release_operation: "TimedPromoteReleaseOperation" = proto.Field( + proto.MESSAGE, + number=19, + oneof="operation", + message="TimedPromoteReleaseOperation", + ) wait_until_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=16, @@ -7407,6 +7555,38 @@ class RepairRolloutOperation(proto.Message): ) +class TimedPromoteReleaseOperation(proto.Message): + r"""Contains the information of an automated timed + promote-release operation. + + Attributes: + target_id (str): + Output only. The ID of the target that + represents the promotion stage to which the + release will be promoted. The value of this + field is the last segment of a target name. + release (str): + Output only. The name of the release to be + promoted. + phase (str): + Output only. The starting phase of the + rollout created by this operation. + """ + + target_id: str = proto.Field( + proto.STRING, + number=1, + ) + release: str = proto.Field( + proto.STRING, + number=2, + ) + phase: str = proto.Field( + proto.STRING, + number=3, + ) + + class RepairPhase(proto.Message): r"""RepairPhase tracks the repair attempts that have been made for each ``RepairPhaseConfig`` specified in the ``Automation`` resource. diff --git a/packages/google-cloud-deploy/samples/generated_samples/snippet_metadata_google.cloud.deploy.v1.json b/packages/google-cloud-deploy/samples/generated_samples/snippet_metadata_google.cloud.deploy.v1.json index 8be081b739aa..dfbc37400a05 100644 --- a/packages/google-cloud-deploy/samples/generated_samples/snippet_metadata_google.cloud.deploy.v1.json +++ b/packages/google-cloud-deploy/samples/generated_samples/snippet_metadata_google.cloud.deploy.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-deploy", - "version": "2.3.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py b/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py index 3eac3f76854a..2d5d32debbb3 100644 --- a/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py +++ b/packages/google-cloud-deploy/tests/unit/gapic/deploy_v1/test_cloud_deploy.py @@ -36229,7 +36229,16 @@ def test_create_automation_rest_call_success(request_type): "missing_targets_value2", ], "update_time": {}, - } + }, + "timed_promote_release_condition": { + "next_promotion_time": {}, + "targets_list": [ + { + "source_target_id": "source_target_id_value", + "destination_target_id": "destination_target_id_value", + } + ], + }, }, "destination_phase": "destination_phase_value", }, @@ -36254,6 +36263,14 @@ def test_create_automation_rest_call_success(request_type): } ], }, + "timed_promote_release_rule": { + "id": "id_value", + "destination_target_id": "destination_target_id_value", + "schedule": "schedule_value", + "time_zone": "time_zone_value", + "condition": {}, + "destination_phase": "destination_phase_value", + }, } ], } @@ -36473,7 +36490,16 @@ def test_update_automation_rest_call_success(request_type): "missing_targets_value2", ], "update_time": {}, - } + }, + "timed_promote_release_condition": { + "next_promotion_time": {}, + "targets_list": [ + { + "source_target_id": "source_target_id_value", + "destination_target_id": "destination_target_id_value", + } + ], + }, }, "destination_phase": "destination_phase_value", }, @@ -36498,6 +36524,14 @@ def test_update_automation_rest_call_success(request_type): } ], }, + "timed_promote_release_rule": { + "id": "id_value", + "destination_target_id": "destination_target_id_value", + "schedule": "schedule_value", + "time_zone": "time_zone_value", + "condition": {}, + "destination_phase": "destination_phase_value", + }, } ], }