Skip to content

Commit b5cdea3

Browse files
feat: [google-cloud-backupdr] add InitializeServiceAPI (googleapis#13420)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add InitializeServiceAPI feat: Update field behavior of `networks` field in message `ManagementServer` to `OPTIONAL` feat: add enum to Backup Vault Access Restriction field feat: `ignore_backup_plan_references` added to the DeleteBackupVaultRequest fix!: Update field behavior of `resource_type` field in message `BackupPlanAssociation` to `REQUIRED` docs: A comment for field `networks` in message `.google.cloud.backupdr.v1.ManagementServer` is changed docs: A comment for field `requested_cancellation` in message `.google.cloud.backupdr.v1.OperationMetadata` is changed docs: A comment for field `resource_type` in message `.google.cloud.backupdr.v1.BackupPlan` is changed docs: A comment for field `backup_retention_days` in message `.google.cloud.backupdr.v1.BackupRule` is changed docs: A comment for field `resource_type` in message `.google.cloud.backupdr.v1.BackupPlanAssociation` is changed docs: A comment for field `data_source` in message `.google.cloud.backupdr.v1.BackupPlanAssociation` is changed docs: A comment for field `rule_id` in message `.google.cloud.backupdr.v1.RuleConfigInfo` is changed docs: A comment for field `last_backup_error` in message `.google.cloud.backupdr.v1.RuleConfigInfo` is changed docs: A comment for enum value `ACCESS_RESTRICTION_UNSPECIFIED` in enum `AccessRestriction` is changed docs: A comment for field `uid` in message `.google.cloud.backupdr.v1.BackupVault` is changed docs: A comment for field `access_restriction` in message `.google.cloud.backupdr.v1.BackupVault` is changed END_COMMIT_OVERRIDE feat: Update field behavior of `networks` field in message `ManagementServer` to `OPTIONAL` feat: add enum to Backup Vault Access Restriction field feat: `ignore_backup_plan_references` added to the DeleteBackupVaultRequest fix!: Update field behavior of `resource_type` field in message `BackupPlanAssociation` to `REQUIRED` docs: A comment for field `networks` in message `.google.cloud.backupdr.v1.ManagementServer` is changed docs: A comment for field `requested_cancellation` in message `.google.cloud.backupdr.v1.OperationMetadata` is changed docs: A comment for field `resource_type` in message `.google.cloud.backupdr.v1.BackupPlan` is changed docs: A comment for field `backup_retention_days` in message `.google.cloud.backupdr.v1.BackupRule` is changed docs: A comment for field `resource_type` in message `.google.cloud.backupdr.v1.BackupPlanAssociation` is changed docs: A comment for field `data_source` in message `.google.cloud.backupdr.v1.BackupPlanAssociation` is changed docs: A comment for field `rule_id` in message `.google.cloud.backupdr.v1.RuleConfigInfo` is changed docs: A comment for field `last_backup_error` in message `.google.cloud.backupdr.v1.RuleConfigInfo` is changed docs: A comment for enum value `ACCESS_RESTRICTION_UNSPECIFIED` in enum `AccessRestriction` is changed docs: A comment for field `uid` in message `.google.cloud.backupdr.v1.BackupVault` is changed docs: A comment for field `access_restriction` in message `.google.cloud.backupdr.v1.BackupVault` is changed PiperOrigin-RevId: 713528070 Source-Link: googleapis/googleapis@8cd8706 Source-Link: https://github.com/googleapis/googleapis-gen/commit/a5c65facebe8d5523ade60fa5506bc8c35dad868 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhY2t1cGRyLy5Pd2xCb3QueWFtbCIsImgiOiJhNWM2NWZhY2ViZThkNTUyM2FkZTYwZmE1NTA2YmM4YzM1ZGFkODY4In0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
1 parent 3a9a8fb commit b5cdea3

24 files changed

Lines changed: 1573 additions & 44 deletions

packages/google-cloud-backupdr/google/cloud/backupdr/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424
CreateManagementServerRequest,
2525
DeleteManagementServerRequest,
2626
GetManagementServerRequest,
27+
InitializeServiceRequest,
28+
InitializeServiceResponse,
2729
ListManagementServersRequest,
2830
ListManagementServersResponse,
2931
ManagementServer,
@@ -128,6 +130,8 @@
128130
"CreateManagementServerRequest",
129131
"DeleteManagementServerRequest",
130132
"GetManagementServerRequest",
133+
"InitializeServiceRequest",
134+
"InitializeServiceResponse",
131135
"ListManagementServersRequest",
132136
"ListManagementServersResponse",
133137
"ManagementServer",

packages/google-cloud-backupdr/google/cloud/backupdr/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.7" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-backupdr/google/cloud/backupdr_v1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
CreateManagementServerRequest,
2424
DeleteManagementServerRequest,
2525
GetManagementServerRequest,
26+
InitializeServiceRequest,
27+
InitializeServiceResponse,
2628
ListManagementServersRequest,
2729
ListManagementServersResponse,
2830
ManagementServer,
@@ -173,6 +175,8 @@
173175
"GetDataSourceRequest",
174176
"GetManagementServerRequest",
175177
"GuestOsFeature",
178+
"InitializeServiceRequest",
179+
"InitializeServiceResponse",
176180
"InstanceParams",
177181
"KeyRevocationActionType",
178182
"ListBackupPlanAssociationsRequest",

packages/google-cloud-backupdr/google/cloud/backupdr_v1/gapic_metadata.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
"get_management_server"
9191
]
9292
},
93+
"InitializeService": {
94+
"methods": [
95+
"initialize_service"
96+
]
97+
},
9398
"ListBackupPlanAssociations": {
9499
"methods": [
95100
"list_backup_plan_associations"
@@ -230,6 +235,11 @@
230235
"get_management_server"
231236
]
232237
},
238+
"InitializeService": {
239+
"methods": [
240+
"initialize_service"
241+
]
242+
},
233243
"ListBackupPlanAssociations": {
234244
"methods": [
235245
"list_backup_plan_associations"
@@ -370,6 +380,11 @@
370380
"get_management_server"
371381
]
372382
},
383+
"InitializeService": {
384+
"methods": [
385+
"initialize_service"
386+
]
387+
},
373388
"ListBackupPlanAssociations": {
374389
"methods": [
375390
"list_backup_plan_associations"

packages/google-cloud-backupdr/google/cloud/backupdr_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "0.1.7" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-backupdr/google/cloud/backupdr_v1/services/backup_dr/async_client.py

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3153,6 +3153,7 @@ async def sample_create_backup_plan_association():
31533153
31543154
# Initialize request argument(s)
31553155
backup_plan_association = backupdr_v1.BackupPlanAssociation()
3156+
backup_plan_association.resource_type = "resource_type_value"
31563157
backup_plan_association.resource = "resource_value"
31573158
backup_plan_association.backup_plan = "backup_plan_value"
31583159
@@ -3796,6 +3797,108 @@ async def sample_trigger_backup():
37963797
# Done; return the response.
37973798
return response
37983799

3800+
async def initialize_service(
3801+
self,
3802+
request: Optional[Union[backupdr.InitializeServiceRequest, dict]] = None,
3803+
*,
3804+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
3805+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
3806+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
3807+
) -> operation_async.AsyncOperation:
3808+
r"""Initializes the service related config for a project.
3809+
3810+
.. code-block:: python
3811+
3812+
# This snippet has been automatically generated and should be regarded as a
3813+
# code template only.
3814+
# It will require modifications to work:
3815+
# - It may require correct/in-range values for request initialization.
3816+
# - It may require specifying regional endpoints when creating the service
3817+
# client as shown in:
3818+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
3819+
from google.cloud import backupdr_v1
3820+
3821+
async def sample_initialize_service():
3822+
# Create a client
3823+
client = backupdr_v1.BackupDRAsyncClient()
3824+
3825+
# Initialize request argument(s)
3826+
request = backupdr_v1.InitializeServiceRequest(
3827+
name="name_value",
3828+
resource_type="resource_type_value",
3829+
)
3830+
3831+
# Make the request
3832+
operation = client.initialize_service(request=request)
3833+
3834+
print("Waiting for operation to complete...")
3835+
3836+
response = (await operation).result()
3837+
3838+
# Handle the response
3839+
print(response)
3840+
3841+
Args:
3842+
request (Optional[Union[google.cloud.backupdr_v1.types.InitializeServiceRequest, dict]]):
3843+
The request object. Request message for initializing the
3844+
service.
3845+
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
3846+
should be retried.
3847+
timeout (float): The timeout for this request.
3848+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
3849+
sent along with the request as metadata. Normally, each value must be of type `str`,
3850+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
3851+
be of type `bytes`.
3852+
3853+
Returns:
3854+
google.api_core.operation_async.AsyncOperation:
3855+
An object representing a long-running operation.
3856+
3857+
The result type for the operation will be
3858+
:class:`google.cloud.backupdr_v1.types.InitializeServiceResponse`
3859+
Response message for initializing the service.
3860+
3861+
"""
3862+
# Create or coerce a protobuf request object.
3863+
# - Use the request object if provided (there's no risk of modifying the input as
3864+
# there are no flattened fields), or create one.
3865+
if not isinstance(request, backupdr.InitializeServiceRequest):
3866+
request = backupdr.InitializeServiceRequest(request)
3867+
3868+
# Wrap the RPC method; this adds retry and timeout information,
3869+
# and friendly error handling.
3870+
rpc = self._client._transport._wrapped_methods[
3871+
self._client._transport.initialize_service
3872+
]
3873+
3874+
# Certain fields should be provided within the metadata header;
3875+
# add these here.
3876+
metadata = tuple(metadata) + (
3877+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
3878+
)
3879+
3880+
# Validate the universe domain.
3881+
self._client._validate_universe_domain()
3882+
3883+
# Send the request.
3884+
response = await rpc(
3885+
request,
3886+
retry=retry,
3887+
timeout=timeout,
3888+
metadata=metadata,
3889+
)
3890+
3891+
# Wrap the response in an operation future.
3892+
response = operation_async.from_gapic(
3893+
response,
3894+
self._client._transport.operations_client,
3895+
backupdr.InitializeServiceResponse,
3896+
metadata_type=backupdr.OperationMetadata,
3897+
)
3898+
3899+
# Done; return the response.
3900+
return response
3901+
37993902
async def list_operations(
38003903
self,
38013904
request: Optional[operations_pb2.ListOperationsRequest] = None,

packages/google-cloud-backupdr/google/cloud/backupdr_v1/services/backup_dr/client.py

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3590,6 +3590,7 @@ def sample_create_backup_plan_association():
35903590
35913591
# Initialize request argument(s)
35923592
backup_plan_association = backupdr_v1.BackupPlanAssociation()
3593+
backup_plan_association.resource_type = "resource_type_value"
35933594
backup_plan_association.resource = "resource_value"
35943595
backup_plan_association.backup_plan = "backup_plan_value"
35953596
@@ -4226,6 +4227,106 @@ def sample_trigger_backup():
42264227
# Done; return the response.
42274228
return response
42284229

4230+
def initialize_service(
4231+
self,
4232+
request: Optional[Union[backupdr.InitializeServiceRequest, dict]] = None,
4233+
*,
4234+
retry: OptionalRetry = gapic_v1.method.DEFAULT,
4235+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
4236+
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
4237+
) -> operation.Operation:
4238+
r"""Initializes the service related config for a project.
4239+
4240+
.. code-block:: python
4241+
4242+
# This snippet has been automatically generated and should be regarded as a
4243+
# code template only.
4244+
# It will require modifications to work:
4245+
# - It may require correct/in-range values for request initialization.
4246+
# - It may require specifying regional endpoints when creating the service
4247+
# client as shown in:
4248+
# https://googleapis.dev/python/google-api-core/latest/client_options.html
4249+
from google.cloud import backupdr_v1
4250+
4251+
def sample_initialize_service():
4252+
# Create a client
4253+
client = backupdr_v1.BackupDRClient()
4254+
4255+
# Initialize request argument(s)
4256+
request = backupdr_v1.InitializeServiceRequest(
4257+
name="name_value",
4258+
resource_type="resource_type_value",
4259+
)
4260+
4261+
# Make the request
4262+
operation = client.initialize_service(request=request)
4263+
4264+
print("Waiting for operation to complete...")
4265+
4266+
response = operation.result()
4267+
4268+
# Handle the response
4269+
print(response)
4270+
4271+
Args:
4272+
request (Union[google.cloud.backupdr_v1.types.InitializeServiceRequest, dict]):
4273+
The request object. Request message for initializing the
4274+
service.
4275+
retry (google.api_core.retry.Retry): Designation of what errors, if any,
4276+
should be retried.
4277+
timeout (float): The timeout for this request.
4278+
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
4279+
sent along with the request as metadata. Normally, each value must be of type `str`,
4280+
but for metadata keys ending with the suffix `-bin`, the corresponding values must
4281+
be of type `bytes`.
4282+
4283+
Returns:
4284+
google.api_core.operation.Operation:
4285+
An object representing a long-running operation.
4286+
4287+
The result type for the operation will be
4288+
:class:`google.cloud.backupdr_v1.types.InitializeServiceResponse`
4289+
Response message for initializing the service.
4290+
4291+
"""
4292+
# Create or coerce a protobuf request object.
4293+
# - Use the request object if provided (there's no risk of modifying the input as
4294+
# there are no flattened fields), or create one.
4295+
if not isinstance(request, backupdr.InitializeServiceRequest):
4296+
request = backupdr.InitializeServiceRequest(request)
4297+
4298+
# Wrap the RPC method; this adds retry and timeout information,
4299+
# and friendly error handling.
4300+
rpc = self._transport._wrapped_methods[self._transport.initialize_service]
4301+
4302+
# Certain fields should be provided within the metadata header;
4303+
# add these here.
4304+
metadata = tuple(metadata) + (
4305+
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
4306+
)
4307+
4308+
# Validate the universe domain.
4309+
self._validate_universe_domain()
4310+
4311+
# Send the request.
4312+
response = rpc(
4313+
request,
4314+
retry=retry,
4315+
timeout=timeout,
4316+
metadata=metadata,
4317+
)
4318+
4319+
# Wrap the response in an operation future.
4320+
response = operation.from_gapic(
4321+
response,
4322+
self._transport.operations_client,
4323+
backupdr.InitializeServiceResponse,
4324+
metadata_type=backupdr.OperationMetadata,
4325+
)
4326+
4327+
# Done; return the response.
4328+
return response
4329+
42294330
def __enter__(self) -> "BackupDRClient":
42304331
return self
42314332

packages/google-cloud-backupdr/google/cloud/backupdr_v1/services/backup_dr/transports/base.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,20 @@ def _prep_wrapped_messages(self, client_info):
371371
default_timeout=None,
372372
client_info=client_info,
373373
),
374+
self.initialize_service: gapic_v1.method.wrap_method(
375+
self.initialize_service,
376+
default_retry=retries.Retry(
377+
initial=1.0,
378+
maximum=10.0,
379+
multiplier=1.3,
380+
predicate=retries.if_exception_type(
381+
core_exceptions.ServiceUnavailable,
382+
),
383+
deadline=60.0,
384+
),
385+
default_timeout=60.0,
386+
client_info=client_info,
387+
),
374388
self.get_location: gapic_v1.method.wrap_method(
375389
self.get_location,
376390
default_timeout=None,
@@ -698,6 +712,15 @@ def trigger_backup(
698712
]:
699713
raise NotImplementedError()
700714

715+
@property
716+
def initialize_service(
717+
self,
718+
) -> Callable[
719+
[backupdr.InitializeServiceRequest],
720+
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
721+
]:
722+
raise NotImplementedError()
723+
701724
@property
702725
def list_operations(
703726
self,

packages/google-cloud-backupdr/google/cloud/backupdr_v1/services/backup_dr/transports/grpc.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,32 @@ def trigger_backup(
10891089
)
10901090
return self._stubs["trigger_backup"]
10911091

1092+
@property
1093+
def initialize_service(
1094+
self,
1095+
) -> Callable[[backupdr.InitializeServiceRequest], operations_pb2.Operation]:
1096+
r"""Return a callable for the initialize service method over gRPC.
1097+
1098+
Initializes the service related config for a project.
1099+
1100+
Returns:
1101+
Callable[[~.InitializeServiceRequest],
1102+
~.Operation]:
1103+
A function that, when called, will call the underlying RPC
1104+
on the server.
1105+
"""
1106+
# Generate a "stub function" on-the-fly which will actually make
1107+
# the request.
1108+
# gRPC handles serialization and deserialization, so we just need
1109+
# to pass in the functions for each.
1110+
if "initialize_service" not in self._stubs:
1111+
self._stubs["initialize_service"] = self._logged_channel.unary_unary(
1112+
"/google.cloud.backupdr.v1.BackupDR/InitializeService",
1113+
request_serializer=backupdr.InitializeServiceRequest.serialize,
1114+
response_deserializer=operations_pb2.Operation.FromString,
1115+
)
1116+
return self._stubs["initialize_service"]
1117+
10921118
def close(self):
10931119
self._logged_channel.close()
10941120

0 commit comments

Comments
 (0)