Skip to content

Commit

Permalink
feat: [google-cloud-backupdr] add InitializeServiceAPI (#13420)
Browse files Browse the repository at this point in the history
- [ ] 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:
googleapis/googleapis-gen@a5c65fa
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJhY2t1cGRyLy5Pd2xCb3QueWFtbCIsImgiOiJhNWM2NWZhY2ViZThkNTUyM2FkZTYwZmE1NTA2YmM4YzM1ZGFkODY4In0=

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <[email protected]>
  • Loading branch information
3 people authored Jan 10, 2025
1 parent 3a9a8fb commit b5cdea3
Show file tree
Hide file tree
Showing 24 changed files with 1,573 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
CreateManagementServerRequest,
DeleteManagementServerRequest,
GetManagementServerRequest,
InitializeServiceRequest,
InitializeServiceResponse,
ListManagementServersRequest,
ListManagementServersResponse,
ManagementServer,
Expand Down Expand Up @@ -128,6 +130,8 @@
"CreateManagementServerRequest",
"DeleteManagementServerRequest",
"GetManagementServerRequest",
"InitializeServiceRequest",
"InitializeServiceResponse",
"ListManagementServersRequest",
"ListManagementServersResponse",
"ManagementServer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
CreateManagementServerRequest,
DeleteManagementServerRequest,
GetManagementServerRequest,
InitializeServiceRequest,
InitializeServiceResponse,
ListManagementServersRequest,
ListManagementServersResponse,
ManagementServer,
Expand Down Expand Up @@ -173,6 +175,8 @@
"GetDataSourceRequest",
"GetManagementServerRequest",
"GuestOsFeature",
"InitializeServiceRequest",
"InitializeServiceResponse",
"InstanceParams",
"KeyRevocationActionType",
"ListBackupPlanAssociationsRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@
"get_management_server"
]
},
"InitializeService": {
"methods": [
"initialize_service"
]
},
"ListBackupPlanAssociations": {
"methods": [
"list_backup_plan_associations"
Expand Down Expand Up @@ -230,6 +235,11 @@
"get_management_server"
]
},
"InitializeService": {
"methods": [
"initialize_service"
]
},
"ListBackupPlanAssociations": {
"methods": [
"list_backup_plan_associations"
Expand Down Expand Up @@ -370,6 +380,11 @@
"get_management_server"
]
},
"InitializeService": {
"methods": [
"initialize_service"
]
},
"ListBackupPlanAssociations": {
"methods": [
"list_backup_plan_associations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
__version__ = "0.1.7" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -3153,6 +3153,7 @@ async def sample_create_backup_plan_association():
# Initialize request argument(s)
backup_plan_association = backupdr_v1.BackupPlanAssociation()
backup_plan_association.resource_type = "resource_type_value"
backup_plan_association.resource = "resource_value"
backup_plan_association.backup_plan = "backup_plan_value"
Expand Down Expand Up @@ -3796,6 +3797,108 @@ async def sample_trigger_backup():
# Done; return the response.
return response

async def initialize_service(
self,
request: Optional[Union[backupdr.InitializeServiceRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation_async.AsyncOperation:
r"""Initializes the service related config for a project.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import backupdr_v1
async def sample_initialize_service():
# Create a client
client = backupdr_v1.BackupDRAsyncClient()
# Initialize request argument(s)
request = backupdr_v1.InitializeServiceRequest(
name="name_value",
resource_type="resource_type_value",
)
# Make the request
operation = client.initialize_service(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.backupdr_v1.types.InitializeServiceRequest, dict]]):
The request object. Request message for initializing the
service.
retry (google.api_core.retry_async.AsyncRetry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.backupdr_v1.types.InitializeServiceResponse`
Response message for initializing the service.
"""
# Create or coerce a protobuf request object.
# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, backupdr.InitializeServiceRequest):
request = backupdr.InitializeServiceRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.initialize_service
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._client._validate_universe_domain()

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
backupdr.InitializeServiceResponse,
metadata_type=backupdr.OperationMetadata,
)

# Done; return the response.
return response

async def list_operations(
self,
request: Optional[operations_pb2.ListOperationsRequest] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3590,6 +3590,7 @@ def sample_create_backup_plan_association():
# Initialize request argument(s)
backup_plan_association = backupdr_v1.BackupPlanAssociation()
backup_plan_association.resource_type = "resource_type_value"
backup_plan_association.resource = "resource_value"
backup_plan_association.backup_plan = "backup_plan_value"
Expand Down Expand Up @@ -4226,6 +4227,106 @@ def sample_trigger_backup():
# Done; return the response.
return response

def initialize_service(
self,
request: Optional[Union[backupdr.InitializeServiceRequest, dict]] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> operation.Operation:
r"""Initializes the service related config for a project.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import backupdr_v1
def sample_initialize_service():
# Create a client
client = backupdr_v1.BackupDRClient()
# Initialize request argument(s)
request = backupdr_v1.InitializeServiceRequest(
name="name_value",
resource_type="resource_type_value",
)
# Make the request
operation = client.initialize_service(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.backupdr_v1.types.InitializeServiceRequest, dict]):
The request object. Request message for initializing the
service.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, Union[str, bytes]]]): Key/value pairs which should be
sent along with the request as metadata. Normally, each value must be of type `str`,
but for metadata keys ending with the suffix `-bin`, the corresponding values must
be of type `bytes`.
Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be
:class:`google.cloud.backupdr_v1.types.InitializeServiceResponse`
Response message for initializing the service.
"""
# Create or coerce a protobuf request object.
# - Use the request object if provided (there's no risk of modifying the input as
# there are no flattened fields), or create one.
if not isinstance(request, backupdr.InitializeServiceRequest):
request = backupdr.InitializeServiceRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[self._transport.initialize_service]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)),
)

# Validate the universe domain.
self._validate_universe_domain()

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation.from_gapic(
response,
self._transport.operations_client,
backupdr.InitializeServiceResponse,
metadata_type=backupdr.OperationMetadata,
)

# Done; return the response.
return response

def __enter__(self) -> "BackupDRClient":
return self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,20 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.initialize_service: gapic_v1.method.wrap_method(
self.initialize_service,
default_retry=retries.Retry(
initial=1.0,
maximum=10.0,
multiplier=1.3,
predicate=retries.if_exception_type(
core_exceptions.ServiceUnavailable,
),
deadline=60.0,
),
default_timeout=60.0,
client_info=client_info,
),
self.get_location: gapic_v1.method.wrap_method(
self.get_location,
default_timeout=None,
Expand Down Expand Up @@ -698,6 +712,15 @@ def trigger_backup(
]:
raise NotImplementedError()

@property
def initialize_service(
self,
) -> Callable[
[backupdr.InitializeServiceRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def list_operations(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,32 @@ def trigger_backup(
)
return self._stubs["trigger_backup"]

@property
def initialize_service(
self,
) -> Callable[[backupdr.InitializeServiceRequest], operations_pb2.Operation]:
r"""Return a callable for the initialize service method over gRPC.
Initializes the service related config for a project.
Returns:
Callable[[~.InitializeServiceRequest],
~.Operation]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "initialize_service" not in self._stubs:
self._stubs["initialize_service"] = self._logged_channel.unary_unary(
"/google.cloud.backupdr.v1.BackupDR/InitializeService",
request_serializer=backupdr.InitializeServiceRequest.serialize,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["initialize_service"]

def close(self):
self._logged_channel.close()

Expand Down
Loading

0 comments on commit b5cdea3

Please sign in to comment.