Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions google/cloud/spanner_admin_database_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@
from .types.spanner_database_admin import GetDatabaseDdlRequest
from .types.spanner_database_admin import GetDatabaseDdlResponse
from .types.spanner_database_admin import GetDatabaseRequest
from .types.spanner_database_admin import InternalUpdateGraphOperationRequest
from .types.spanner_database_admin import InternalUpdateGraphOperationResponse
from .types.spanner_database_admin import ListDatabaseOperationsRequest
from .types.spanner_database_admin import ListDatabaseOperationsResponse
from .types.spanner_database_admin import ListDatabaseRolesRequest
Expand Down Expand Up @@ -117,6 +119,8 @@
"GetDatabaseDdlResponse",
"GetDatabaseRequest",
"IncrementalBackupSpec",
"InternalUpdateGraphOperationRequest",
"InternalUpdateGraphOperationResponse",
"ListBackupOperationsRequest",
"ListBackupOperationsResponse",
"ListBackupSchedulesRequest",
Expand Down
15 changes: 15 additions & 0 deletions google/cloud/spanner_admin_database_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"get_iam_policy"
]
},
"InternalUpdateGraphOperation": {
"methods": [
"internal_update_graph_operation"
]
},
"ListBackupOperations": {
"methods": [
"list_backup_operations"
Expand Down Expand Up @@ -210,6 +215,11 @@
"get_iam_policy"
]
},
"InternalUpdateGraphOperation": {
"methods": [
"internal_update_graph_operation"
]
},
"ListBackupOperations": {
"methods": [
"list_backup_operations"
Expand Down Expand Up @@ -345,6 +355,11 @@
"get_iam_policy"
]
},
"InternalUpdateGraphOperation": {
"methods": [
"internal_update_graph_operation"
]
},
"ListBackupOperations": {
"methods": [
"list_backup_operations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
Type,
Union,
)
import uuid

from google.cloud.spanner_admin_database_v1 import gapic_version as package_version

Expand Down Expand Up @@ -3858,6 +3859,126 @@ async def sample_list_backup_schedules():
# Done; return the response.
return response

async def internal_update_graph_operation(
self,
request: Optional[
Union[spanner_database_admin.InternalUpdateGraphOperationRequest, dict]
] = None,
*,
database: Optional[str] = None,
operation_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> spanner_database_admin.InternalUpdateGraphOperationResponse:
r"""This is an internal API called by Spanner Graph jobs.
You should never need to call this API directly.

.. 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 spanner_admin_database_v1

async def sample_internal_update_graph_operation():
# Create a client
client = spanner_admin_database_v1.DatabaseAdminAsyncClient()

# Initialize request argument(s)
request = spanner_admin_database_v1.InternalUpdateGraphOperationRequest(
database="database_value",
operation_id="operation_id_value",
vm_identity_token="vm_identity_token_value",
)

# Make the request
response = await client.internal_update_graph_operation(request=request)

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.spanner_admin_database_v1.types.InternalUpdateGraphOperationRequest, dict]]):
The request object. Internal request proto, do not use
directly.
database (:class:`str`):
Internal field, do not use directly.
This corresponds to the ``database`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
operation_id (:class:`str`):
Internal field, do not use directly.
This corresponds to the ``operation_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
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.cloud.spanner_admin_database_v1.types.InternalUpdateGraphOperationResponse:
Internal response proto, do not use
directly.

"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
flattened_params = [database, operation_id]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - 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, spanner_database_admin.InternalUpdateGraphOperationRequest
):
request = spanner_database_admin.InternalUpdateGraphOperationRequest(
request
)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if database is not None:
request.database = database
if operation_id is not None:
request.operation_id = operation_id

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

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

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

# 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 @@ -32,6 +32,7 @@
Union,
cast,
)
import uuid
import warnings

from google.cloud.spanner_admin_database_v1 import gapic_version as package_version
Expand Down Expand Up @@ -4349,6 +4350,125 @@ def sample_list_backup_schedules():
# Done; return the response.
return response

def internal_update_graph_operation(
self,
request: Optional[
Union[spanner_database_admin.InternalUpdateGraphOperationRequest, dict]
] = None,
*,
database: Optional[str] = None,
operation_id: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, Union[str, bytes]]] = (),
) -> spanner_database_admin.InternalUpdateGraphOperationResponse:
r"""This is an internal API called by Spanner Graph jobs.
You should never need to call this API directly.

.. 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 spanner_admin_database_v1

def sample_internal_update_graph_operation():
# Create a client
client = spanner_admin_database_v1.DatabaseAdminClient()

# Initialize request argument(s)
request = spanner_admin_database_v1.InternalUpdateGraphOperationRequest(
database="database_value",
operation_id="operation_id_value",
vm_identity_token="vm_identity_token_value",
)

# Make the request
response = client.internal_update_graph_operation(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.spanner_admin_database_v1.types.InternalUpdateGraphOperationRequest, dict]):
The request object. Internal request proto, do not use
directly.
database (str):
Internal field, do not use directly.
This corresponds to the ``database`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
operation_id (str):
Internal field, do not use directly.
This corresponds to the ``operation_id`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
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.cloud.spanner_admin_database_v1.types.InternalUpdateGraphOperationResponse:
Internal response proto, do not use
directly.

"""
# Create or coerce a protobuf request object.
# - Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
flattened_params = [database, operation_id]
has_flattened_params = (
len([param for param in flattened_params if param is not None]) > 0
)
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# - 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, spanner_database_admin.InternalUpdateGraphOperationRequest
):
request = spanner_database_admin.InternalUpdateGraphOperationRequest(
request
)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if database is not None:
request.database = database
if operation_id is not None:
request.operation_id = operation_id

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

# Validate the universe domain.
self._validate_universe_domain()

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

# Done; return the response.
return response

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=3600.0,
client_info=client_info,
),
self.internal_update_graph_operation: gapic_v1.method.wrap_method(
self.internal_update_graph_operation,
default_timeout=None,
client_info=client_info,
),
self.cancel_operation: gapic_v1.method.wrap_method(
self.cancel_operation,
default_timeout=None,
Expand Down Expand Up @@ -779,6 +784,18 @@ def list_backup_schedules(
]:
raise NotImplementedError()

@property
def internal_update_graph_operation(
self,
) -> Callable[
[spanner_database_admin.InternalUpdateGraphOperationRequest],
Union[
spanner_database_admin.InternalUpdateGraphOperationResponse,
Awaitable[spanner_database_admin.InternalUpdateGraphOperationResponse],
],
]:
raise NotImplementedError()

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

@property
def internal_update_graph_operation(
self,
) -> Callable[
[spanner_database_admin.InternalUpdateGraphOperationRequest],
spanner_database_admin.InternalUpdateGraphOperationResponse,
]:
r"""Return a callable for the internal update graph
operation method over gRPC.

This is an internal API called by Spanner Graph jobs.
You should never need to call this API directly.

Returns:
Callable[[~.InternalUpdateGraphOperationRequest],
~.InternalUpdateGraphOperationResponse]:
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 "internal_update_graph_operation" not in self._stubs:
self._stubs[
"internal_update_graph_operation"
] = self._logged_channel.unary_unary(
"/google.spanner.admin.database.v1.DatabaseAdmin/InternalUpdateGraphOperation",
request_serializer=spanner_database_admin.InternalUpdateGraphOperationRequest.serialize,
response_deserializer=spanner_database_admin.InternalUpdateGraphOperationResponse.deserialize,
)
return self._stubs["internal_update_graph_operation"]

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

Expand Down
Loading