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
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
ListStoragePoolsRequest,
ListStoragePoolsResponse,
StoragePool,
SwitchActiveReplicaZoneRequest,
UpdateStoragePoolRequest,
)
from google.cloud.netapp_v1.types.volume import (
Expand Down Expand Up @@ -203,6 +204,7 @@
"ListStoragePoolsRequest",
"ListStoragePoolsResponse",
"StoragePool",
"SwitchActiveReplicaZoneRequest",
"UpdateStoragePoolRequest",
"BackupConfig",
"CreateVolumeRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
ListStoragePoolsRequest,
ListStoragePoolsResponse,
StoragePool,
SwitchActiveReplicaZoneRequest,
UpdateStoragePoolRequest,
)
from .types.volume import (
Expand Down Expand Up @@ -208,6 +209,7 @@
"SnapshotPolicy",
"StopReplicationRequest",
"StoragePool",
"SwitchActiveReplicaZoneRequest",
"TieringPolicy",
"TransferStats",
"UpdateActiveDirectoryRequest",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@
"stop_replication"
]
},
"SwitchActiveReplicaZone": {
"methods": [
"switch_active_replica_zone"
]
},
"UpdateActiveDirectory": {
"methods": [
"update_active_directory"
Expand Down Expand Up @@ -475,6 +480,11 @@
"stop_replication"
]
},
"SwitchActiveReplicaZone": {
"methods": [
"switch_active_replica_zone"
]
},
"UpdateActiveDirectory": {
"methods": [
"update_active_directory"
Expand Down Expand Up @@ -735,6 +745,11 @@
"stop_replication"
]
},
"SwitchActiveReplicaZone": {
"methods": [
"switch_active_replica_zone"
]
},
"UpdateActiveDirectory": {
"methods": [
"update_active_directory"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -941,6 +941,110 @@ async def sample_delete_storage_pool():
# Done; return the response.
return response

async def switch_active_replica_zone(
self,
request: Optional[
Union[storage_pool.SwitchActiveReplicaZoneRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""This operation will switch the active/replica zone
for a regional storagePool.

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

async def sample_switch_active_replica_zone():
# Create a client
client = netapp_v1.NetAppAsyncClient()

# Initialize request argument(s)
request = netapp_v1.SwitchActiveReplicaZoneRequest(
name="name_value",
)

# Make the request
operation = client.switch_active_replica_zone(request=request)

print("Waiting for operation to complete...")

response = (await operation).result()

# Handle the response
print(response)

Args:
request (Optional[Union[google.cloud.netapp_v1.types.SwitchActiveReplicaZoneRequest, dict]]):
The request object. SwitchActiveReplicaZoneRequest switch
the active/replica zone for a regional
storagePool.
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, str]]): Strings which should be
sent along with the request as metadata.

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.netapp_v1.types.StoragePool` StoragePool is a container for volumes with a service level and capacity.
Volumes can be created in a pool of sufficient
available capacity. StoragePool capacity is what you
are billed for.

"""
# 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, storage_pool.SwitchActiveReplicaZoneRequest):
request = storage_pool.SwitchActiveReplicaZoneRequest(request)

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

# 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,
storage_pool.StoragePool,
metadata_type=cloud_netapp_service.OperationMetadata,
)

# Done; return the response.
return response

async def list_volumes(
self,
request: Optional[Union[volume.ListVolumesRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,110 @@ def sample_delete_storage_pool():
# Done; return the response.
return response

def switch_active_replica_zone(
self,
request: Optional[
Union[storage_pool.SwitchActiveReplicaZoneRequest, dict]
] = None,
*,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation.Operation:
r"""This operation will switch the active/replica zone
for a regional storagePool.

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

def sample_switch_active_replica_zone():
# Create a client
client = netapp_v1.NetAppClient()

# Initialize request argument(s)
request = netapp_v1.SwitchActiveReplicaZoneRequest(
name="name_value",
)

# Make the request
operation = client.switch_active_replica_zone(request=request)

print("Waiting for operation to complete...")

response = operation.result()

# Handle the response
print(response)

Args:
request (Union[google.cloud.netapp_v1.types.SwitchActiveReplicaZoneRequest, dict]):
The request object. SwitchActiveReplicaZoneRequest switch
the active/replica zone for a regional
storagePool.
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, str]]): Strings which should be
sent along with the request as metadata.

Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.

The result type for the operation will be :class:`google.cloud.netapp_v1.types.StoragePool` StoragePool is a container for volumes with a service level and capacity.
Volumes can be created in a pool of sufficient
available capacity. StoragePool capacity is what you
are billed for.

"""
# 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, storage_pool.SwitchActiveReplicaZoneRequest):
request = storage_pool.SwitchActiveReplicaZoneRequest(request)

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

# 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,
storage_pool.StoragePool,
metadata_type=cloud_netapp_service.OperationMetadata,
)

# Done; return the response.
return response

def list_volumes(
self,
request: Optional[Union[volume.ListVolumesRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=60.0,
client_info=client_info,
),
self.switch_active_replica_zone: gapic_v1.method.wrap_method(
self.switch_active_replica_zone,
default_timeout=None,
client_info=client_info,
),
self.list_volumes: gapic_v1.method.wrap_method(
self.list_volumes,
default_retry=retries.Retry(
Expand Down Expand Up @@ -627,6 +632,15 @@ def delete_storage_pool(
]:
raise NotImplementedError()

@property
def switch_active_replica_zone(
self,
) -> Callable[
[storage_pool.SwitchActiveReplicaZoneRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def list_volumes(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,35 @@ def delete_storage_pool(
)
return self._stubs["delete_storage_pool"]

@property
def switch_active_replica_zone(
self,
) -> Callable[
[storage_pool.SwitchActiveReplicaZoneRequest], operations_pb2.Operation
]:
r"""Return a callable for the switch active replica zone method over gRPC.

This operation will switch the active/replica zone
for a regional storagePool.

Returns:
Callable[[~.SwitchActiveReplicaZoneRequest],
~.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 "switch_active_replica_zone" not in self._stubs:
self._stubs["switch_active_replica_zone"] = self.grpc_channel.unary_unary(
"/google.cloud.netapp.v1.NetApp/SwitchActiveReplicaZone",
request_serializer=storage_pool.SwitchActiveReplicaZoneRequest.serialize,
response_deserializer=operations_pb2.Operation.FromString,
)
return self._stubs["switch_active_replica_zone"]

@property
def list_volumes(
self,
Expand Down
Loading