diff --git a/packages/google-cloud-bigquery-datapolicies/.github/release-please.yml b/packages/google-cloud-bigquery-datapolicies/.github/release-please.yml index 466597e5b196..528b2741a1f7 100644 --- a/packages/google-cloud-bigquery-datapolicies/.github/release-please.yml +++ b/packages/google-cloud-bigquery-datapolicies/.github/release-please.yml @@ -1,2 +1,3 @@ releaseType: python handleGHRelease: true +manifest: true diff --git a/packages/google-cloud-bigquery-datapolicies/.release-please-manifest.json b/packages/google-cloud-bigquery-datapolicies/.release-please-manifest.json new file mode 100644 index 000000000000..a915e8c5579f --- /dev/null +++ b/packages/google-cloud-bigquery-datapolicies/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.1.1" +} diff --git a/packages/google-cloud-bigquery-datapolicies/docs/datapolicies_v1beta1/types.rst b/packages/google-cloud-bigquery-datapolicies/docs/datapolicies_v1beta1/types.rst index 30ce4746ca2a..03c75ac2497f 100644 --- a/packages/google-cloud-bigquery-datapolicies/docs/datapolicies_v1beta1/types.rst +++ b/packages/google-cloud-bigquery-datapolicies/docs/datapolicies_v1beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Bigquery Datapolicies v1beta1 API .. automodule:: google.cloud.bigquery.datapolicies_v1beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/__init__.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/__init__.py new file mode 100644 index 000000000000..c2fc55bb50f6 --- /dev/null +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/__init__.py @@ -0,0 +1,49 @@ +# -*- 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. +# +from google.cloud.bigquery.datapolicies import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.bigquery.datapolicies_v1beta1.services.data_policy_service.async_client import ( + DataPolicyServiceAsyncClient, +) +from google.cloud.bigquery.datapolicies_v1beta1.services.data_policy_service.client import ( + DataPolicyServiceClient, +) +from google.cloud.bigquery.datapolicies_v1beta1.types.datapolicy import ( + CreateDataPolicyRequest, + DataMaskingPolicy, + DataPolicy, + DeleteDataPolicyRequest, + GetDataPolicyRequest, + ListDataPoliciesRequest, + ListDataPoliciesResponse, + UpdateDataPolicyRequest, +) + +__all__ = ( + "DataPolicyServiceClient", + "DataPolicyServiceAsyncClient", + "CreateDataPolicyRequest", + "DataMaskingPolicy", + "DataPolicy", + "DeleteDataPolicyRequest", + "GetDataPolicyRequest", + "ListDataPoliciesRequest", + "ListDataPoliciesResponse", + "UpdateDataPolicyRequest", +) diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/gapic_version.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/gapic_version.py new file mode 100644 index 000000000000..318ba53b4de0 --- /dev/null +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/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__ = "0.1.1" # {x-release-please-version} diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/py.typed b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/py.typed new file mode 100644 index 000000000000..ff02bfbdb46b --- /dev/null +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-bigquery-datapolicies package uses inline types. diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/__init__.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/__init__.py index ff7bd1653c36..b9b4e6e0a9b3 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/__init__.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.bigquery.datapolicies import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.data_policy_service import ( DataPolicyServiceAsyncClient, diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/async_client.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/async_client.py index 94cab31f56d6..4f9e03d93d49 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/async_client.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -169,9 +179,9 @@ def transport(self) -> DataPolicyServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DataPolicyServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the data policy service client. @@ -215,12 +225,12 @@ def __init__( async def create_data_policy( self, - request: Union[datapolicy.CreateDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.CreateDataPolicyRequest, dict]] = None, *, - parent: str = None, - data_policy: datapolicy.DataPolicy = None, + parent: Optional[str] = None, + data_policy: Optional[datapolicy.DataPolicy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datapolicy.DataPolicy: r"""Creates a new data policy under a project with the given @@ -259,7 +269,7 @@ async def sample_create_data_policy(): print(response) Args: - request (Union[google.cloud.bigquery.datapolicies_v1beta1.types.CreateDataPolicyRequest, dict]): + request (Optional[Union[google.cloud.bigquery.datapolicies_v1beta1.types.CreateDataPolicyRequest, dict]]): The request object. Request message for the CreateDataPolicy method. parent (:class:`str`): @@ -343,12 +353,12 @@ async def sample_create_data_policy(): async def update_data_policy( self, - request: Union[datapolicy.UpdateDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.UpdateDataPolicyRequest, dict]] = None, *, - data_policy: datapolicy.DataPolicy = None, - update_mask: field_mask_pb2.FieldMask = None, + data_policy: Optional[datapolicy.DataPolicy] = 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]] = (), ) -> datapolicy.DataPolicy: r"""Updates the metadata for an existing data policy. The @@ -386,7 +396,7 @@ async def sample_update_data_policy(): print(response) Args: - request (Union[google.cloud.bigquery.datapolicies_v1beta1.types.UpdateDataPolicyRequest, dict]): + request (Optional[Union[google.cloud.bigquery.datapolicies_v1beta1.types.UpdateDataPolicyRequest, dict]]): The request object. Response message for the UpdateDataPolicy method. data_policy (:class:`google.cloud.bigquery.datapolicies_v1beta1.types.DataPolicy`): @@ -479,11 +489,11 @@ async def sample_update_data_policy(): async def delete_data_policy( self, - request: Union[datapolicy.DeleteDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.DeleteDataPolicyRequest, 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]] = (), ) -> None: r"""Deletes the data policy specified by its resource @@ -513,7 +523,7 @@ async def sample_delete_data_policy(): await client.delete_data_policy(request=request) Args: - request (Union[google.cloud.bigquery.datapolicies_v1beta1.types.DeleteDataPolicyRequest, dict]): + request (Optional[Union[google.cloud.bigquery.datapolicies_v1beta1.types.DeleteDataPolicyRequest, dict]]): The request object. Request message for the DeleteDataPolicy method. name (:class:`str`): @@ -580,11 +590,11 @@ async def sample_delete_data_policy(): async def get_data_policy( self, - request: Union[datapolicy.GetDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.GetDataPolicyRequest, 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]] = (), ) -> datapolicy.DataPolicy: r"""Gets the data policy specified by its resource name. @@ -616,7 +626,7 @@ async def sample_get_data_policy(): print(response) Args: - request (Union[google.cloud.bigquery.datapolicies_v1beta1.types.GetDataPolicyRequest, dict]): + request (Optional[Union[google.cloud.bigquery.datapolicies_v1beta1.types.GetDataPolicyRequest, dict]]): The request object. Request message for the GetDataPolicy method. name (:class:`str`): @@ -690,11 +700,11 @@ async def sample_get_data_policy(): async def list_data_policies( self, - request: Union[datapolicy.ListDataPoliciesRequest, dict] = None, + request: Optional[Union[datapolicy.ListDataPoliciesRequest, 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.ListDataPoliciesAsyncPager: r"""List all of the data policies in the specified parent @@ -728,7 +738,7 @@ async def sample_list_data_policies(): print(response) Args: - request (Union[google.cloud.bigquery.datapolicies_v1beta1.types.ListDataPoliciesRequest, dict]): + request (Optional[Union[google.cloud.bigquery.datapolicies_v1beta1.types.ListDataPoliciesRequest, dict]]): The request object. Request message for the ListDataPolicies method. parent (:class:`str`): @@ -816,10 +826,10 @@ async def sample_list_data_policies(): async def get_iam_policy( self, - request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = 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 policy for the specified data policy. @@ -852,7 +862,7 @@ async def sample_get_iam_policy(): print(response) Args: - request (Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]): + request (Optional[Union[google.iam.v1.iam_policy_pb2.GetIamPolicyRequest, dict]]): The request object. Request message for `GetIamPolicy` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -968,10 +978,10 @@ async def sample_get_iam_policy(): async def set_iam_policy( self, - request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = 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 policy for the specified data policy. @@ -1004,7 +1014,7 @@ async def sample_set_iam_policy(): print(response) Args: - request (Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]): + request (Optional[Union[google.iam.v1.iam_policy_pb2.SetIamPolicyRequest, dict]]): The request object. Request message for `SetIamPolicy` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1120,10 +1130,10 @@ async def sample_set_iam_policy(): async def test_iam_permissions( self, - request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Returns the caller's permission on the specified data @@ -1158,7 +1168,7 @@ async def sample_test_iam_permissions(): print(response) Args: - request (Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]): + request (Optional[Union[google.iam.v1.iam_policy_pb2.TestIamPermissionsRequest, dict]]): The request object. Request message for `TestIamPermissions` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/client.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/client.py index 98fd35961c47..2e9f0d9697a3 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/client.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +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 @@ -64,7 +75,7 @@ class DataPolicyServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DataPolicyServiceTransport]: """Returns an appropriate transport class. @@ -343,8 +354,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DataPolicyServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, DataPolicyServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the data policy service client. @@ -358,7 +369,7 @@ def __init__( transport (Union[str, DataPolicyServiceTransport]): 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 @@ -388,6 +399,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 @@ -440,12 +452,12 @@ def __init__( def create_data_policy( self, - request: Union[datapolicy.CreateDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.CreateDataPolicyRequest, dict]] = None, *, - parent: str = None, - data_policy: datapolicy.DataPolicy = None, + parent: Optional[str] = None, + data_policy: Optional[datapolicy.DataPolicy] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datapolicy.DataPolicy: r"""Creates a new data policy under a project with the given @@ -559,12 +571,12 @@ def sample_create_data_policy(): def update_data_policy( self, - request: Union[datapolicy.UpdateDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.UpdateDataPolicyRequest, dict]] = None, *, - data_policy: datapolicy.DataPolicy = None, - update_mask: field_mask_pb2.FieldMask = None, + data_policy: Optional[datapolicy.DataPolicy] = 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]] = (), ) -> datapolicy.DataPolicy: r"""Updates the metadata for an existing data policy. The @@ -686,11 +698,11 @@ def sample_update_data_policy(): def delete_data_policy( self, - request: Union[datapolicy.DeleteDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.DeleteDataPolicyRequest, 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]] = (), ) -> None: r"""Deletes the data policy specified by its resource @@ -778,11 +790,11 @@ def sample_delete_data_policy(): def get_data_policy( self, - request: Union[datapolicy.GetDataPolicyRequest, dict] = None, + request: Optional[Union[datapolicy.GetDataPolicyRequest, 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]] = (), ) -> datapolicy.DataPolicy: r"""Gets the data policy specified by its resource name. @@ -879,11 +891,11 @@ def sample_get_data_policy(): def list_data_policies( self, - request: Union[datapolicy.ListDataPoliciesRequest, dict] = None, + request: Optional[Union[datapolicy.ListDataPoliciesRequest, 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.ListDataPoliciesPager: r"""List all of the data policies in the specified parent @@ -996,10 +1008,10 @@ def sample_list_data_policies(): def get_iam_policy( self, - request: Union[iam_policy_pb2.GetIamPolicyRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.GetIamPolicyRequest, dict]] = 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 policy for the specified data policy. @@ -1138,10 +1150,10 @@ def sample_get_iam_policy(): def set_iam_policy( self, - request: Union[iam_policy_pb2.SetIamPolicyRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.SetIamPolicyRequest, dict]] = 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 policy for the specified data policy. @@ -1280,10 +1292,10 @@ def sample_set_iam_policy(): def test_iam_permissions( self, - request: Union[iam_policy_pb2.TestIamPermissionsRequest, dict] = None, + request: Optional[Union[iam_policy_pb2.TestIamPermissionsRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> iam_policy_pb2.TestIamPermissionsResponse: r"""Returns the caller's permission on the specified data diff --git a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/base.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/base.py index cf75cfa96ac6..82c8db9fa910 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/base.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/base.py @@ -54,7 +54,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-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc.py index 7c1da688eb3c..94713657eb54 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc.py @@ -50,14 +50,14 @@ def __init__( self, *, host: str = "bigquerydatapolicy.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, @@ -184,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "bigquerydatapolicy.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-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc_asyncio.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc_asyncio.py index ea98f34929b8..9f4c5a126b32 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/services/data_policy_service/transports/grpc_asyncio.py @@ -52,7 +52,7 @@ class DataPolicyServiceGrpcAsyncIOTransport(DataPolicyServiceTransport): def create_channel( cls, host: str = "bigquerydatapolicy.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, @@ -95,15 +95,15 @@ def __init__( self, *, host: str = "bigquerydatapolicy.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-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/types/datapolicy.py b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/types/datapolicy.py index 4617394a1a04..ae071ab0eecb 100644 --- a/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/types/datapolicy.py +++ b/packages/google-cloud-bigquery-datapolicies/google/cloud/bigquery/datapolicies_v1beta1/types/datapolicy.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -44,11 +46,11 @@ class CreateDataPolicyRequest(proto.Message): not need to be provided for the data policy creation. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - data_policy = proto.Field( + data_policy: "DataPolicy" = proto.Field( proto.MESSAGE, number=2, message="DataPolicy", @@ -76,12 +78,12 @@ class UpdateDataPolicyRequest(proto.Message): allowed. """ - data_policy = proto.Field( + data_policy: "DataPolicy" = proto.Field( proto.MESSAGE, number=1, message="DataPolicy", ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -98,7 +100,7 @@ class DeleteDataPolicyRequest(proto.Message): ``projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -114,7 +116,7 @@ class GetDataPolicyRequest(proto.Message): ``projects/{project_number}/locations/{location_id}/dataPolicies/{data_policy_id}``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -137,15 +139,15 @@ class ListDataPoliciesRequest(proto.Message): request, if any. If not set, defaults to an empty string. """ - 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, ) @@ -155,7 +157,7 @@ class ListDataPoliciesResponse(proto.Message): r"""Response message for the ListDataPolicies method. Attributes: - data_policies (Sequence[google.cloud.bigquery.datapolicies_v1beta1.types.DataPolicy]): + data_policies (MutableSequence[google.cloud.bigquery.datapolicies_v1beta1.types.DataPolicy]): Data policies that belong to the requested project. next_page_token (str): @@ -167,12 +169,12 @@ class ListDataPoliciesResponse(proto.Message): def raw_page(self): return self - data_policies = proto.RepeatedField( + data_policies: MutableSequence["DataPolicy"] = proto.RepeatedField( proto.MESSAGE, number=1, message="DataPolicy", ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -212,27 +214,27 @@ class DataPolicyType(proto.Enum): COLUMN_LEVEL_SECURITY_POLICY = 3 DATA_MASKING_POLICY = 2 - policy_tag = proto.Field( + policy_tag: str = proto.Field( proto.STRING, number=4, oneof="matching_label", ) - data_masking_policy = proto.Field( + data_masking_policy: "DataMaskingPolicy" = proto.Field( proto.MESSAGE, number=5, oneof="policy", message="DataMaskingPolicy", ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - data_policy_type = proto.Field( + data_policy_type: DataPolicyType = proto.Field( proto.ENUM, number=2, enum=DataPolicyType, ) - data_policy_id = proto.Field( + data_policy_id: str = proto.Field( proto.STRING, number=3, ) @@ -261,7 +263,7 @@ class PredefinedExpression(proto.Enum): ALWAYS_NULL = 5 DEFAULT_MASKING_VALUE = 7 - predefined_expression = proto.Field( + predefined_expression: PredefinedExpression = proto.Field( proto.ENUM, number=1, oneof="masking_expression", diff --git a/packages/google-cloud-bigquery-datapolicies/owlbot.py b/packages/google-cloud-bigquery-datapolicies/owlbot.py index 06506c2b52e1..ce738f01d012 100644 --- a/packages/google-cloud-bigquery-datapolicies/owlbot.py +++ b/packages/google-cloud-bigquery-datapolicies/owlbot.py @@ -12,7 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json from pathlib import Path +import shutil import synthtool as s import synthtool.gcp as gcp @@ -22,10 +24,18 @@ # Copy the generated client from the owl-bot staging directory # ---------------------------------------------------------------------------- -default_version = "v1beta1" +clean_up_generated_samples = True + +# 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): - s.move(library, excludes=["google/cloud/bigquery/datapolicies/", "setup.py"]) + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py"]) s.remove_staging_dirs() # ---------------------------------------------------------------------------- @@ -37,11 +47,10 @@ microgenerator=True, versions=gcp.common.detect_versions(path="./google", default_first=True), ) -s.move(templated_files, excludes=[".coveragerc"]) # the microgenerator has a good coveragerc file +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) python.py_samples(skip_readmes=True) - -# run blacken session for all directories which have a noxfile +# 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-bigquery-datapolicies/release-please-config.json b/packages/google-cloud-bigquery-datapolicies/release-please-config.json new file mode 100644 index 000000000000..f2728aa69efc --- /dev/null +++ b/packages/google-cloud-bigquery-datapolicies/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/bigquery/datapolicies/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.bigquery.datapolicies.v1beta1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_datapolicies_v1beta1.json b/packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datapolicies.v1beta1.json similarity index 99% rename from packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_datapolicies_v1beta1.json rename to packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datapolicies.v1beta1.json index 3464fbd6d9f9..007618ce5a7f 100644 --- a/packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_datapolicies_v1beta1.json +++ b/packages/google-cloud-bigquery-datapolicies/samples/generated_samples/snippet_metadata_google.cloud.bigquery.datapolicies.v1beta1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-bigquery-datapolicies" + "name": "google-cloud-bigquery-datapolicies", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-bigquery-datapolicies/setup.py b/packages/google-cloud-bigquery-datapolicies/setup.py index e798ff9cd932..74a247db5f4e 100644 --- a/packages/google-cloud-bigquery-datapolicies/setup.py +++ b/packages/google-cloud-bigquery-datapolicies/setup.py @@ -1,33 +1,47 @@ # -*- coding: utf-8 -*- -# -# Copyright 2020 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-bigquery-datapolicies" -description = "BigQuery Data Policy API client library" -version = "0.1.1" -release_status = "Development Status :: 4 - Beta" + + +description = "Google Cloud Bigquery Datapolicies API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/bigquery/datapolicies/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.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", + "grpc-google-iam-v1 >= 0.12.4, < 1.0.0dev", ] url = "https://github.com/googleapis/python-bigquery-datapolicies" @@ -47,7 +61,6 @@ if "google.cloud" in packages: namespaces.append("google.cloud") - setuptools.setup( name=name, version=version, diff --git a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.10.txt +++ b/packages/google-cloud-bigquery-datapolicies/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-bigquery-datapolicies/testing/constraints-3.11.txt b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.11.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.11.txt +++ b/packages/google-cloud-bigquery-datapolicies/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-bigquery-datapolicies/testing/constraints-3.8.txt b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.8.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.8.txt +++ b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.8.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-bigquery-datapolicies/testing/constraints-3.9.txt b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.9.txt index e69de29bb2d1..ad3f0fa58e2d 100644 --- a/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.9.txt +++ b/packages/google-cloud-bigquery-datapolicies/testing/constraints-3.9.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