Skip to content

Commit

Permalink
feat: [google-cloud-netapp] Add ValidateDirectoryService API for test…
Browse files Browse the repository at this point in the history
…ing AD connection of a storage pool (#13412)

- [ ] Regenerate this pull request now.

BEGIN_COMMIT_OVERRIDE
feat: Add ValidateDirectoryService API for testing AD connection of a
storage pool
docs: Remove the format for `replication` in message
`google.cloud.netapp.v1.HybridReplicationParameters`
END_COMMIT_OVERRIDE

docs: Removed the format for `replication` in message
`google.cloud.netapp.v1.HybridReplicationParameters`

PiperOrigin-RevId: 713157619

Source-Link:
googleapis/googleapis@7f2db36

Source-Link:
googleapis/googleapis-gen@33068cc
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLW5ldGFwcC8uT3dsQm90LnlhbWwiLCJoIjoiMzMwNjhjYzUwYjM5Y2IwMWVjYzZkMTc1ZjQ2NGUxMzg0OTE3MTFmMiJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Victor Chudnovsky <vchudnov@google.com>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent d30f5ea commit b45a11d
Show file tree
Hide file tree
Showing 21 changed files with 1,485 additions and 8 deletions.
4 changes: 4 additions & 0 deletions packages/google-cloud-netapp/google/cloud/netapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
)
from google.cloud.netapp_v1.types.cloud_netapp_service import OperationMetadata
from google.cloud.netapp_v1.types.common import (
DirectoryServiceType,
EncryptionType,
LocationMetadata,
ServiceLevel,
Expand Down Expand Up @@ -109,6 +110,7 @@
StoragePool,
SwitchActiveReplicaZoneRequest,
UpdateStoragePoolRequest,
ValidateDirectoryServiceRequest,
)
from google.cloud.netapp_v1.types.volume import (
AccessType,
Expand Down Expand Up @@ -171,6 +173,7 @@
"UpdateBackupVaultRequest",
"OperationMetadata",
"LocationMetadata",
"DirectoryServiceType",
"EncryptionType",
"ServiceLevel",
"CreateKmsConfigRequest",
Expand Down Expand Up @@ -213,6 +216,7 @@
"StoragePool",
"SwitchActiveReplicaZoneRequest",
"UpdateStoragePoolRequest",
"ValidateDirectoryServiceRequest",
"BackupConfig",
"CreateVolumeRequest",
"DailySchedule",
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.3.17" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
10 changes: 9 additions & 1 deletion packages/google-cloud-netapp/google/cloud/netapp_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@
UpdateBackupVaultRequest,
)
from .types.cloud_netapp_service import OperationMetadata
from .types.common import EncryptionType, LocationMetadata, ServiceLevel
from .types.common import (
DirectoryServiceType,
EncryptionType,
LocationMetadata,
ServiceLevel,
)
from .types.kms import (
CreateKmsConfigRequest,
DeleteKmsConfigRequest,
Expand Down Expand Up @@ -104,6 +109,7 @@
StoragePool,
SwitchActiveReplicaZoneRequest,
UpdateStoragePoolRequest,
ValidateDirectoryServiceRequest,
)
from .types.volume import (
AccessType,
Expand Down Expand Up @@ -161,6 +167,7 @@
"DeleteStoragePoolRequest",
"DeleteVolumeRequest",
"DestinationVolumeParameters",
"DirectoryServiceType",
"EncryptVolumesRequest",
"EncryptionType",
"EstablishPeeringRequest",
Expand Down Expand Up @@ -229,6 +236,7 @@
"UpdateSnapshotRequest",
"UpdateStoragePoolRequest",
"UpdateVolumeRequest",
"ValidateDirectoryServiceRequest",
"VerifyKmsConfigRequest",
"VerifyKmsConfigResponse",
"Volume",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@
"update_volume"
]
},
"ValidateDirectoryService": {
"methods": [
"validate_directory_service"
]
},
"VerifyKmsConfig": {
"methods": [
"verify_kms_config"
Expand Down Expand Up @@ -550,6 +555,11 @@
"update_volume"
]
},
"ValidateDirectoryService": {
"methods": [
"validate_directory_service"
]
},
"VerifyKmsConfig": {
"methods": [
"verify_kms_config"
Expand Down Expand Up @@ -825,6 +835,11 @@
"update_volume"
]
},
"ValidateDirectoryService": {
"methods": [
"validate_directory_service"
]
},
"VerifyKmsConfig": {
"methods": [
"verify_kms_config"
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.3.17" # {x-release-please-version}
__version__ = "0.0.0" # {x-release-please-version}
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,119 @@ async def sample_delete_storage_pool():
# Done; return the response.
return response

async def validate_directory_service(
self,
request: Optional[
Union[storage_pool.ValidateDirectoryServiceRequest, 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"""ValidateDirectoryService does a connectivity check
for a directory service policy attached to the storage
pool.
.. 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_validate_directory_service():
# Create a client
client = netapp_v1.NetAppAsyncClient()
# Initialize request argument(s)
request = netapp_v1.ValidateDirectoryServiceRequest(
name="name_value",
)
# Make the request
operation = client.validate_directory_service(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.ValidateDirectoryServiceRequest, dict]]):
The request object. ValidateDirectoryServiceRequest
validates the directory service policy
attached to the storage pool.
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.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
empty messages in your APIs. A typical example is to
use it as the request or the response type of an API
method. For instance:
service Foo {
rpc Bar(google.protobuf.Empty) returns
(google.protobuf.Empty);
}
"""
# 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.ValidateDirectoryServiceRequest):
request = storage_pool.ValidateDirectoryServiceRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._client._transport._wrapped_methods[
self._client._transport.validate_directory_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,
empty_pb2.Empty,
metadata_type=cloud_netapp_service.OperationMetadata,
)

# Done; return the response.
return response

async def switch_active_replica_zone(
self,
request: Optional[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,119 @@ def sample_delete_storage_pool():
# Done; return the response.
return response

def validate_directory_service(
self,
request: Optional[
Union[storage_pool.ValidateDirectoryServiceRequest, 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"""ValidateDirectoryService does a connectivity check
for a directory service policy attached to the storage
pool.
.. 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_validate_directory_service():
# Create a client
client = netapp_v1.NetAppClient()
# Initialize request argument(s)
request = netapp_v1.ValidateDirectoryServiceRequest(
name="name_value",
)
# Make the request
operation = client.validate_directory_service(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.netapp_v1.types.ValidateDirectoryServiceRequest, dict]):
The request object. ValidateDirectoryServiceRequest
validates the directory service policy
attached to the storage pool.
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.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated
empty messages in your APIs. A typical example is to
use it as the request or the response type of an API
method. For instance:
service Foo {
rpc Bar(google.protobuf.Empty) returns
(google.protobuf.Empty);
}
"""
# 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.ValidateDirectoryServiceRequest):
request = storage_pool.ValidateDirectoryServiceRequest(request)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.validate_directory_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,
empty_pb2.Empty,
metadata_type=cloud_netapp_service.OperationMetadata,
)

# Done; return the response.
return response

def switch_active_replica_zone(
self,
request: Optional[
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.validate_directory_service: gapic_v1.method.wrap_method(
self.validate_directory_service,
default_timeout=None,
client_info=client_info,
),
self.switch_active_replica_zone: gapic_v1.method.wrap_method(
self.switch_active_replica_zone,
default_timeout=None,
Expand Down Expand Up @@ -672,6 +677,15 @@ def delete_storage_pool(
]:
raise NotImplementedError()

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

@property
def switch_active_replica_zone(
self,
Expand Down
Loading

0 comments on commit b45a11d

Please sign in to comment.