diff --git a/packages/google-cloud-kms/.github/release-please.yml b/packages/google-cloud-kms/.github/release-please.yml index 29601ad4692c..fe749ff6b15d 100644 --- a/packages/google-cloud-kms/.github/release-please.yml +++ b/packages/google-cloud-kms/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/packages/google-cloud-kms/.release-please-manifest.json b/packages/google-cloud-kms/.release-please-manifest.json new file mode 100644 index 000000000000..10d7e57d21c7 --- /dev/null +++ b/packages/google-cloud-kms/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.12.3" +} diff --git a/packages/google-cloud-kms/docs/conf.py b/packages/google-cloud-kms/docs/conf.py index 39f1d289f159..41519f870b50 100644 --- a/packages/google-cloud-kms/docs/conf.py +++ b/packages/google-cloud-kms/docs/conf.py @@ -24,9 +24,9 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys import os import shlex +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the diff --git a/packages/google-cloud-kms/docs/index.rst b/packages/google-cloud-kms/docs/index.rst index 8fc633c2fe45..393c884c76a1 100644 --- a/packages/google-cloud-kms/docs/index.rst +++ b/packages/google-cloud-kms/docs/index.rst @@ -2,24 +2,25 @@ .. include:: multiprocessing.rst + API Reference ------------- .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - kms_v1/services - kms_v1/types + kms_v1/services + kms_v1/types Migration Guide --------------- -See the guide below for instructions on migrating to the 2.x release of this library. +See the guide below for instructions on migrating to the latest version. .. toctree:: :maxdepth: 2 - UPGRADING +  UPGRADING Changelog @@ -28,6 +29,6 @@ Changelog For a list of all ``google-cloud-kms`` releases: .. toctree:: - :maxdepth: 2 + :maxdepth: 2 - changelog + changelog diff --git a/packages/google-cloud-kms/docs/kms_v1/types.rst b/packages/google-cloud-kms/docs/kms_v1/types.rst index fe1026e9254b..c78ef915f3a0 100644 --- a/packages/google-cloud-kms/docs/kms_v1/types.rst +++ b/packages/google-cloud-kms/docs/kms_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Kms v1 API .. automodule:: google.cloud.kms_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-kms/google/cloud/kms/__init__.py b/packages/google-cloud-kms/google/cloud/kms/__init__.py index 2cfad94b6ffa..c3ccdbacc338 100644 --- a/packages/google-cloud-kms/google/cloud/kms/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms/__init__.py @@ -13,71 +13,80 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.kms import gapic_version as package_version + +__version__ = package_version.__version__ + -from google.cloud.kms_v1.services.ekm_service.client import EkmServiceClient from google.cloud.kms_v1.services.ekm_service.async_client import EkmServiceAsyncClient +from google.cloud.kms_v1.services.ekm_service.client import EkmServiceClient +from google.cloud.kms_v1.services.key_management_service.async_client import ( + KeyManagementServiceAsyncClient, +) from google.cloud.kms_v1.services.key_management_service.client import ( KeyManagementServiceClient, ) -from google.cloud.kms_v1.services.key_management_service.async_client import ( - KeyManagementServiceAsyncClient, +from google.cloud.kms_v1.types.ekm_service import ( + Certificate, + CreateEkmConnectionRequest, + EkmConnection, + GetEkmConnectionRequest, + ListEkmConnectionsRequest, + ListEkmConnectionsResponse, + UpdateEkmConnectionRequest, +) +from google.cloud.kms_v1.types.resources import ( + CryptoKey, + CryptoKeyVersion, + CryptoKeyVersionTemplate, + ExternalProtectionLevelOptions, + ImportJob, + KeyOperationAttestation, + KeyRing, + ProtectionLevel, + PublicKey, +) +from google.cloud.kms_v1.types.service import ( + AsymmetricDecryptRequest, + AsymmetricDecryptResponse, + AsymmetricSignRequest, + AsymmetricSignResponse, + CreateCryptoKeyRequest, + CreateCryptoKeyVersionRequest, + CreateImportJobRequest, + CreateKeyRingRequest, + DecryptRequest, + DecryptResponse, + DestroyCryptoKeyVersionRequest, + Digest, + EncryptRequest, + EncryptResponse, + GenerateRandomBytesRequest, + GenerateRandomBytesResponse, + GetCryptoKeyRequest, + GetCryptoKeyVersionRequest, + GetImportJobRequest, + GetKeyRingRequest, + GetPublicKeyRequest, + ImportCryptoKeyVersionRequest, + ListCryptoKeysRequest, + ListCryptoKeysResponse, + ListCryptoKeyVersionsRequest, + ListCryptoKeyVersionsResponse, + ListImportJobsRequest, + ListImportJobsResponse, + ListKeyRingsRequest, + ListKeyRingsResponse, + LocationMetadata, + MacSignRequest, + MacSignResponse, + MacVerifyRequest, + MacVerifyResponse, + RestoreCryptoKeyVersionRequest, + UpdateCryptoKeyPrimaryVersionRequest, + UpdateCryptoKeyRequest, + UpdateCryptoKeyVersionRequest, ) - -from google.cloud.kms_v1.types.ekm_service import Certificate -from google.cloud.kms_v1.types.ekm_service import CreateEkmConnectionRequest -from google.cloud.kms_v1.types.ekm_service import EkmConnection -from google.cloud.kms_v1.types.ekm_service import GetEkmConnectionRequest -from google.cloud.kms_v1.types.ekm_service import ListEkmConnectionsRequest -from google.cloud.kms_v1.types.ekm_service import ListEkmConnectionsResponse -from google.cloud.kms_v1.types.ekm_service import UpdateEkmConnectionRequest -from google.cloud.kms_v1.types.resources import CryptoKey -from google.cloud.kms_v1.types.resources import CryptoKeyVersion -from google.cloud.kms_v1.types.resources import CryptoKeyVersionTemplate -from google.cloud.kms_v1.types.resources import ExternalProtectionLevelOptions -from google.cloud.kms_v1.types.resources import ImportJob -from google.cloud.kms_v1.types.resources import KeyOperationAttestation -from google.cloud.kms_v1.types.resources import KeyRing -from google.cloud.kms_v1.types.resources import PublicKey -from google.cloud.kms_v1.types.resources import ProtectionLevel -from google.cloud.kms_v1.types.service import AsymmetricDecryptRequest -from google.cloud.kms_v1.types.service import AsymmetricDecryptResponse -from google.cloud.kms_v1.types.service import AsymmetricSignRequest -from google.cloud.kms_v1.types.service import AsymmetricSignResponse -from google.cloud.kms_v1.types.service import CreateCryptoKeyRequest -from google.cloud.kms_v1.types.service import CreateCryptoKeyVersionRequest -from google.cloud.kms_v1.types.service import CreateImportJobRequest -from google.cloud.kms_v1.types.service import CreateKeyRingRequest -from google.cloud.kms_v1.types.service import DecryptRequest -from google.cloud.kms_v1.types.service import DecryptResponse -from google.cloud.kms_v1.types.service import DestroyCryptoKeyVersionRequest -from google.cloud.kms_v1.types.service import Digest -from google.cloud.kms_v1.types.service import EncryptRequest -from google.cloud.kms_v1.types.service import EncryptResponse -from google.cloud.kms_v1.types.service import GenerateRandomBytesRequest -from google.cloud.kms_v1.types.service import GenerateRandomBytesResponse -from google.cloud.kms_v1.types.service import GetCryptoKeyRequest -from google.cloud.kms_v1.types.service import GetCryptoKeyVersionRequest -from google.cloud.kms_v1.types.service import GetImportJobRequest -from google.cloud.kms_v1.types.service import GetKeyRingRequest -from google.cloud.kms_v1.types.service import GetPublicKeyRequest -from google.cloud.kms_v1.types.service import ImportCryptoKeyVersionRequest -from google.cloud.kms_v1.types.service import ListCryptoKeysRequest -from google.cloud.kms_v1.types.service import ListCryptoKeysResponse -from google.cloud.kms_v1.types.service import ListCryptoKeyVersionsRequest -from google.cloud.kms_v1.types.service import ListCryptoKeyVersionsResponse -from google.cloud.kms_v1.types.service import ListImportJobsRequest -from google.cloud.kms_v1.types.service import ListImportJobsResponse -from google.cloud.kms_v1.types.service import ListKeyRingsRequest -from google.cloud.kms_v1.types.service import ListKeyRingsResponse -from google.cloud.kms_v1.types.service import LocationMetadata -from google.cloud.kms_v1.types.service import MacSignRequest -from google.cloud.kms_v1.types.service import MacSignResponse -from google.cloud.kms_v1.types.service import MacVerifyRequest -from google.cloud.kms_v1.types.service import MacVerifyResponse -from google.cloud.kms_v1.types.service import RestoreCryptoKeyVersionRequest -from google.cloud.kms_v1.types.service import UpdateCryptoKeyPrimaryVersionRequest -from google.cloud.kms_v1.types.service import UpdateCryptoKeyRequest -from google.cloud.kms_v1.types.service import UpdateCryptoKeyVersionRequest __all__ = ( "EkmServiceClient", diff --git a/packages/google-cloud-kms/google/cloud/kms/gapic_version.py b/packages/google-cloud-kms/google/cloud/kms/gapic_version.py new file mode 100644 index 000000000000..e0546e8c0324 --- /dev/null +++ b/packages/google-cloud-kms/google/cloud/kms/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "2.12.3" # {x-release-please-version} diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/__init__.py index c8f91d26d16e..cb4277e1d171 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/__init__.py @@ -13,67 +13,77 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.kms import gapic_version as package_version -from .services.ekm_service import EkmServiceClient -from .services.ekm_service import EkmServiceAsyncClient -from .services.key_management_service import KeyManagementServiceClient -from .services.key_management_service import KeyManagementServiceAsyncClient +__version__ = package_version.__version__ -from .types.ekm_service import Certificate -from .types.ekm_service import CreateEkmConnectionRequest -from .types.ekm_service import EkmConnection -from .types.ekm_service import GetEkmConnectionRequest -from .types.ekm_service import ListEkmConnectionsRequest -from .types.ekm_service import ListEkmConnectionsResponse -from .types.ekm_service import UpdateEkmConnectionRequest -from .types.resources import CryptoKey -from .types.resources import CryptoKeyVersion -from .types.resources import CryptoKeyVersionTemplate -from .types.resources import ExternalProtectionLevelOptions -from .types.resources import ImportJob -from .types.resources import KeyOperationAttestation -from .types.resources import KeyRing -from .types.resources import PublicKey -from .types.resources import ProtectionLevel -from .types.service import AsymmetricDecryptRequest -from .types.service import AsymmetricDecryptResponse -from .types.service import AsymmetricSignRequest -from .types.service import AsymmetricSignResponse -from .types.service import CreateCryptoKeyRequest -from .types.service import CreateCryptoKeyVersionRequest -from .types.service import CreateImportJobRequest -from .types.service import CreateKeyRingRequest -from .types.service import DecryptRequest -from .types.service import DecryptResponse -from .types.service import DestroyCryptoKeyVersionRequest -from .types.service import Digest -from .types.service import EncryptRequest -from .types.service import EncryptResponse -from .types.service import GenerateRandomBytesRequest -from .types.service import GenerateRandomBytesResponse -from .types.service import GetCryptoKeyRequest -from .types.service import GetCryptoKeyVersionRequest -from .types.service import GetImportJobRequest -from .types.service import GetKeyRingRequest -from .types.service import GetPublicKeyRequest -from .types.service import ImportCryptoKeyVersionRequest -from .types.service import ListCryptoKeysRequest -from .types.service import ListCryptoKeysResponse -from .types.service import ListCryptoKeyVersionsRequest -from .types.service import ListCryptoKeyVersionsResponse -from .types.service import ListImportJobsRequest -from .types.service import ListImportJobsResponse -from .types.service import ListKeyRingsRequest -from .types.service import ListKeyRingsResponse -from .types.service import LocationMetadata -from .types.service import MacSignRequest -from .types.service import MacSignResponse -from .types.service import MacVerifyRequest -from .types.service import MacVerifyResponse -from .types.service import RestoreCryptoKeyVersionRequest -from .types.service import UpdateCryptoKeyPrimaryVersionRequest -from .types.service import UpdateCryptoKeyRequest -from .types.service import UpdateCryptoKeyVersionRequest + +from .services.ekm_service import EkmServiceAsyncClient, EkmServiceClient +from .services.key_management_service import ( + KeyManagementServiceAsyncClient, + KeyManagementServiceClient, +) +from .types.ekm_service import ( + Certificate, + CreateEkmConnectionRequest, + EkmConnection, + GetEkmConnectionRequest, + ListEkmConnectionsRequest, + ListEkmConnectionsResponse, + UpdateEkmConnectionRequest, +) +from .types.resources import ( + CryptoKey, + CryptoKeyVersion, + CryptoKeyVersionTemplate, + ExternalProtectionLevelOptions, + ImportJob, + KeyOperationAttestation, + KeyRing, + ProtectionLevel, + PublicKey, +) +from .types.service import ( + AsymmetricDecryptRequest, + AsymmetricDecryptResponse, + AsymmetricSignRequest, + AsymmetricSignResponse, + CreateCryptoKeyRequest, + CreateCryptoKeyVersionRequest, + CreateImportJobRequest, + CreateKeyRingRequest, + DecryptRequest, + DecryptResponse, + DestroyCryptoKeyVersionRequest, + Digest, + EncryptRequest, + EncryptResponse, + GenerateRandomBytesRequest, + GenerateRandomBytesResponse, + GetCryptoKeyRequest, + GetCryptoKeyVersionRequest, + GetImportJobRequest, + GetKeyRingRequest, + GetPublicKeyRequest, + ImportCryptoKeyVersionRequest, + ListCryptoKeysRequest, + ListCryptoKeysResponse, + ListCryptoKeyVersionsRequest, + ListCryptoKeyVersionsResponse, + ListImportJobsRequest, + ListImportJobsResponse, + ListKeyRingsRequest, + ListKeyRingsResponse, + LocationMetadata, + MacSignRequest, + MacSignResponse, + MacVerifyRequest, + MacVerifyResponse, + RestoreCryptoKeyVersionRequest, + UpdateCryptoKeyPrimaryVersionRequest, + UpdateCryptoKeyRequest, + UpdateCryptoKeyVersionRequest, +) __all__ = ( "EkmServiceAsyncClient", diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/__init__.py index 07dab11727d1..31c5038a7b76 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import EkmServiceClient from .async_client import EkmServiceAsyncClient +from .client import EkmServiceClient __all__ = ( "EkmServiceClient", diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py index a143184ecfe7..7c6e47ea008f 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/async_client.py @@ -16,30 +16,42 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.kms_v1.services.ekm_service import pagers -from google.cloud.kms_v1.types import ekm_service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import EkmServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import EkmServiceGrpcAsyncIOTransport + +from google.cloud.kms_v1.services.ekm_service import pagers +from google.cloud.kms_v1.types import ekm_service + from .client import EkmServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, EkmServiceTransport +from .transports.grpc_asyncio import EkmServiceGrpcAsyncIOTransport class EkmServiceAsyncClient: @@ -164,9 +176,9 @@ def transport(self) -> EkmServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, EkmServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the ekm service client. @@ -210,11 +222,11 @@ def __init__( async def list_ekm_connections( self, - request: Union[ekm_service.ListEkmConnectionsRequest, dict] = None, + request: Optional[Union[ekm_service.ListEkmConnectionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEkmConnectionsAsyncPager: r"""Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. @@ -247,9 +259,9 @@ async def sample_list_ekm_connections(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ListEkmConnectionsRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ListEkmConnectionsRequest, dict]]): The request object. Request message for - [KeyManagementService.ListEkmConnections][]. + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. parent (:class:`str`): Required. The resource name of the location associated with the @@ -268,7 +280,7 @@ async def sample_list_ekm_connections(): Returns: google.cloud.kms_v1.services.ekm_service.pagers.ListEkmConnectionsAsyncPager: Response message for - [KeyManagementService.ListEkmConnections][]. + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. Iterating over this object will yield results and resolve additional pages automatically. @@ -337,11 +349,11 @@ async def sample_list_ekm_connections(): async def get_ekm_connection( self, - request: Union[ekm_service.GetEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.GetEkmConnectionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Returns metadata for a given @@ -374,9 +386,9 @@ async def sample_get_ekm_connection(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetEkmConnectionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetEkmConnectionRequest, dict]]): The request object. Request message for - [KeyManagementService.GetEkmConnection][]. + [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection]. name (:class:`str`): Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the @@ -462,13 +474,13 @@ async def sample_get_ekm_connection(): async def create_ekm_connection( self, - request: Union[ekm_service.CreateEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.CreateEkmConnectionRequest, dict]] = None, *, - parent: str = None, - ekm_connection_id: str = None, - ekm_connection: ekm_service.EkmConnection = None, + parent: Optional[str] = None, + ekm_connection_id: Optional[str] = None, + ekm_connection: Optional[ekm_service.EkmConnection] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] @@ -502,9 +514,9 @@ async def sample_create_ekm_connection(): print(response) Args: - request (Union[google.cloud.kms_v1.types.CreateEkmConnectionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.CreateEkmConnectionRequest, dict]]): The request object. Request message for - [KeyManagementService.CreateEkmConnection][]. + [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection]. parent (:class:`str`): Required. The resource name of the location associated with the @@ -609,12 +621,12 @@ async def sample_create_ekm_connection(): async def update_ekm_connection( self, - request: Union[ekm_service.UpdateEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.UpdateEkmConnectionRequest, dict]] = None, *, - ekm_connection: ekm_service.EkmConnection = None, - update_mask: field_mask_pb2.FieldMask = None, + ekm_connection: Optional[ekm_service.EkmConnection] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s @@ -646,9 +658,9 @@ async def sample_update_ekm_connection(): print(response) Args: - request (Union[google.cloud.kms_v1.types.UpdateEkmConnectionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.UpdateEkmConnectionRequest, dict]]): The request object. Request message for - [KeyManagementService.UpdateEkmConnection][]. + [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection]. ekm_connection (:class:`google.cloud.kms_v1.types.EkmConnection`): Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with @@ -744,10 +756,10 @@ async def sample_update_ekm_connection(): async def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -863,10 +875,10 @@ async def set_iam_policy( async def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -984,10 +996,10 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified permissions against the IAM access control diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py index 0be3e2a94161..ff18696ab140 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/client.py @@ -16,31 +16,44 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.kms_v1.services.ekm_service import pagers -from google.cloud.kms_v1.types import ekm_service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import EkmServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.kms_v1.services.ekm_service import pagers +from google.cloud.kms_v1.types import ekm_service + +from .transports.base import DEFAULT_CLIENT_INFO, EkmServiceTransport from .transports.grpc import EkmServiceGrpcTransport from .transports.grpc_asyncio import EkmServiceGrpcAsyncIOTransport @@ -59,7 +72,7 @@ class EkmServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[EkmServiceTransport]: """Returns an appropriate transport class. @@ -364,8 +377,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, EkmServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, EkmServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the ekm service client. @@ -379,7 +392,7 @@ def __init__( transport (Union[str, EkmServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -409,6 +422,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -461,11 +475,11 @@ def __init__( def list_ekm_connections( self, - request: Union[ekm_service.ListEkmConnectionsRequest, dict] = None, + request: Optional[Union[ekm_service.ListEkmConnectionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEkmConnectionsPager: r"""Lists [EkmConnections][google.cloud.kms.v1.EkmConnection]. @@ -500,7 +514,7 @@ def sample_list_ekm_connections(): Args: request (Union[google.cloud.kms_v1.types.ListEkmConnectionsRequest, dict]): The request object. Request message for - [KeyManagementService.ListEkmConnections][]. + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. parent (str): Required. The resource name of the location associated with the @@ -519,7 +533,7 @@ def sample_list_ekm_connections(): Returns: google.cloud.kms_v1.services.ekm_service.pagers.ListEkmConnectionsPager: Response message for - [KeyManagementService.ListEkmConnections][]. + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. Iterating over this object will yield results and resolve additional pages automatically. @@ -578,11 +592,11 @@ def sample_list_ekm_connections(): def get_ekm_connection( self, - request: Union[ekm_service.GetEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.GetEkmConnectionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Returns metadata for a given @@ -617,7 +631,7 @@ def sample_get_ekm_connection(): Args: request (Union[google.cloud.kms_v1.types.GetEkmConnectionRequest, dict]): The request object. Request message for - [KeyManagementService.GetEkmConnection][]. + [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection]. name (str): Required. The [name][google.cloud.kms.v1.EkmConnection.name] of the @@ -693,13 +707,13 @@ def sample_get_ekm_connection(): def create_ekm_connection( self, - request: Union[ekm_service.CreateEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.CreateEkmConnectionRequest, dict]] = None, *, - parent: str = None, - ekm_connection_id: str = None, - ekm_connection: ekm_service.EkmConnection = None, + parent: Optional[str] = None, + ekm_connection_id: Optional[str] = None, + ekm_connection: Optional[ekm_service.EkmConnection] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Creates a new [EkmConnection][google.cloud.kms.v1.EkmConnection] @@ -735,7 +749,7 @@ def sample_create_ekm_connection(): Args: request (Union[google.cloud.kms_v1.types.CreateEkmConnectionRequest, dict]): The request object. Request message for - [KeyManagementService.CreateEkmConnection][]. + [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection]. parent (str): Required. The resource name of the location associated with the @@ -830,12 +844,12 @@ def sample_create_ekm_connection(): def update_ekm_connection( self, - request: Union[ekm_service.UpdateEkmConnectionRequest, dict] = None, + request: Optional[Union[ekm_service.UpdateEkmConnectionRequest, dict]] = None, *, - ekm_connection: ekm_service.EkmConnection = None, - update_mask: field_mask_pb2.FieldMask = None, + ekm_connection: Optional[ekm_service.EkmConnection] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> ekm_service.EkmConnection: r"""Updates an [EkmConnection][google.cloud.kms.v1.EkmConnection]'s @@ -869,7 +883,7 @@ def sample_update_ekm_connection(): Args: request (Union[google.cloud.kms_v1.types.UpdateEkmConnectionRequest, dict]): The request object. Request message for - [KeyManagementService.UpdateEkmConnection][]. + [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection]. ekm_connection (google.cloud.kms_v1.types.EkmConnection): Required. [EkmConnection][google.cloud.kms.v1.EkmConnection] with @@ -968,10 +982,10 @@ def __exit__(self, type, value, traceback): def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -1088,10 +1102,10 @@ def set_iam_policy( def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -1209,10 +1223,10 @@ def get_iam_policy( def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/pagers.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/pagers.py index 73d62299055a..ba4e9860521e 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/pagers.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/pagers.py @@ -18,10 +18,10 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) from google.cloud.kms_v1.types import ekm_service diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/__init__.py index 9022e8af52fc..06053977c6ca 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import EkmServiceGrpcTransport from .grpc_asyncio import EkmServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[EkmServiceTransport]] _transport_registry["grpc"] = EkmServiceGrpcTransport diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py index 9c1fdbbc6f5b..343282cc26c7 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/base.py @@ -15,19 +15,19 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources from google.cloud.kms_v1.types import ekm_service -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -53,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py index 96c47e7a0452..7baa20ca7c89 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc.py @@ -13,21 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore import grpc # type: ignore from google.cloud.kms_v1.types import ekm_service -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from .base import EkmServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, EkmServiceTransport class EkmServiceGrpcTransport(EkmServiceTransport): @@ -54,14 +53,14 @@ def __init__( self, *, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -188,8 +187,8 @@ def __init__( def create_channel( cls, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc_asyncio.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc_asyncio.py index 637b366153ad..d4a4932fab27 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/ekm_service/transports/grpc_asyncio.py @@ -13,21 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore from google.cloud.kms_v1.types import ekm_service -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from .base import EkmServiceTransport, DEFAULT_CLIENT_INFO + +from .base import DEFAULT_CLIENT_INFO, EkmServiceTransport from .grpc import EkmServiceGrpcTransport @@ -56,7 +55,7 @@ class EkmServiceGrpcAsyncIOTransport(EkmServiceTransport): def create_channel( cls, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -99,15 +98,15 @@ def __init__( self, *, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/__init__.py index 11795c84cd04..06a8a147f7fb 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import KeyManagementServiceClient from .async_client import KeyManagementServiceAsyncClient +from .client import KeyManagementServiceClient __all__ = ( "KeyManagementServiceClient", diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py index da6016c336ef..59fa59464211 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/async_client.py @@ -16,33 +16,44 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) -from google.api_core.client_options import ClientOptions from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.kms_v1.services.key_management_service import pagers -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore -from .transports.base import KeyManagementServiceTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import KeyManagementServiceGrpcAsyncIOTransport + +from google.cloud.kms_v1.services.key_management_service import pagers +from google.cloud.kms_v1.types import resources, service + from .client import KeyManagementServiceClient +from .transports.base import DEFAULT_CLIENT_INFO, KeyManagementServiceTransport +from .transports.grpc_asyncio import KeyManagementServiceGrpcAsyncIOTransport class KeyManagementServiceAsyncClient: @@ -196,9 +207,9 @@ def transport(self) -> KeyManagementServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, KeyManagementServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the key management service client. @@ -242,11 +253,11 @@ def __init__( async def list_key_rings( self, - request: Union[service.ListKeyRingsRequest, dict] = None, + request: Optional[Union[service.ListKeyRingsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListKeyRingsAsyncPager: r"""Lists [KeyRings][google.cloud.kms.v1.KeyRing]. @@ -279,7 +290,7 @@ async def sample_list_key_rings(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ListKeyRingsRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ListKeyRingsRequest, dict]]): The request object. Request message for [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. parent (:class:`str`): @@ -368,11 +379,11 @@ async def sample_list_key_rings(): async def list_crypto_keys( self, - request: Union[service.ListCryptoKeysRequest, dict] = None, + request: Optional[Union[service.ListCryptoKeysRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCryptoKeysAsyncPager: r"""Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. @@ -405,7 +416,7 @@ async def sample_list_crypto_keys(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ListCryptoKeysRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ListCryptoKeysRequest, dict]]): The request object. Request message for [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. parent (:class:`str`): @@ -494,11 +505,11 @@ async def sample_list_crypto_keys(): async def list_crypto_key_versions( self, - request: Union[service.ListCryptoKeyVersionsRequest, dict] = None, + request: Optional[Union[service.ListCryptoKeyVersionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCryptoKeyVersionsAsyncPager: r"""Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. @@ -531,7 +542,7 @@ async def sample_list_crypto_key_versions(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ListCryptoKeyVersionsRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ListCryptoKeyVersionsRequest, dict]]): The request object. Request message for [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. parent (:class:`str`): @@ -621,11 +632,11 @@ async def sample_list_crypto_key_versions(): async def list_import_jobs( self, - request: Union[service.ListImportJobsRequest, dict] = None, + request: Optional[Union[service.ListImportJobsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListImportJobsAsyncPager: r"""Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. @@ -658,7 +669,7 @@ async def sample_list_import_jobs(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ListImportJobsRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ListImportJobsRequest, dict]]): The request object. Request message for [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. parent (:class:`str`): @@ -747,11 +758,11 @@ async def sample_list_import_jobs(): async def get_key_ring( self, - request: Union[service.GetKeyRingRequest, dict] = None, + request: Optional[Union[service.GetKeyRingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.KeyRing: r"""Returns metadata for a given @@ -784,7 +795,7 @@ async def sample_get_key_ring(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetKeyRingRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetKeyRingRequest, dict]]): The request object. Request message for [KeyManagementService.GetKeyRing][google.cloud.kms.v1.KeyManagementService.GetKeyRing]. name (:class:`str`): @@ -860,11 +871,11 @@ async def sample_get_key_ring(): async def get_crypto_key( self, - request: Union[service.GetCryptoKeyRequest, dict] = None, + request: Optional[Union[service.GetCryptoKeyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Returns metadata for a given @@ -899,7 +910,7 @@ async def sample_get_crypto_key(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetCryptoKeyRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetCryptoKeyRequest, dict]]): The request object. Request message for [KeyManagementService.GetCryptoKey][google.cloud.kms.v1.KeyManagementService.GetCryptoKey]. name (:class:`str`): @@ -982,11 +993,11 @@ async def sample_get_crypto_key(): async def get_crypto_key_version( self, - request: Union[service.GetCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.GetCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Returns metadata for a given @@ -1019,7 +1030,7 @@ async def sample_get_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.GetCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.GetCryptoKeyVersion]. name (:class:`str`): @@ -1109,11 +1120,11 @@ async def sample_get_crypto_key_version(): async def get_public_key( self, - request: Union[service.GetPublicKeyRequest, dict] = None, + request: Optional[Union[service.GetPublicKeyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PublicKey: r"""Returns the public key for the given @@ -1151,7 +1162,7 @@ async def sample_get_public_key(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetPublicKeyRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetPublicKeyRequest, dict]]): The request object. Request message for [KeyManagementService.GetPublicKey][google.cloud.kms.v1.KeyManagementService.GetPublicKey]. name (:class:`str`): @@ -1231,11 +1242,11 @@ async def sample_get_public_key(): async def get_import_job( self, - request: Union[service.GetImportJobRequest, dict] = None, + request: Optional[Union[service.GetImportJobRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ImportJob: r"""Returns metadata for a given @@ -1268,7 +1279,7 @@ async def sample_get_import_job(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GetImportJobRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GetImportJobRequest, dict]]): The request object. Request message for [KeyManagementService.GetImportJob][google.cloud.kms.v1.KeyManagementService.GetImportJob]. name (:class:`str`): @@ -1389,13 +1400,13 @@ async def sample_get_import_job(): async def create_key_ring( self, - request: Union[service.CreateKeyRingRequest, dict] = None, + request: Optional[Union[service.CreateKeyRingRequest, dict]] = None, *, - parent: str = None, - key_ring_id: str = None, - key_ring: resources.KeyRing = None, + parent: Optional[str] = None, + key_ring_id: Optional[str] = None, + key_ring: Optional[resources.KeyRing] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.KeyRing: r"""Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given @@ -1429,7 +1440,7 @@ async def sample_create_key_ring(): print(response) Args: - request (Union[google.cloud.kms_v1.types.CreateKeyRingRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.CreateKeyRingRequest, dict]]): The request object. Request message for [KeyManagementService.CreateKeyRing][google.cloud.kms.v1.KeyManagementService.CreateKeyRing]. parent (:class:`str`): @@ -1524,13 +1535,13 @@ async def sample_create_key_ring(): async def create_crypto_key( self, - request: Union[service.CreateCryptoKeyRequest, dict] = None, + request: Optional[Union[service.CreateCryptoKeyRequest, dict]] = None, *, - parent: str = None, - crypto_key_id: str = None, - crypto_key: resources.CryptoKey = None, + parent: Optional[str] = None, + crypto_key_id: Optional[str] = None, + crypto_key: Optional[resources.CryptoKey] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a @@ -1568,7 +1579,7 @@ async def sample_create_crypto_key(): print(response) Args: - request (Union[google.cloud.kms_v1.types.CreateCryptoKeyRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.CreateCryptoKeyRequest, dict]]): The request object. Request message for [KeyManagementService.CreateCryptoKey][google.cloud.kms.v1.KeyManagementService.CreateCryptoKey]. parent (:class:`str`): @@ -1669,12 +1680,12 @@ async def sample_create_crypto_key(): async def create_crypto_key_version( self, - request: Union[service.CreateCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.CreateCryptoKeyVersionRequest, dict]] = None, *, - parent: str = None, - crypto_key_version: resources.CryptoKeyVersion = None, + parent: Optional[str] = None, + crypto_key_version: Optional[resources.CryptoKeyVersion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Create a new @@ -1713,7 +1724,7 @@ async def sample_create_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.CreateCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.CreateCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion]. parent (:class:`str`): @@ -1803,10 +1814,10 @@ async def sample_create_crypto_key_version(): async def import_crypto_key_version( self, - request: Union[service.ImportCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.ImportCryptoKeyVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Import wrapped key material into a @@ -1850,7 +1861,7 @@ async def sample_import_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.ImportCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.ImportCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.ImportCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.ImportCryptoKeyVersion]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1907,13 +1918,13 @@ async def sample_import_crypto_key_version(): async def create_import_job( self, - request: Union[service.CreateImportJobRequest, dict] = None, + request: Optional[Union[service.CreateImportJobRequest, dict]] = None, *, - parent: str = None, - import_job_id: str = None, - import_job: resources.ImportJob = None, + parent: Optional[str] = None, + import_job_id: Optional[str] = None, + import_job: Optional[resources.ImportJob] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ImportJob: r"""Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a @@ -1939,7 +1950,7 @@ async def sample_create_import_job(): # Initialize request argument(s) import_job = kms_v1.ImportJob() - import_job.import_method = "RSA_OAEP_4096_SHA1_AES_256" + import_job.import_method = "RSA_OAEP_4096_SHA256" import_job.protection_level = "EXTERNAL_VPC" request = kms_v1.CreateImportJobRequest( @@ -1955,7 +1966,7 @@ async def sample_create_import_job(): print(response) Args: - request (Union[google.cloud.kms_v1.types.CreateImportJobRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.CreateImportJobRequest, dict]]): The request object. Request message for [KeyManagementService.CreateImportJob][google.cloud.kms.v1.KeyManagementService.CreateImportJob]. parent (:class:`str`): @@ -2094,12 +2105,12 @@ async def sample_create_import_job(): async def update_crypto_key( self, - request: Union[service.UpdateCryptoKeyRequest, dict] = None, + request: Optional[Union[service.UpdateCryptoKeyRequest, dict]] = None, *, - crypto_key: resources.CryptoKey = None, - update_mask: field_mask_pb2.FieldMask = None, + crypto_key: Optional[resources.CryptoKey] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. @@ -2130,7 +2141,7 @@ async def sample_update_crypto_key(): print(response) Args: - request (Union[google.cloud.kms_v1.types.UpdateCryptoKeyRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.UpdateCryptoKeyRequest, dict]]): The request object. Request message for [KeyManagementService.UpdateCryptoKey][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKey]. crypto_key (:class:`google.cloud.kms_v1.types.CryptoKey`): @@ -2223,12 +2234,12 @@ async def sample_update_crypto_key(): async def update_crypto_key_version( self, - request: Union[service.UpdateCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.UpdateCryptoKeyVersionRequest, dict]] = None, *, - crypto_key_version: resources.CryptoKeyVersion = None, - update_mask: field_mask_pb2.FieldMask = None, + crypto_key_version: Optional[resources.CryptoKeyVersion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Update a @@ -2272,7 +2283,7 @@ async def sample_update_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.UpdateCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.UpdateCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.UpdateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyVersion]. crypto_key_version (:class:`google.cloud.kms_v1.types.CryptoKeyVersion`): @@ -2372,12 +2383,14 @@ async def sample_update_crypto_key_version(): async def update_crypto_key_primary_version( self, - request: Union[service.UpdateCryptoKeyPrimaryVersionRequest, dict] = None, + request: Optional[ + Union[service.UpdateCryptoKeyPrimaryVersionRequest, dict] + ] = None, *, - name: str = None, - crypto_key_version_id: str = None, + name: Optional[str] = None, + crypto_key_version_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Update the version of a @@ -2415,7 +2428,7 @@ async def sample_update_crypto_key_primary_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.UpdateCryptoKeyPrimaryVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.UpdateCryptoKeyPrimaryVersionRequest, dict]]): The request object. Request message for [KeyManagementService.UpdateCryptoKeyPrimaryVersion][google.cloud.kms.v1.KeyManagementService.UpdateCryptoKeyPrimaryVersion]. name (:class:`str`): @@ -2507,11 +2520,11 @@ async def sample_update_crypto_key_primary_version(): async def destroy_crypto_key_version( self, - request: Union[service.DestroyCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.DestroyCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Schedule a @@ -2565,7 +2578,7 @@ async def sample_destroy_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.DestroyCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.DestroyCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.DestroyCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.DestroyCryptoKeyVersion]. name (:class:`str`): @@ -2654,11 +2667,11 @@ async def sample_destroy_crypto_key_version(): async def restore_crypto_key_version( self, - request: Union[service.RestoreCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.RestoreCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Restore a @@ -2701,7 +2714,7 @@ async def sample_restore_crypto_key_version(): print(response) Args: - request (Union[google.cloud.kms_v1.types.RestoreCryptoKeyVersionRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.RestoreCryptoKeyVersionRequest, dict]]): The request object. Request message for [KeyManagementService.RestoreCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.RestoreCryptoKeyVersion]. name (:class:`str`): @@ -2790,12 +2803,12 @@ async def sample_restore_crypto_key_version(): async def encrypt( self, - request: Union[service.EncryptRequest, dict] = None, + request: Optional[Union[service.EncryptRequest, dict]] = None, *, - name: str = None, - plaintext: bytes = None, + name: Optional[str] = None, + plaintext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.EncryptResponse: r"""Encrypts data, so that it can only be recovered by a call to @@ -2832,7 +2845,7 @@ async def sample_encrypt(): print(response) Args: - request (Union[google.cloud.kms_v1.types.EncryptRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.EncryptRequest, dict]]): The request object. Request message for [KeyManagementService.Encrypt][google.cloud.kms.v1.KeyManagementService.Encrypt]. name (:class:`str`): @@ -2855,7 +2868,10 @@ async def sample_encrypt(): The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] + [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], + and + [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and @@ -2933,12 +2949,12 @@ async def sample_encrypt(): async def decrypt( self, - request: Union[service.DecryptRequest, dict] = None, + request: Optional[Union[service.DecryptRequest, dict]] = None, *, - name: str = None, - ciphertext: bytes = None, + name: Optional[str] = None, + ciphertext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.DecryptResponse: r"""Decrypts data that was protected by @@ -2975,7 +2991,7 @@ async def sample_decrypt(): print(response) Args: - request (Union[google.cloud.kms_v1.types.DecryptRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.DecryptRequest, dict]]): The request object. Request message for [KeyManagementService.Decrypt][google.cloud.kms.v1.KeyManagementService.Decrypt]. name (:class:`str`): @@ -3062,12 +3078,12 @@ async def sample_decrypt(): async def asymmetric_sign( self, - request: Union[service.AsymmetricSignRequest, dict] = None, + request: Optional[Union[service.AsymmetricSignRequest, dict]] = None, *, - name: str = None, - digest: service.Digest = None, + name: Optional[str] = None, + digest: Optional[service.Digest] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.AsymmetricSignResponse: r"""Signs data using a @@ -3104,7 +3120,7 @@ async def sample_asymmetric_sign(): print(response) Args: - request (Union[google.cloud.kms_v1.types.AsymmetricSignRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.AsymmetricSignRequest, dict]]): The request object. Request message for [KeyManagementService.AsymmetricSign][google.cloud.kms.v1.KeyManagementService.AsymmetricSign]. name (:class:`str`): @@ -3196,12 +3212,12 @@ async def sample_asymmetric_sign(): async def asymmetric_decrypt( self, - request: Union[service.AsymmetricDecryptRequest, dict] = None, + request: Optional[Union[service.AsymmetricDecryptRequest, dict]] = None, *, - name: str = None, - ciphertext: bytes = None, + name: Optional[str] = None, + ciphertext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.AsymmetricDecryptResponse: r"""Decrypts data that was encrypted with a public key retrieved @@ -3240,7 +3256,7 @@ async def sample_asymmetric_decrypt(): print(response) Args: - request (Union[google.cloud.kms_v1.types.AsymmetricDecryptRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.AsymmetricDecryptRequest, dict]]): The request object. Request message for [KeyManagementService.AsymmetricDecrypt][google.cloud.kms.v1.KeyManagementService.AsymmetricDecrypt]. name (:class:`str`): @@ -3327,12 +3343,12 @@ async def sample_asymmetric_decrypt(): async def mac_sign( self, - request: Union[service.MacSignRequest, dict] = None, + request: Optional[Union[service.MacSignRequest, dict]] = None, *, - name: str = None, - data: bytes = None, + name: Optional[str] = None, + data: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.MacSignResponse: r"""Signs data using a @@ -3369,7 +3385,7 @@ async def sample_mac_sign(): print(response) Args: - request (Union[google.cloud.kms_v1.types.MacSignRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.MacSignRequest, dict]]): The request object. Request message for [KeyManagementService.MacSign][google.cloud.kms.v1.KeyManagementService.MacSign]. name (:class:`str`): @@ -3456,13 +3472,13 @@ async def sample_mac_sign(): async def mac_verify( self, - request: Union[service.MacVerifyRequest, dict] = None, + request: Optional[Union[service.MacVerifyRequest, dict]] = None, *, - name: str = None, - data: bytes = None, - mac: bytes = None, + name: Optional[str] = None, + data: Optional[bytes] = None, + mac: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.MacVerifyResponse: r"""Verifies MAC tag using a @@ -3500,7 +3516,7 @@ async def sample_mac_verify(): print(response) Args: - request (Union[google.cloud.kms_v1.types.MacVerifyRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.MacVerifyRequest, dict]]): The request object. Request message for [KeyManagementService.MacVerify][google.cloud.kms.v1.KeyManagementService.MacVerify]. name (:class:`str`): @@ -3594,13 +3610,13 @@ async def sample_mac_verify(): async def generate_random_bytes( self, - request: Union[service.GenerateRandomBytesRequest, dict] = None, + request: Optional[Union[service.GenerateRandomBytesRequest, dict]] = None, *, - location: str = None, - length_bytes: int = None, - protection_level: resources.ProtectionLevel = None, + location: Optional[str] = None, + length_bytes: Optional[int] = None, + protection_level: Optional[resources.ProtectionLevel] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.GenerateRandomBytesResponse: r"""Generate random bytes using the Cloud KMS randomness @@ -3632,7 +3648,7 @@ async def sample_generate_random_bytes(): print(response) Args: - request (Union[google.cloud.kms_v1.types.GenerateRandomBytesRequest, dict]): + request (Optional[Union[google.cloud.kms_v1.types.GenerateRandomBytesRequest, dict]]): The request object. Request message for [KeyManagementService.GenerateRandomBytes][google.cloud.kms.v1.KeyManagementService.GenerateRandomBytes]. location (:class:`str`): @@ -3732,10 +3748,10 @@ async def sample_generate_random_bytes(): async def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3851,10 +3867,10 @@ async def set_iam_policy( async def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -3972,10 +3988,10 @@ async def get_iam_policy( async def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified permissions against the IAM access control diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py index 8bc362bca85a..be04691fb688 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/client.py @@ -16,34 +16,46 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore +from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore -from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] except AttributeError: # pragma: NO COVER OptionalRetry = Union[retries.Retry, object] # type: ignore -from google.cloud.kms_v1.services.key_management_service import pagers -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.protobuf import duration_pb2 # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore -from .transports.base import KeyManagementServiceTransport, DEFAULT_CLIENT_INFO + +from google.cloud.kms_v1.services.key_management_service import pagers +from google.cloud.kms_v1.types import resources, service + +from .transports.base import DEFAULT_CLIENT_INFO, KeyManagementServiceTransport from .transports.grpc import KeyManagementServiceGrpcTransport from .transports.grpc_asyncio import KeyManagementServiceGrpcAsyncIOTransport @@ -64,7 +76,7 @@ class KeyManagementServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[KeyManagementServiceTransport]: """Returns an appropriate transport class. @@ -451,8 +463,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, KeyManagementServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, KeyManagementServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the key management service client. @@ -466,7 +478,7 @@ def __init__( transport (Union[str, KeyManagementServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -496,6 +508,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -548,11 +561,11 @@ def __init__( def list_key_rings( self, - request: Union[service.ListKeyRingsRequest, dict] = None, + request: Optional[Union[service.ListKeyRingsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListKeyRingsPager: r"""Lists [KeyRings][google.cloud.kms.v1.KeyRing]. @@ -664,11 +677,11 @@ def sample_list_key_rings(): def list_crypto_keys( self, - request: Union[service.ListCryptoKeysRequest, dict] = None, + request: Optional[Union[service.ListCryptoKeysRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCryptoKeysPager: r"""Lists [CryptoKeys][google.cloud.kms.v1.CryptoKey]. @@ -780,11 +793,11 @@ def sample_list_crypto_keys(): def list_crypto_key_versions( self, - request: Union[service.ListCryptoKeyVersionsRequest, dict] = None, + request: Optional[Union[service.ListCryptoKeyVersionsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListCryptoKeyVersionsPager: r"""Lists [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. @@ -897,11 +910,11 @@ def sample_list_crypto_key_versions(): def list_import_jobs( self, - request: Union[service.ListImportJobsRequest, dict] = None, + request: Optional[Union[service.ListImportJobsRequest, dict]] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListImportJobsPager: r"""Lists [ImportJobs][google.cloud.kms.v1.ImportJob]. @@ -1013,11 +1026,11 @@ def sample_list_import_jobs(): def get_key_ring( self, - request: Union[service.GetKeyRingRequest, dict] = None, + request: Optional[Union[service.GetKeyRingRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.KeyRing: r"""Returns metadata for a given @@ -1116,11 +1129,11 @@ def sample_get_key_ring(): def get_crypto_key( self, - request: Union[service.GetCryptoKeyRequest, dict] = None, + request: Optional[Union[service.GetCryptoKeyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Returns metadata for a given @@ -1228,11 +1241,11 @@ def sample_get_crypto_key(): def get_crypto_key_version( self, - request: Union[service.GetCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.GetCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Returns metadata for a given @@ -1345,11 +1358,11 @@ def sample_get_crypto_key_version(): def get_public_key( self, - request: Union[service.GetPublicKeyRequest, dict] = None, + request: Optional[Union[service.GetPublicKeyRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.PublicKey: r"""Returns the public key for the given @@ -1457,11 +1470,11 @@ def sample_get_public_key(): def get_import_job( self, - request: Union[service.GetImportJobRequest, dict] = None, + request: Optional[Union[service.GetImportJobRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ImportJob: r"""Returns metadata for a given @@ -1605,13 +1618,13 @@ def sample_get_import_job(): def create_key_ring( self, - request: Union[service.CreateKeyRingRequest, dict] = None, + request: Optional[Union[service.CreateKeyRingRequest, dict]] = None, *, - parent: str = None, - key_ring_id: str = None, - key_ring: resources.KeyRing = None, + parent: Optional[str] = None, + key_ring_id: Optional[str] = None, + key_ring: Optional[resources.KeyRing] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.KeyRing: r"""Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given @@ -1730,13 +1743,13 @@ def sample_create_key_ring(): def create_crypto_key( self, - request: Union[service.CreateCryptoKeyRequest, dict] = None, + request: Optional[Union[service.CreateCryptoKeyRequest, dict]] = None, *, - parent: str = None, - crypto_key_id: str = None, - crypto_key: resources.CryptoKey = None, + parent: Optional[str] = None, + crypto_key_id: Optional[str] = None, + crypto_key: Optional[resources.CryptoKey] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Create a new [CryptoKey][google.cloud.kms.v1.CryptoKey] within a @@ -1865,12 +1878,12 @@ def sample_create_crypto_key(): def create_crypto_key_version( self, - request: Union[service.CreateCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.CreateCryptoKeyVersionRequest, dict]] = None, *, - parent: str = None, - crypto_key_version: resources.CryptoKeyVersion = None, + parent: Optional[str] = None, + crypto_key_version: Optional[resources.CryptoKeyVersion] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Create a new @@ -2001,10 +2014,10 @@ def sample_create_crypto_key_version(): def import_crypto_key_version( self, - request: Union[service.ImportCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.ImportCryptoKeyVersionRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Import wrapped key material into a @@ -2108,13 +2121,13 @@ def sample_import_crypto_key_version(): def create_import_job( self, - request: Union[service.CreateImportJobRequest, dict] = None, + request: Optional[Union[service.CreateImportJobRequest, dict]] = None, *, - parent: str = None, - import_job_id: str = None, - import_job: resources.ImportJob = None, + parent: Optional[str] = None, + import_job_id: Optional[str] = None, + import_job: Optional[resources.ImportJob] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.ImportJob: r"""Create a new [ImportJob][google.cloud.kms.v1.ImportJob] within a @@ -2140,7 +2153,7 @@ def sample_create_import_job(): # Initialize request argument(s) import_job = kms_v1.ImportJob() - import_job.import_method = "RSA_OAEP_4096_SHA1_AES_256" + import_job.import_method = "RSA_OAEP_4096_SHA256" import_job.protection_level = "EXTERNAL_VPC" request = kms_v1.CreateImportJobRequest( @@ -2285,12 +2298,12 @@ def sample_create_import_job(): def update_crypto_key( self, - request: Union[service.UpdateCryptoKeyRequest, dict] = None, + request: Optional[Union[service.UpdateCryptoKeyRequest, dict]] = None, *, - crypto_key: resources.CryptoKey = None, - update_mask: field_mask_pb2.FieldMask = None, + crypto_key: Optional[resources.CryptoKey] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Update a [CryptoKey][google.cloud.kms.v1.CryptoKey]. @@ -2404,12 +2417,12 @@ def sample_update_crypto_key(): def update_crypto_key_version( self, - request: Union[service.UpdateCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.UpdateCryptoKeyVersionRequest, dict]] = None, *, - crypto_key_version: resources.CryptoKeyVersion = None, - update_mask: field_mask_pb2.FieldMask = None, + crypto_key_version: Optional[resources.CryptoKeyVersion] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Update a @@ -2545,12 +2558,14 @@ def sample_update_crypto_key_version(): def update_crypto_key_primary_version( self, - request: Union[service.UpdateCryptoKeyPrimaryVersionRequest, dict] = None, + request: Optional[ + Union[service.UpdateCryptoKeyPrimaryVersionRequest, dict] + ] = None, *, - name: str = None, - crypto_key_version_id: str = None, + name: Optional[str] = None, + crypto_key_version_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKey: r"""Update the version of a @@ -2672,11 +2687,11 @@ def sample_update_crypto_key_primary_version(): def destroy_crypto_key_version( self, - request: Union[service.DestroyCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.DestroyCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Schedule a @@ -2811,11 +2826,11 @@ def sample_destroy_crypto_key_version(): def restore_crypto_key_version( self, - request: Union[service.RestoreCryptoKeyVersionRequest, dict] = None, + request: Optional[Union[service.RestoreCryptoKeyVersionRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> resources.CryptoKeyVersion: r"""Restore a @@ -2939,12 +2954,12 @@ def sample_restore_crypto_key_version(): def encrypt( self, - request: Union[service.EncryptRequest, dict] = None, + request: Optional[Union[service.EncryptRequest, dict]] = None, *, - name: str = None, - plaintext: bytes = None, + name: Optional[str] = None, + plaintext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.EncryptResponse: r"""Encrypts data, so that it can only be recovered by a call to @@ -3004,7 +3019,10 @@ def sample_encrypt(): The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. For - [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] + [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], + and + [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and @@ -3072,12 +3090,12 @@ def sample_encrypt(): def decrypt( self, - request: Union[service.DecryptRequest, dict] = None, + request: Optional[Union[service.DecryptRequest, dict]] = None, *, - name: str = None, - ciphertext: bytes = None, + name: Optional[str] = None, + ciphertext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.DecryptResponse: r"""Decrypts data that was protected by @@ -3191,12 +3209,12 @@ def sample_decrypt(): def asymmetric_sign( self, - request: Union[service.AsymmetricSignRequest, dict] = None, + request: Optional[Union[service.AsymmetricSignRequest, dict]] = None, *, - name: str = None, - digest: service.Digest = None, + name: Optional[str] = None, + digest: Optional[service.Digest] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.AsymmetricSignResponse: r"""Signs data using a @@ -3315,12 +3333,12 @@ def sample_asymmetric_sign(): def asymmetric_decrypt( self, - request: Union[service.AsymmetricDecryptRequest, dict] = None, + request: Optional[Union[service.AsymmetricDecryptRequest, dict]] = None, *, - name: str = None, - ciphertext: bytes = None, + name: Optional[str] = None, + ciphertext: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.AsymmetricDecryptResponse: r"""Decrypts data that was encrypted with a public key retrieved @@ -3436,12 +3454,12 @@ def sample_asymmetric_decrypt(): def mac_sign( self, - request: Union[service.MacSignRequest, dict] = None, + request: Optional[Union[service.MacSignRequest, dict]] = None, *, - name: str = None, - data: bytes = None, + name: Optional[str] = None, + data: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.MacSignResponse: r"""Signs data using a @@ -3555,13 +3573,13 @@ def sample_mac_sign(): def mac_verify( self, - request: Union[service.MacVerifyRequest, dict] = None, + request: Optional[Union[service.MacVerifyRequest, dict]] = None, *, - name: str = None, - data: bytes = None, - mac: bytes = None, + name: Optional[str] = None, + data: Optional[bytes] = None, + mac: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.MacVerifyResponse: r"""Verifies MAC tag using a @@ -3683,13 +3701,13 @@ def sample_mac_verify(): def generate_random_bytes( self, - request: Union[service.GenerateRandomBytesRequest, dict] = None, + request: Optional[Union[service.GenerateRandomBytesRequest, dict]] = None, *, - location: str = None, - length_bytes: int = None, - protection_level: resources.ProtectionLevel = None, + location: Optional[str] = None, + length_bytes: Optional[int] = None, + protection_level: Optional[resources.ProtectionLevel] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> service.GenerateRandomBytesResponse: r"""Generate random bytes using the Cloud KMS randomness @@ -3824,10 +3842,10 @@ def __exit__(self, type, value, traceback): def set_iam_policy( self, - request: iam_policy_pb2.SetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.SetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Sets the IAM access control policy on the specified function. @@ -3944,10 +3962,10 @@ def set_iam_policy( def get_iam_policy( self, - request: iam_policy_pb2.GetIamPolicyRequest = None, + request: Optional[iam_policy_pb2.GetIamPolicyRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> policy_pb2.Policy: r"""Gets the IAM access control policy for a function. @@ -4065,10 +4083,10 @@ def get_iam_policy( def test_iam_permissions( self, - request: iam_policy_pb2.TestIamPermissionsRequest = None, + request: Optional[iam_policy_pb2.TestIamPermissionsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Tests the specified IAM permissions against the IAM access control diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/pagers.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/pagers.py index 6cf46b240a64..abc9c563a217 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/pagers.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/pagers.py @@ -18,14 +18,13 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service +from google.cloud.kms_v1.types import resources, service class ListKeyRingsPager: diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/__init__.py index 617a1f356ed2..46fb60193b58 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import KeyManagementServiceGrpcTransport from .grpc_asyncio import KeyManagementServiceGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = ( OrderedDict() diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py index 3208387be01c..ec29d8e0bb89 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/base.py @@ -15,20 +15,19 @@ # import abc from typing import Awaitable, Callable, Dict, Optional, Sequence, Union -import pkg_resources -import google.auth # type: ignore import google.api_core from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 from google.api_core import retry as retries +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore -from google.oauth2 import service_account # type: ignore - -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore +from google.oauth2 import service_account # type: ignore +import pkg_resources + +from google.cloud.kms_v1.types import resources, service try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -54,7 +53,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py index 65b1af097a85..a03566d18635 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc.py @@ -13,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import grpc_helpers -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - -import grpc # type: ignore - -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore -from .base import KeyManagementServiceTransport, DEFAULT_CLIENT_INFO +import grpc # type: ignore + +from google.cloud.kms_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, KeyManagementServiceTransport class KeyManagementServiceGrpcTransport(KeyManagementServiceTransport): @@ -61,14 +59,14 @@ def __init__( self, *, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -195,8 +193,8 @@ def __init__( def create_channel( cls, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py index b863dea963a0..da343d08c3be 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/services/key_management_service/transports/grpc_asyncio.py @@ -13,22 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union +import warnings -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers_async +from google.api_core import gapic_v1, grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.iam.v1 import iam_policy_pb2 # type: ignore +from google.iam.v1 import policy_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service -from google.iam.v1 import iam_policy_pb2 # type: ignore -from google.iam.v1 import policy_pb2 # type: ignore -from .base import KeyManagementServiceTransport, DEFAULT_CLIENT_INFO +from google.cloud.kms_v1.types import resources, service + +from .base import DEFAULT_CLIENT_INFO, KeyManagementServiceTransport from .grpc import KeyManagementServiceGrpcTransport @@ -63,7 +61,7 @@ class KeyManagementServiceGrpcAsyncIOTransport(KeyManagementServiceTransport): def create_channel( cls, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -106,15 +104,15 @@ def __init__( self, *, host: str = "cloudkms.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/__init__.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/__init__.py index e24ce649317b..a634be019b63 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/__init__.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/__init__.py @@ -30,8 +30,8 @@ ImportJob, KeyOperationAttestation, KeyRing, - PublicKey, ProtectionLevel, + PublicKey, ) from .service import ( AsymmetricDecryptRequest, diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py index 5215c8b459c0..7e7b3ac1baac 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/ekm_service.py @@ -13,11 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.kms.v1", @@ -34,7 +34,8 @@ class ListEkmConnectionsRequest(proto.Message): - r"""Request message for [KeyManagementService.ListEkmConnections][]. + r"""Request message for + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. Attributes: parent (str): @@ -65,33 +66,34 @@ class ListEkmConnectionsRequest(proto.Message): results `__. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=5, ) class ListEkmConnectionsResponse(proto.Message): - r"""Response message for [KeyManagementService.ListEkmConnections][]. + r"""Response message for + [EkmService.ListEkmConnections][google.cloud.kms.v1.EkmService.ListEkmConnections]. Attributes: - ekm_connections (Sequence[google.cloud.kms_v1.types.EkmConnection]): + ekm_connections (MutableSequence[google.cloud.kms_v1.types.EkmConnection]): The list of [EkmConnections][google.cloud.kms.v1.EkmConnection]. next_page_token (str): @@ -108,23 +110,24 @@ class ListEkmConnectionsResponse(proto.Message): def raw_page(self): return self - ekm_connections = proto.RepeatedField( + ekm_connections: MutableSequence["EkmConnection"] = proto.RepeatedField( proto.MESSAGE, number=1, message="EkmConnection", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - total_size = proto.Field( + total_size: int = proto.Field( proto.INT32, number=3, ) class GetEkmConnectionRequest(proto.Message): - r"""Request message for [KeyManagementService.GetEkmConnection][]. + r"""Request message for + [EkmService.GetEkmConnection][google.cloud.kms.v1.EkmService.GetEkmConnection]. Attributes: name (str): @@ -133,14 +136,15 @@ class GetEkmConnectionRequest(proto.Message): get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) class CreateEkmConnectionRequest(proto.Message): - r"""Request message for [KeyManagementService.CreateEkmConnection][]. + r"""Request message for + [EkmService.CreateEkmConnection][google.cloud.kms.v1.EkmService.CreateEkmConnection]. Attributes: parent (str): @@ -156,15 +160,15 @@ class CreateEkmConnectionRequest(proto.Message): initial field values. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - ekm_connection_id = proto.Field( + ekm_connection_id: str = proto.Field( proto.STRING, number=2, ) - ekm_connection = proto.Field( + ekm_connection: "EkmConnection" = proto.Field( proto.MESSAGE, number=3, message="EkmConnection", @@ -172,7 +176,8 @@ class CreateEkmConnectionRequest(proto.Message): class UpdateEkmConnectionRequest(proto.Message): - r"""Request message for [KeyManagementService.UpdateEkmConnection][]. + r"""Request message for + [EkmService.UpdateEkmConnection][google.cloud.kms.v1.EkmService.UpdateEkmConnection]. Attributes: ekm_connection (google.cloud.kms_v1.types.EkmConnection): @@ -183,12 +188,12 @@ class UpdateEkmConnectionRequest(proto.Message): this request. """ - ekm_connection = proto.Field( + ekm_connection: "EkmConnection" = proto.Field( proto.MESSAGE, number=1, message="EkmConnection", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -214,7 +219,7 @@ class Certificate(proto.Message): Output only. The subject distinguished name in RFC 2253 format. Only present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. - subject_alternative_dns_names (Sequence[str]): + subject_alternative_dns_names (MutableSequence[str]): Output only. The subject Alternative DNS names. Only present if [parsed][google.cloud.kms.v1.Certificate.parsed] is true. not_before_time (google.protobuf.timestamp_pb2.Timestamp): @@ -235,41 +240,41 @@ class Certificate(proto.Message): [parsed][google.cloud.kms.v1.Certificate.parsed] is true. """ - raw_der = proto.Field( + raw_der: bytes = proto.Field( proto.BYTES, number=1, ) - parsed = proto.Field( + parsed: bool = proto.Field( proto.BOOL, number=2, ) - issuer = proto.Field( + issuer: str = proto.Field( proto.STRING, number=3, ) - subject = proto.Field( + subject: str = proto.Field( proto.STRING, number=4, ) - subject_alternative_dns_names = proto.RepeatedField( + subject_alternative_dns_names: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=5, ) - not_before_time = proto.Field( + not_before_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - not_after_time = proto.Field( + not_after_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - serial_number = proto.Field( + serial_number: str = proto.Field( proto.STRING, number=8, ) - sha256_fingerprint = proto.Field( + sha256_fingerprint: str = proto.Field( proto.STRING, number=9, ) @@ -294,7 +299,7 @@ class EkmConnection(proto.Message): Output only. The time at which the [EkmConnection][google.cloud.kms.v1.EkmConnection] was created. - service_resolvers (Sequence[google.cloud.kms_v1.types.EkmConnection.ServiceResolver]): + service_resolvers (MutableSequence[google.cloud.kms_v1.types.EkmConnection.ServiceResolver]): A list of [ServiceResolvers][google.cloud.kms.v1.EkmConnection.ServiceResolver] where the EKM can be reached. There should be one @@ -302,10 +307,8 @@ class EkmConnection(proto.Message): [ServiceResolver][google.cloud.kms.v1.EkmConnection.ServiceResolver] is supported. etag (str): - This checksum is computed by the server based - on the value of other fields, and may be sent on - update requests to ensure the client has an - up-to-date value before proceeding. + Optional. Etag of the currently stored + [EkmConnection][google.cloud.kms.v1.EkmConnection]. """ class ServiceResolver(proto.Message): @@ -330,45 +333,46 @@ class ServiceResolver(proto.Message): hostname (str): Required. The hostname of the EKM replica used at TLS and HTTP layers. - server_certificates (Sequence[google.cloud.kms_v1.types.Certificate]): - Required. A list of leaf server certificates - used to authenticate HTTPS connections to the - EKM replica. + server_certificates (MutableSequence[google.cloud.kms_v1.types.Certificate]): + Required. A list of leaf server certificates used to + authenticate HTTPS connections to the EKM replica. + Currently, a maximum of 10 + [Certificate][google.cloud.kms.v1.Certificate] is supported. """ - service_directory_service = proto.Field( + service_directory_service: str = proto.Field( proto.STRING, number=1, ) - endpoint_filter = proto.Field( + endpoint_filter: str = proto.Field( proto.STRING, number=2, ) - hostname = proto.Field( + hostname: str = proto.Field( proto.STRING, number=3, ) - server_certificates = proto.RepeatedField( + server_certificates: MutableSequence["Certificate"] = proto.RepeatedField( proto.MESSAGE, number=4, message="Certificate", ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - service_resolvers = proto.RepeatedField( + service_resolvers: MutableSequence[ServiceResolver] = proto.RepeatedField( proto.MESSAGE, number=3, message=ServiceResolver, ) - etag = proto.Field( + etag: str = proto.Field( proto.STRING, number=5, ) diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py index cb81b66130fa..ce15b52705aa 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/resources.py @@ -13,12 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence from google.protobuf import duration_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( package="google.cloud.kms.v1", @@ -63,11 +63,11 @@ class KeyRing(proto.Message): [KeyRing][google.cloud.kms.v1.KeyRing] was created. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, @@ -159,7 +159,7 @@ class CryptoKey(proto.Message): instances created by either [CreateCryptoKeyVersion][google.cloud.kms.v1.KeyManagementService.CreateCryptoKeyVersion] or auto-rotation are controlled by this template. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Labels with user-defined metadata. For more information, see `Labeling Keys `__. @@ -207,56 +207,56 @@ class CryptoKeyPurpose(proto.Enum): ASYMMETRIC_DECRYPT = 6 MAC = 9 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - primary = proto.Field( + primary: "CryptoKeyVersion" = proto.Field( proto.MESSAGE, number=2, message="CryptoKeyVersion", ) - purpose = proto.Field( + purpose: CryptoKeyPurpose = proto.Field( proto.ENUM, number=3, enum=CryptoKeyPurpose, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - next_rotation_time = proto.Field( + next_rotation_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - rotation_period = proto.Field( + rotation_period: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=8, oneof="rotation_schedule", message=duration_pb2.Duration, ) - version_template = proto.Field( + version_template: "CryptoKeyVersionTemplate" = proto.Field( proto.MESSAGE, number=11, message="CryptoKeyVersionTemplate", ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=10, ) - import_only = proto.Field( + import_only: bool = proto.Field( proto.BOOL, number=13, ) - destroy_scheduled_duration = proto.Field( + destroy_scheduled_duration: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=14, message=duration_pb2.Duration, ) - crypto_key_backend = proto.Field( + crypto_key_backend: str = proto.Field( proto.STRING, number=15, ) @@ -292,12 +292,12 @@ class CryptoKeyVersionTemplate(proto.Message): [ENCRYPT_DECRYPT][google.cloud.kms.v1.CryptoKey.CryptoKeyPurpose.ENCRYPT_DECRYPT]. """ - protection_level = proto.Field( + protection_level: "ProtectionLevel" = proto.Field( proto.ENUM, number=1, enum="ProtectionLevel", ) - algorithm = proto.Field( + algorithm: "CryptoKeyVersion.CryptoKeyVersionAlgorithm" = proto.Field( proto.ENUM, number=3, enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", @@ -333,40 +333,40 @@ class CertificateChains(proto.Message): https://tools.ietf.org/html/rfc5246#section-7.4.2. Attributes: - cavium_certs (Sequence[str]): + cavium_certs (MutableSequence[str]): Cavium certificate chain corresponding to the attestation. - google_card_certs (Sequence[str]): + google_card_certs (MutableSequence[str]): Google card certificate chain corresponding to the attestation. - google_partition_certs (Sequence[str]): + google_partition_certs (MutableSequence[str]): Google partition certificate chain corresponding to the attestation. """ - cavium_certs = proto.RepeatedField( + cavium_certs: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - google_card_certs = proto.RepeatedField( + google_card_certs: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - google_partition_certs = proto.RepeatedField( + google_partition_certs: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - format = proto.Field( + format: AttestationFormat = proto.Field( proto.ENUM, number=4, enum=AttestationFormat, ) - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=5, ) - cert_chains = proto.Field( + cert_chains: CertificateChains = proto.Field( proto.MESSAGE, number=6, message=CertificateChains, @@ -537,6 +537,10 @@ class CryptoKeyVersionAlgorithm(proto.Enum): EC_SIGN_P384_SHA384 = 13 EC_SIGN_SECP256K1_SHA256 = 31 HMAC_SHA256 = 32 + HMAC_SHA1 = 33 + HMAC_SHA384 = 34 + HMAC_SHA512 = 35 + HMAC_SHA224 = 36 EXTERNAL_SYMMETRIC_ENCRYPTION = 18 class CryptoKeyVersionState(proto.Enum): @@ -565,69 +569,69 @@ class CryptoKeyVersionView(proto.Enum): CRYPTO_KEY_VERSION_VIEW_UNSPECIFIED = 0 FULL = 1 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - state = proto.Field( + state: CryptoKeyVersionState = proto.Field( proto.ENUM, number=3, enum=CryptoKeyVersionState, ) - protection_level = proto.Field( + protection_level: "ProtectionLevel" = proto.Field( proto.ENUM, number=7, enum="ProtectionLevel", ) - algorithm = proto.Field( + algorithm: CryptoKeyVersionAlgorithm = proto.Field( proto.ENUM, number=10, enum=CryptoKeyVersionAlgorithm, ) - attestation = proto.Field( + attestation: "KeyOperationAttestation" = proto.Field( proto.MESSAGE, number=8, message="KeyOperationAttestation", ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - generate_time = proto.Field( + generate_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, ) - destroy_time = proto.Field( + destroy_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - destroy_event_time = proto.Field( + destroy_event_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - import_job = proto.Field( + import_job: str = proto.Field( proto.STRING, number=14, ) - import_time = proto.Field( + import_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=15, message=timestamp_pb2.Timestamp, ) - import_failure_reason = proto.Field( + import_failure_reason: str = proto.Field( proto.STRING, number=16, ) - external_protection_level_options = proto.Field( + external_protection_level_options: "ExternalProtectionLevelOptions" = proto.Field( proto.MESSAGE, number=17, message="ExternalProtectionLevelOptions", ) - reimport_eligible = proto.Field( + reimport_eligible: bool = proto.Field( proto.BOOL, number=18, ) @@ -682,25 +686,25 @@ class PublicKey(proto.Message): public key. """ - pem = proto.Field( + pem: str = proto.Field( proto.STRING, number=1, ) - algorithm = proto.Field( + algorithm: "CryptoKeyVersion.CryptoKeyVersionAlgorithm" = proto.Field( proto.ENUM, number=2, enum="CryptoKeyVersion.CryptoKeyVersionAlgorithm", ) - pem_crc32c = proto.Field( + pem_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=4, ) - protection_level = proto.Field( + protection_level: "ProtectionLevel" = proto.Field( proto.ENUM, number=5, enum="ProtectionLevel", @@ -804,6 +808,10 @@ class ImportMethod(proto.Enum): IMPORT_METHOD_UNSPECIFIED = 0 RSA_OAEP_3072_SHA1_AES_256 = 1 RSA_OAEP_4096_SHA1_AES_256 = 2 + RSA_OAEP_3072_SHA256_AES_256 = 3 + RSA_OAEP_4096_SHA256_AES_256 = 4 + RSA_OAEP_3072_SHA256 = 5 + RSA_OAEP_4096_SHA256 = 6 class ImportJobState(proto.Enum): r"""The state of the [ImportJob][google.cloud.kms.v1.ImportJob], @@ -829,56 +837,56 @@ class WrappingPublicKey(proto.Message): (https://tools.ietf.org/html/rfc7468#section-13). """ - pem = proto.Field( + pem: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - import_method = proto.Field( + import_method: ImportMethod = proto.Field( proto.ENUM, number=2, enum=ImportMethod, ) - protection_level = proto.Field( + protection_level: "ProtectionLevel" = proto.Field( proto.ENUM, number=9, enum="ProtectionLevel", ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - generate_time = proto.Field( + generate_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - expire_time = proto.Field( + expire_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - expire_event_time = proto.Field( + expire_event_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, ) - state = proto.Field( + state: ImportJobState = proto.Field( proto.ENUM, number=6, enum=ImportJobState, ) - public_key = proto.Field( + public_key: WrappingPublicKey = proto.Field( proto.MESSAGE, number=7, message=WrappingPublicKey, ) - attestation = proto.Field( + attestation: "KeyOperationAttestation" = proto.Field( proto.MESSAGE, number=8, message="KeyOperationAttestation", @@ -907,11 +915,11 @@ class ExternalProtectionLevelOptions(proto.Message): using an [EkmConnection][google.cloud.kms.v1.EkmConnection]. """ - external_key_uri = proto.Field( + external_key_uri: str = proto.Field( proto.STRING, number=1, ) - ekm_connection_key_path = proto.Field( + ekm_connection_key_path: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py index 9a4bdb72ab46..3db9367fc586 100644 --- a/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py +++ b/packages/google-cloud-kms/google/cloud/kms_v1/types/service.py @@ -13,12 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore +from typing import MutableMapping, MutableSequence -from google.cloud.kms_v1.types import resources from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore +import proto # type: ignore +from google.cloud.kms_v1.types import resources __protobuf__ = proto.module( package="google.cloud.kms.v1", @@ -98,23 +99,23 @@ class ListKeyRingsRequest(proto.Message): results `__. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=5, ) @@ -156,28 +157,28 @@ class ListCryptoKeysRequest(proto.Message): results `__. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - version_view = proto.Field( + version_view: resources.CryptoKeyVersion.CryptoKeyVersionView = proto.Field( proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=5, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=6, ) @@ -218,28 +219,28 @@ class ListCryptoKeyVersionsRequest(proto.Message): results `__. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - view = proto.Field( + view: resources.CryptoKeyVersion.CryptoKeyVersionView = proto.Field( proto.ENUM, number=4, enum=resources.CryptoKeyVersion.CryptoKeyVersionView, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=5, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=6, ) @@ -278,23 +279,23 @@ class ListImportJobsRequest(proto.Message): results `__. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=4, ) - order_by = proto.Field( + order_by: str = proto.Field( proto.STRING, number=5, ) @@ -305,7 +306,7 @@ class ListKeyRingsResponse(proto.Message): [KeyManagementService.ListKeyRings][google.cloud.kms.v1.KeyManagementService.ListKeyRings]. Attributes: - key_rings (Sequence[google.cloud.kms_v1.types.KeyRing]): + key_rings (MutableSequence[google.cloud.kms_v1.types.KeyRing]): The list of [KeyRings][google.cloud.kms.v1.KeyRing]. next_page_token (str): A token to retrieve next page of results. Pass this value in @@ -320,16 +321,16 @@ class ListKeyRingsResponse(proto.Message): def raw_page(self): return self - key_rings = proto.RepeatedField( + key_rings: MutableSequence[resources.KeyRing] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.KeyRing, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - total_size = proto.Field( + total_size: int = proto.Field( proto.INT32, number=3, ) @@ -340,7 +341,7 @@ class ListCryptoKeysResponse(proto.Message): [KeyManagementService.ListCryptoKeys][google.cloud.kms.v1.KeyManagementService.ListCryptoKeys]. Attributes: - crypto_keys (Sequence[google.cloud.kms_v1.types.CryptoKey]): + crypto_keys (MutableSequence[google.cloud.kms_v1.types.CryptoKey]): The list of [CryptoKeys][google.cloud.kms.v1.CryptoKey]. next_page_token (str): A token to retrieve next page of results. Pass this value in @@ -356,16 +357,16 @@ class ListCryptoKeysResponse(proto.Message): def raw_page(self): return self - crypto_keys = proto.RepeatedField( + crypto_keys: MutableSequence[resources.CryptoKey] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CryptoKey, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - total_size = proto.Field( + total_size: int = proto.Field( proto.INT32, number=3, ) @@ -376,7 +377,7 @@ class ListCryptoKeyVersionsResponse(proto.Message): [KeyManagementService.ListCryptoKeyVersions][google.cloud.kms.v1.KeyManagementService.ListCryptoKeyVersions]. Attributes: - crypto_key_versions (Sequence[google.cloud.kms_v1.types.CryptoKeyVersion]): + crypto_key_versions (MutableSequence[google.cloud.kms_v1.types.CryptoKeyVersion]): The list of [CryptoKeyVersions][google.cloud.kms.v1.CryptoKeyVersion]. next_page_token (str): @@ -393,16 +394,18 @@ class ListCryptoKeyVersionsResponse(proto.Message): def raw_page(self): return self - crypto_key_versions = proto.RepeatedField( + crypto_key_versions: MutableSequence[ + resources.CryptoKeyVersion + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.CryptoKeyVersion, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - total_size = proto.Field( + total_size: int = proto.Field( proto.INT32, number=3, ) @@ -413,7 +416,7 @@ class ListImportJobsResponse(proto.Message): [KeyManagementService.ListImportJobs][google.cloud.kms.v1.KeyManagementService.ListImportJobs]. Attributes: - import_jobs (Sequence[google.cloud.kms_v1.types.ImportJob]): + import_jobs (MutableSequence[google.cloud.kms_v1.types.ImportJob]): The list of [ImportJobs][google.cloud.kms.v1.ImportJob]. next_page_token (str): A token to retrieve next page of results. Pass this value in @@ -429,16 +432,16 @@ class ListImportJobsResponse(proto.Message): def raw_page(self): return self - import_jobs = proto.RepeatedField( + import_jobs: MutableSequence[resources.ImportJob] = proto.RepeatedField( proto.MESSAGE, number=1, message=resources.ImportJob, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) - total_size = proto.Field( + total_size: int = proto.Field( proto.INT32, number=3, ) @@ -454,7 +457,7 @@ class GetKeyRingRequest(proto.Message): the [KeyRing][google.cloud.kms.v1.KeyRing] to get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -470,7 +473,7 @@ class GetCryptoKeyRequest(proto.Message): the [CryptoKey][google.cloud.kms.v1.CryptoKey] to get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -488,7 +491,7 @@ class GetCryptoKeyVersionRequest(proto.Message): get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -506,7 +509,7 @@ class GetPublicKeyRequest(proto.Message): public key to get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -522,7 +525,7 @@ class GetImportJobRequest(proto.Message): the [ImportJob][google.cloud.kms.v1.ImportJob] to get. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -545,15 +548,15 @@ class CreateKeyRingRequest(proto.Message): initial field values. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - key_ring_id = proto.Field( + key_ring_id: str = proto.Field( proto.STRING, number=2, ) - key_ring = proto.Field( + key_ring: resources.KeyRing = proto.Field( proto.MESSAGE, number=3, message=resources.KeyRing, @@ -587,20 +590,20 @@ class CreateCryptoKeyRequest(proto.Message): [CryptoKey][google.cloud.kms.v1.CryptoKey]. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - crypto_key_id = proto.Field( + crypto_key_id: str = proto.Field( proto.STRING, number=2, ) - crypto_key = proto.Field( + crypto_key: resources.CryptoKey = proto.Field( proto.MESSAGE, number=3, message=resources.CryptoKey, ) - skip_initial_version_creation = proto.Field( + skip_initial_version_creation: bool = proto.Field( proto.BOOL, number=5, ) @@ -622,11 +625,11 @@ class CreateCryptoKeyVersionRequest(proto.Message): with initial field values. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - crypto_key_version = proto.Field( + crypto_key_version: resources.CryptoKeyVersion = proto.Field( proto.MESSAGE, number=2, message=resources.CryptoKeyVersion, @@ -689,57 +692,83 @@ class ImportCryptoKeyVersionRequest(proto.Message): Required. The [name][google.cloud.kms.v1.ImportJob.name] of the [ImportJob][google.cloud.kms.v1.ImportJob] that was used to wrap this key material. - rsa_aes_wrapped_key (bytes): - Wrapped key material produced with - [RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] + wrapped_key (bytes): + Optional. The wrapped key material to import. + + Before wrapping, key material must be formatted. If + importing symmetric key material, the expected key material + format is plain bytes. If importing asymmetric key material, + the expected key material format is PKCS#8-encoded DER (the + PrivateKeyInfo structure from RFC 5208). + + When wrapping with import methods + ([RSA_OAEP_3072_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA1_AES_256] + or + [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256] + or + [RSA_OAEP_3072_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256_AES_256] or - [RSA_OAEP_4096_SHA1_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA1_AES_256]. + [RSA_OAEP_4096_SHA256_AES_256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256_AES_256]), - This field contains the concatenation of two wrapped keys: + this field must contain the concatenation of: .. raw:: html
  1. An ephemeral AES-256 wrapping key wrapped with the [public_key][google.cloud.kms.v1.ImportJob.public_key] using - RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an - empty label. + RSAES-OAEP with SHA-1/SHA-256, MGF1 with SHA-1/SHA-256, and an empty + label.
  2. -
  3. The key to be imported, wrapped with the ephemeral AES-256 key - using AES-KWP (RFC 5649). +
  4. The formatted key to be imported, wrapped with the ephemeral AES-256 + key using AES-KWP (RFC 5649).
- If importing symmetric key material, it is expected that the - unwrapped key contains plain bytes. If importing asymmetric - key material, it is expected that the unwrapped key is in - PKCS#8-encoded DER format (the PrivateKeyInfo structure from - RFC 5208). - This format is the same as the format produced by PKCS#11 mechanism CKM_RSA_AES_KEY_WRAP. + When wrapping with import methods + ([RSA_OAEP_3072_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_3072_SHA256] + or + [RSA_OAEP_4096_SHA256][google.cloud.kms.v1.ImportJob.ImportMethod.RSA_OAEP_4096_SHA256]), + + this field must contain the formatted key to be imported, + wrapped with the + [public_key][google.cloud.kms.v1.ImportJob.public_key] using + RSAES-OAEP with SHA-256, MGF1 with SHA-256, and an empty + label. + rsa_aes_wrapped_key (bytes): + Optional. This field has the same meaning as + [wrapped_key][google.cloud.kms.v1.ImportCryptoKeyVersionRequest.wrapped_key]. + Prefer to use that field in new work. Either that field or + this field (but not both) must be specified. + This field is a member of `oneof`_ ``wrapped_key_material``. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - crypto_key_version = proto.Field( + crypto_key_version: str = proto.Field( proto.STRING, number=6, ) - algorithm = proto.Field( + algorithm: resources.CryptoKeyVersion.CryptoKeyVersionAlgorithm = proto.Field( proto.ENUM, number=2, enum=resources.CryptoKeyVersion.CryptoKeyVersionAlgorithm, ) - import_job = proto.Field( + import_job: str = proto.Field( proto.STRING, number=4, ) - rsa_aes_wrapped_key = proto.Field( + wrapped_key: bytes = proto.Field( + proto.BYTES, + number=8, + ) + rsa_aes_wrapped_key: bytes = proto.Field( proto.BYTES, number=5, oneof="wrapped_key_material", @@ -763,15 +792,15 @@ class CreateImportJobRequest(proto.Message): initial field values. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - import_job_id = proto.Field( + import_job_id: str = proto.Field( proto.STRING, number=2, ) - import_job = proto.Field( + import_job: resources.ImportJob = proto.Field( proto.MESSAGE, number=3, message=resources.ImportJob, @@ -791,12 +820,12 @@ class UpdateCryptoKeyRequest(proto.Message): this request. """ - crypto_key = proto.Field( + crypto_key: resources.CryptoKey = proto.Field( proto.MESSAGE, number=1, message=resources.CryptoKey, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -817,12 +846,12 @@ class UpdateCryptoKeyVersionRequest(proto.Message): this request. """ - crypto_key_version = proto.Field( + crypto_key_version: resources.CryptoKeyVersion = proto.Field( proto.MESSAGE, number=1, message=resources.CryptoKeyVersion, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -843,11 +872,11 @@ class UpdateCryptoKeyPrimaryVersionRequest(proto.Message): use as primary. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - crypto_key_version_id = proto.Field( + crypto_key_version_id: str = proto.Field( proto.STRING, number=2, ) @@ -864,7 +893,7 @@ class DestroyCryptoKeyVersionRequest(proto.Message): destroy. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -881,7 +910,7 @@ class RestoreCryptoKeyVersionRequest(proto.Message): restore. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -906,7 +935,11 @@ class EncryptRequest(proto.Message): The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] + For + [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], + and + [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] keys, the plaintext must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and @@ -919,8 +952,12 @@ class EncryptRequest(proto.Message): The maximum size depends on the key version's [protection_level][google.cloud.kms.v1.CryptoKeyVersionTemplate.protection_level]. - For [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE] - keys, the AAD must be no larger than 64KiB. For + For + [SOFTWARE][google.cloud.kms.v1.ProtectionLevel.SOFTWARE], + [EXTERNAL][google.cloud.kms.v1.ProtectionLevel.EXTERNAL], + and + [EXTERNAL_VPC][google.cloud.kms.v1.ProtectionLevel.EXTERNAL_VPC] + keys the AAD must be no larger than 64KiB. For [HSM][google.cloud.kms.v1.ProtectionLevel.HSM] keys, the combined length of the plaintext and additional_authenticated_data fields must be no larger than @@ -969,24 +1006,24 @@ class EncryptRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - plaintext = proto.Field( + plaintext: bytes = proto.Field( proto.BYTES, number=2, ) - additional_authenticated_data = proto.Field( + additional_authenticated_data: bytes = proto.Field( proto.BYTES, number=3, ) - plaintext_crc32c = proto.Field( + plaintext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=7, message=wrappers_pb2.Int64Value, ) - additional_authenticated_data_crc32c = proto.Field( + additional_authenticated_data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=8, message=wrappers_pb2.Int64Value, @@ -1053,24 +1090,24 @@ class DecryptRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - ciphertext = proto.Field( + ciphertext: bytes = proto.Field( proto.BYTES, number=2, ) - additional_authenticated_data = proto.Field( + additional_authenticated_data: bytes = proto.Field( proto.BYTES, number=3, ) - ciphertext_crc32c = proto.Field( + ciphertext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=5, message=wrappers_pb2.Int64Value, ) - additional_authenticated_data_crc32c = proto.Field( + additional_authenticated_data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=6, message=wrappers_pb2.Int64Value, @@ -1143,25 +1180,25 @@ class AsymmetricSignRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - digest = proto.Field( + digest: "Digest" = proto.Field( proto.MESSAGE, number=3, message="Digest", ) - digest_crc32c = proto.Field( + digest_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=6, ) - data_crc32c = proto.Field( + data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=7, message=wrappers_pb2.Int64Value, @@ -1204,15 +1241,15 @@ class AsymmetricDecryptRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - ciphertext = proto.Field( + ciphertext: bytes = proto.Field( proto.BYTES, number=3, ) - ciphertext_crc32c = proto.Field( + ciphertext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, @@ -1255,15 +1292,15 @@ class MacSignRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=2, ) - data_crc32c = proto.Field( + data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value, @@ -1328,24 +1365,24 @@ class MacVerifyRequest(proto.Message): languages that support this type. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=2, ) - data_crc32c = proto.Field( + data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value, ) - mac = proto.Field( + mac: bytes = proto.Field( proto.BYTES, number=4, ) - mac_crc32c = proto.Field( + mac_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=5, message=wrappers_pb2.Int64Value, @@ -1372,15 +1409,15 @@ class GenerateRandomBytesRequest(proto.Message): level is supported. """ - location = proto.Field( + location: str = proto.Field( proto.STRING, number=1, ) - length_bytes = proto.Field( + length_bytes: int = proto.Field( proto.INT32, number=2, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=3, enum=resources.ProtectionLevel, @@ -1453,28 +1490,28 @@ class EncryptResponse(proto.Message): used in encryption. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - ciphertext = proto.Field( + ciphertext: bytes = proto.Field( proto.BYTES, number=2, ) - ciphertext_crc32c = proto.Field( + ciphertext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=4, message=wrappers_pb2.Int64Value, ) - verified_plaintext_crc32c = proto.Field( + verified_plaintext_crc32c: bool = proto.Field( proto.BOOL, number=5, ) - verified_additional_authenticated_data_crc32c = proto.Field( + verified_additional_authenticated_data_crc32c: bool = proto.Field( proto.BOOL, number=6, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=7, enum=resources.ProtectionLevel, @@ -1521,20 +1558,20 @@ class DecryptResponse(proto.Message): used in decryption. """ - plaintext = proto.Field( + plaintext: bytes = proto.Field( proto.BYTES, number=1, ) - plaintext_crc32c = proto.Field( + plaintext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, ) - used_primary = proto.Field( + used_primary: bool = proto.Field( proto.BOOL, number=3, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=4, enum=resources.ProtectionLevel, @@ -1607,28 +1644,28 @@ class AsymmetricSignResponse(proto.Message): used for signing. """ - signature = proto.Field( + signature: bytes = proto.Field( proto.BYTES, number=1, ) - signature_crc32c = proto.Field( + signature_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, ) - verified_digest_crc32c = proto.Field( + verified_digest_crc32c: bool = proto.Field( proto.BOOL, number=3, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=4, ) - verified_data_crc32c = proto.Field( + verified_data_crc32c: bool = proto.Field( proto.BOOL, number=5, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=6, enum=resources.ProtectionLevel, @@ -1682,20 +1719,20 @@ class AsymmetricDecryptResponse(proto.Message): used in decryption. """ - plaintext = proto.Field( + plaintext: bytes = proto.Field( proto.BYTES, number=1, ) - plaintext_crc32c = proto.Field( + plaintext_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=2, message=wrappers_pb2.Int64Value, ) - verified_ciphertext_crc32c = proto.Field( + verified_ciphertext_crc32c: bool = proto.Field( proto.BOOL, number=3, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=4, enum=resources.ProtectionLevel, @@ -1753,24 +1790,24 @@ class MacSignResponse(proto.Message): used for signing. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - mac = proto.Field( + mac: bytes = proto.Field( proto.BYTES, number=2, ) - mac_crc32c = proto.Field( + mac_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value, ) - verified_data_crc32c = proto.Field( + verified_data_crc32c: bool = proto.Field( proto.BOOL, number=4, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=5, enum=resources.ProtectionLevel, @@ -1837,27 +1874,27 @@ class MacVerifyResponse(proto.Message): used for verification. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - success = proto.Field( + success: bool = proto.Field( proto.BOOL, number=2, ) - verified_data_crc32c = proto.Field( + verified_data_crc32c: bool = proto.Field( proto.BOOL, number=3, ) - verified_mac_crc32c = proto.Field( + verified_mac_crc32c: bool = proto.Field( proto.BOOL, number=4, ) - verified_success_integrity = proto.Field( + verified_success_integrity: bool = proto.Field( proto.BOOL, number=5, ) - protection_level = proto.Field( + protection_level: resources.ProtectionLevel = proto.Field( proto.ENUM, number=6, enum=resources.ProtectionLevel, @@ -1890,11 +1927,11 @@ class GenerateRandomBytesResponse(proto.Message): support this type. """ - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=1, ) - data_crc32c = proto.Field( + data_crc32c: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=3, message=wrappers_pb2.Int64Value, @@ -1930,17 +1967,17 @@ class Digest(proto.Message): This field is a member of `oneof`_ ``digest``. """ - sha256 = proto.Field( + sha256: bytes = proto.Field( proto.BYTES, number=1, oneof="digest", ) - sha384 = proto.Field( + sha384: bytes = proto.Field( proto.BYTES, number=2, oneof="digest", ) - sha512 = proto.Field( + sha512: bytes = proto.Field( proto.BYTES, number=3, oneof="digest", @@ -1966,11 +2003,11 @@ class LocationMetadata(proto.Message): be created in this location. """ - hsm_available = proto.Field( + hsm_available: bool = proto.Field( proto.BOOL, number=1, ) - ekm_available = proto.Field( + ekm_available: bool = proto.Field( proto.BOOL, number=2, ) diff --git a/packages/google-cloud-kms/kms-v1-py.tar.gz b/packages/google-cloud-kms/kms-v1-py.tar.gz new file mode 100644 index 000000000000..b03fc4c90984 Binary files /dev/null and b/packages/google-cloud-kms/kms-v1-py.tar.gz differ diff --git a/packages/google-cloud-kms/noxfile.py b/packages/google-cloud-kms/noxfile.py index d752b54f56da..d8440c023805 100644 --- a/packages/google-cloud-kms/noxfile.py +++ b/packages/google-cloud-kms/noxfile.py @@ -17,6 +17,7 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import re diff --git a/packages/google-cloud-kms/owlbot.py b/packages/google-cloud-kms/owlbot.py index 742c0c10f01f..3964d3f50cd9 100644 --- a/packages/google-cloud-kms/owlbot.py +++ b/packages/google-cloud-kms/owlbot.py @@ -1,4 +1,4 @@ -# Copyright 2018 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -12,20 +12,30 @@ # See the License for the specific language governing permissions and # limitations under the License. -"""This script is used to synthesize generated parts of this library.""" +import json +from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp from synthtool.languages import python -import logging -logging.basicConfig(level=logging.DEBUG) +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- -common = gcp.CommonTemplates() +clean_up_generated_samples = True -default_version = "v1" +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + # Escape single '_' which RST treats as target names s.replace(library / "google/**/resources.py", '''"(.*?)((SIGN)|(DECRYPT)|(HMAC))_"''', '''"\g<1>\g<2>\_"''') @@ -40,25 +50,22 @@ "format" ) - s.move(library, excludes=["README.rst", "setup.py", "nox*.py", "docs/index.rst"]) - + s.move([library], excludes=["**/gapic_version.py"]) s.remove_staging_dirs() # ---------------------------------------------------------------------------- # Add templated files # ---------------------------------------------------------------------------- -templated_files = common.py_library( - samples=True, + +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), ) -s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file - -# ---------------------------------------------------------------------------- -# Samples templates -# ---------------------------------------------------------------------------- +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) python.py_samples(skip_readmes=True) -python.configure_previous_major_version_branches() - -s.shell.run(["nox", "-s", "blacken"], hide_output=False) +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/packages/google-cloud-kms/release-please-config.json b/packages/google-cloud-kms/release-please-config.json new file mode 100644 index 000000000000..f645cb5d9326 --- /dev/null +++ b/packages/google-cloud-kms/release-please-config.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/kms/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.kms.v1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_async.py b/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_async.py index cb1d4f0b9571..9254b72e95ee 100644 --- a/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_async.py +++ b/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_async.py @@ -40,7 +40,7 @@ async def sample_create_import_job(): # Initialize request argument(s) import_job = kms_v1.ImportJob() - import_job.import_method = "RSA_OAEP_4096_SHA1_AES_256" + import_job.import_method = "RSA_OAEP_4096_SHA256" import_job.protection_level = "EXTERNAL_VPC" request = kms_v1.CreateImportJobRequest( diff --git a/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_sync.py b/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_sync.py index 047aeea7da8f..c3fdc39cf363 100644 --- a/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_sync.py +++ b/packages/google-cloud-kms/samples/generated_samples/cloudkms_v1_generated_key_management_service_create_import_job_sync.py @@ -40,7 +40,7 @@ def sample_create_import_job(): # Initialize request argument(s) import_job = kms_v1.ImportJob() - import_job.import_method = "RSA_OAEP_4096_SHA1_AES_256" + import_job.import_method = "RSA_OAEP_4096_SHA256" import_job.protection_level = "EXTERNAL_VPC" request = kms_v1.CreateImportJobRequest( diff --git a/packages/google-cloud-kms/samples/generated_samples/snippet_metadata_kms_v1.json b/packages/google-cloud-kms/samples/generated_samples/snippet_metadata_google.cloud.kms.v1.json similarity index 99% rename from packages/google-cloud-kms/samples/generated_samples/snippet_metadata_kms_v1.json rename to packages/google-cloud-kms/samples/generated_samples/snippet_metadata_google.cloud.kms.v1.json index 5c9c012704e5..329608b3e52c 100644 --- a/packages/google-cloud-kms/samples/generated_samples/snippet_metadata_kms_v1.json +++ b/packages/google-cloud-kms/samples/generated_samples/snippet_metadata_google.cloud.kms.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-kms" + "name": "google-cloud-kms", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-kms/scripts/fixup_kms_v1_keywords.py b/packages/google-cloud-kms/scripts/fixup_kms_v1_keywords.py index 350dd9285be5..ce151fedaee1 100644 --- a/packages/google-cloud-kms/scripts/fixup_kms_v1_keywords.py +++ b/packages/google-cloud-kms/scripts/fixup_kms_v1_keywords.py @@ -56,7 +56,7 @@ class kmsCallTransformer(cst.CSTTransformer): 'get_import_job': ('name', ), 'get_key_ring': ('name', ), 'get_public_key': ('name', ), - 'import_crypto_key_version': ('parent', 'algorithm', 'import_job', 'crypto_key_version', 'rsa_aes_wrapped_key', ), + 'import_crypto_key_version': ('parent', 'algorithm', 'import_job', 'crypto_key_version', 'wrapped_key', 'rsa_aes_wrapped_key', ), 'list_crypto_keys': ('parent', 'page_size', 'page_token', 'version_view', 'filter', 'order_by', ), 'list_crypto_key_versions': ('parent', 'page_size', 'page_token', 'view', 'filter', 'order_by', ), 'list_ekm_connections': ('parent', 'page_size', 'page_token', 'filter', 'order_by', ), diff --git a/packages/google-cloud-kms/setup.py b/packages/google-cloud-kms/setup.py index 2278438399ab..ce4752d7a4fe 100644 --- a/packages/google-cloud-kms/setup.py +++ b/packages/google-cloud-kms/setup.py @@ -1,36 +1,47 @@ # -*- coding: utf-8 -*- -# -# Copyright 2018 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # -# https://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +# import io import os -import setuptools +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-kms" -description = "Cloud Key Management Service (KMS) API client library" -version = "2.12.3" -release_status = "Development Status :: 5 - Production/Stable" + + +description = "Google Cloud Kms API client library" + +version = {} +with open(os.path.join(package_root, "google/cloud/kms/gapic_version.py")) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", - "grpc-google-iam-v1 >=0.12.4, <1.0.0dev", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", + "grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev", ] - -extras = {"libcst": "libcst >= 0.2.5"} +url = "https://github.com/googleapis/python-kms" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -38,15 +49,12 @@ with io.open(readme_filename, encoding="utf-8") as readme_file: readme = readme_file.read() -# Only include packages under the 'google' namespace. Do not include tests, -# benchmarks, etc. packages = [ package for package in setuptools.PEP420PackageFinder.find() if package.startswith("google") ] - namespaces = ["google"] if "google.cloud" in packages: namespaces.append("google.cloud") @@ -59,7 +67,7 @@ author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-kms", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", @@ -75,11 +83,9 @@ ], platforms="Posix; MacOS X; Windows", packages=packages, + python_requires=">=3.7", namespace_packages=namespaces, install_requires=dependencies, - extras_require=extras, - python_requires=">=3.7", - scripts=["scripts/fixup_kms_v1_keywords.py"], include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-kms/testing/constraints-3.10.txt b/packages/google-cloud-kms/testing/constraints-3.10.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-kms/testing/constraints-3.10.txt +++ b/packages/google-cloud-kms/testing/constraints-3.10.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/packages/google-cloud-kms/testing/constraints-3.11.txt b/packages/google-cloud-kms/testing/constraints-3.11.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-kms/testing/constraints-3.11.txt +++ b/packages/google-cloud-kms/testing/constraints-3.11.txt @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/packages/google-cloud-kms/testing/constraints-3.7.txt b/packages/google-cloud-kms/testing/constraints-3.7.txt index 90f4b6d9db25..883a87aefd06 100644 --- a/packages/google-cloud-kms/testing/constraints-3.7.txt +++ b/packages/google-cloud-kms/testing/constraints-3.7.txt @@ -1,12 +1,10 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 -grpc-google-iam-v1==0.12.4 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 -libcst==0.2.5 protobuf==3.19.5 +grpc-google-iam-v1==0.12.4 diff --git a/packages/google-cloud-kms/testing/constraints-3.8.txt b/packages/google-cloud-kms/testing/constraints-3.8.txt index da93009be5fe..ad3f0fa58e2d 100644 --- a/packages/google-cloud-kms/testing/constraints-3.8.txt +++ b/packages/google-cloud-kms/testing/constraints-3.8.txt @@ -1,2 +1,7 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/packages/google-cloud-kms/testing/constraints-3.9.txt b/packages/google-cloud-kms/testing/constraints-3.9.txt index da93009be5fe..ad3f0fa58e2d 100644 --- a/packages/google-cloud-kms/testing/constraints-3.9.txt +++ b/packages/google-cloud-kms/testing/constraints-3.9.txt @@ -1,2 +1,7 @@ -# This constraints file is left inentionally empty -# so the latest version of dependencies is installed \ No newline at end of file +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf +grpc-google-iam-v1 diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py index d30ef2be840a..869bf0e33944 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_ekm_service.py @@ -22,33 +22,33 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.kms_v1.services.ekm_service import EkmServiceAsyncClient -from google.cloud.kms_v1.services.ekm_service import EkmServiceClient -from google.cloud.kms_v1.services.ekm_service import pagers -from google.cloud.kms_v1.services.ekm_service import transports -from google.cloud.kms_v1.types import ekm_service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import options_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore from google.oauth2 import service_account from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.kms_v1.services.ekm_service import ( + EkmServiceAsyncClient, + EkmServiceClient, + pagers, + transports, +) +from google.cloud.kms_v1.types import ekm_service def client_cert_source_callback(): diff --git a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py index c3fde682fd5a..a5edf94def22 100644 --- a/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py +++ b/packages/google-cloud-kms/tests/unit/gapic/kms_v1/test_key_management_service.py @@ -22,31 +22,14 @@ except ImportError: # pragma: NO COVER import mock -import grpc -from grpc.experimental import aio import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule -from proto.marshal.rules import wrappers +from google.api_core import gapic_v1, grpc_helpers, grpc_helpers_async, path_template from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import gapic_v1 -from google.api_core import grpc_helpers -from google.api_core import grpc_helpers_async -from google.api_core import path_template +import google.auth from google.auth import credentials as ga_credentials from google.auth.exceptions import MutualTLSChannelError -from google.cloud.kms_v1.services.key_management_service import ( - KeyManagementServiceAsyncClient, -) -from google.cloud.kms_v1.services.key_management_service import ( - KeyManagementServiceClient, -) -from google.cloud.kms_v1.services.key_management_service import pagers -from google.cloud.kms_v1.services.key_management_service import transports -from google.cloud.kms_v1.types import resources -from google.cloud.kms_v1.types import service from google.iam.v1 import iam_policy_pb2 # type: ignore from google.iam.v1 import options_pb2 # type: ignore from google.iam.v1 import policy_pb2 # type: ignore @@ -55,7 +38,19 @@ from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.protobuf import wrappers_pb2 # type: ignore -import google.auth +import grpc +from grpc.experimental import aio +from proto.marshal.rules import wrappers +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + +from google.cloud.kms_v1.services.key_management_service import ( + KeyManagementServiceAsyncClient, + KeyManagementServiceClient, + pagers, + transports, +) +from google.cloud.kms_v1.types import resources, service def client_cert_source_callback():