diff --git a/.flake8 b/.flake8 index 29227d4..2e43874 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7..757c9dc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 0000000..311ebbb --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 0000000..41bff0b --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# 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. +requestsize: + enabled: true diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb..238b87b 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a7..46d2371 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index 07c6bce..6cbdfc3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Changelog -### [0.4.1](https://github.com/googleapis/python-network-security/compare/v0.4.0...v0.4.1) (2022-03-05) +## [0.4.2](https://github.com/googleapis/python-network-security/compare/v0.4.1...v0.4.2) (2022-06-03) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#98](https://github.com/googleapis/python-network-security/issues/98)) ([dfdc5c7](https://github.com/googleapis/python-network-security/commit/dfdc5c706382ba14a2a12a8e28530abcd8b48724)) + + +### Documentation + +* fix changelog header to consistent size ([#99](https://github.com/googleapis/python-network-security/issues/99)) ([86bc9e4](https://github.com/googleapis/python-network-security/commit/86bc9e4db6a2332ace0a8f6d8a194261f38dd072)) + +## [0.4.1](https://github.com/googleapis/python-network-security/compare/v0.4.0...v0.4.1) (2022-03-05) ### Bug Fixes @@ -19,14 +31,14 @@ * resolve DuplicateCredentialArgs error when using credentials_file ([a531e63](https://github.com/googleapis/python-network-security/commit/a531e6371651a5036afbc82d6ee10c1bc50e7610)) -### [0.3.2](https://www.github.com/googleapis/python-network-security/compare/v0.3.1...v0.3.2) (2022-01-09) +## [0.3.2](https://www.github.com/googleapis/python-network-security/compare/v0.3.1...v0.3.2) (2022-01-09) ### Bug Fixes * updating metadata messages for all long running operations ([#57](https://www.github.com/googleapis/python-network-security/issues/57)) ([7adc601](https://www.github.com/googleapis/python-network-security/commit/7adc601de611fe0323185b2747c98a620e21a38f)) -### [0.3.1](https://www.github.com/googleapis/python-network-security/compare/v0.3.0...v0.3.1) (2021-11-02) +## [0.3.1](https://www.github.com/googleapis/python-network-security/compare/v0.3.0...v0.3.1) (2021-11-02) ### Bug Fixes @@ -53,21 +65,21 @@ * add context manager support in client ([#37](https://www.github.com/googleapis/python-network-security/issues/37)) ([173b3db](https://www.github.com/googleapis/python-network-security/commit/173b3dbd36c5118853b8d93dcb32635d64208876)) -### [0.1.5](https://www.github.com/googleapis/python-network-security/compare/v0.1.4...v0.1.5) (2021-09-30) +## [0.1.5](https://www.github.com/googleapis/python-network-security/compare/v0.1.4...v0.1.5) (2021-09-30) ### Bug Fixes * improper types in pagers generation ([90b83d6](https://www.github.com/googleapis/python-network-security/commit/90b83d6282d8b68890eed8e81013766763ec6648)) -### [0.1.4](https://www.github.com/googleapis/python-network-security/compare/v0.1.3...v0.1.4) (2021-09-24) +## [0.1.4](https://www.github.com/googleapis/python-network-security/compare/v0.1.3...v0.1.4) (2021-09-24) ### Bug Fixes * add 'dict' annotation type to 'request' ([dcefd7e](https://www.github.com/googleapis/python-network-security/commit/dcefd7e92f08e12c868fee114c73075e8ba356a5)) -### [0.1.3](https://www.github.com/googleapis/python-network-security/compare/v0.1.2...v0.1.3) (2021-07-29) +## [0.1.3](https://www.github.com/googleapis/python-network-security/compare/v0.1.2...v0.1.3) (2021-07-29) ### Bug Fixes @@ -84,14 +96,14 @@ * release as 0.1.3 ([#16](https://www.github.com/googleapis/python-network-security/issues/16)) ([7d742bc](https://www.github.com/googleapis/python-network-security/commit/7d742bc40d857c796074442438696f805af38cde)) -### [0.1.2](https://www.github.com/googleapis/python-network-security/compare/v0.1.1...v0.1.2) (2021-07-21) +## [0.1.2](https://www.github.com/googleapis/python-network-security/compare/v0.1.1...v0.1.2) (2021-07-21) ### Bug Fixes * **deps:** pin 'google-{api,cloud}-core', 'google-auth' to allow 2.x versions ([#10](https://www.github.com/googleapis/python-network-security/issues/10)) ([070273d](https://www.github.com/googleapis/python-network-security/commit/070273d863029e31a01ed754f7e56561d83430b9)) -### [0.1.1](https://www.github.com/googleapis/python-network-security/compare/v0.1.0...v0.1.1) (2021-07-14) +## [0.1.1](https://www.github.com/googleapis/python-network-security/compare/v0.1.0...v0.1.1) (2021-07-14) ### Bug Fixes diff --git a/docs/conf.py b/docs/conf.py index f8c7aaa..4dd193b 100644 --- a/docs/conf.py +++ b/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 @@ -361,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), diff --git a/google/cloud/network_security/__init__.py b/google/cloud/network_security/__init__.py index cb2d3f6..241d9c0 100644 --- a/google/cloud/network_security/__init__.py +++ b/google/cloud/network_security/__init__.py @@ -14,81 +14,46 @@ # limitations under the License. # -from google.cloud.network_security_v1beta1.services.network_security.client import ( - NetworkSecurityClient, -) from google.cloud.network_security_v1beta1.services.network_security.async_client import ( NetworkSecurityAsyncClient, ) - -from google.cloud.network_security_v1beta1.types.authorization_policy import ( - AuthorizationPolicy, +from google.cloud.network_security_v1beta1.services.network_security.client import ( + NetworkSecurityClient, ) from google.cloud.network_security_v1beta1.types.authorization_policy import ( + AuthorizationPolicy, CreateAuthorizationPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.authorization_policy import ( DeleteAuthorizationPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.authorization_policy import ( GetAuthorizationPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.authorization_policy import ( ListAuthorizationPoliciesRequest, -) -from google.cloud.network_security_v1beta1.types.authorization_policy import ( ListAuthorizationPoliciesResponse, -) -from google.cloud.network_security_v1beta1.types.authorization_policy import ( UpdateAuthorizationPolicyRequest, ) from google.cloud.network_security_v1beta1.types.client_tls_policy import ( ClientTlsPolicy, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( CreateClientTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( DeleteClientTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( GetClientTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( ListClientTlsPoliciesRequest, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( ListClientTlsPoliciesResponse, -) -from google.cloud.network_security_v1beta1.types.client_tls_policy import ( UpdateClientTlsPolicyRequest, ) from google.cloud.network_security_v1beta1.types.common import OperationMetadata from google.cloud.network_security_v1beta1.types.server_tls_policy import ( CreateServerTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( DeleteServerTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( GetServerTlsPolicyRequest, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( ListServerTlsPoliciesRequest, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( ListServerTlsPoliciesResponse, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( ServerTlsPolicy, -) -from google.cloud.network_security_v1beta1.types.server_tls_policy import ( UpdateServerTlsPolicyRequest, ) -from google.cloud.network_security_v1beta1.types.tls import CertificateProvider -from google.cloud.network_security_v1beta1.types.tls import CertificateProviderInstance -from google.cloud.network_security_v1beta1.types.tls import GrpcEndpoint -from google.cloud.network_security_v1beta1.types.tls import ValidationCA +from google.cloud.network_security_v1beta1.types.tls import ( + CertificateProvider, + CertificateProviderInstance, + GrpcEndpoint, + ValidationCA, +) __all__ = ( "NetworkSecurityClient", diff --git a/google/cloud/network_security_v1beta1/__init__.py b/google/cloud/network_security_v1beta1/__init__.py index 9657d23..73985dc 100644 --- a/google/cloud/network_security_v1beta1/__init__.py +++ b/google/cloud/network_security_v1beta1/__init__.py @@ -14,35 +14,41 @@ # limitations under the License. # -from .services.network_security import NetworkSecurityClient -from .services.network_security import NetworkSecurityAsyncClient - -from .types.authorization_policy import AuthorizationPolicy -from .types.authorization_policy import CreateAuthorizationPolicyRequest -from .types.authorization_policy import DeleteAuthorizationPolicyRequest -from .types.authorization_policy import GetAuthorizationPolicyRequest -from .types.authorization_policy import ListAuthorizationPoliciesRequest -from .types.authorization_policy import ListAuthorizationPoliciesResponse -from .types.authorization_policy import UpdateAuthorizationPolicyRequest -from .types.client_tls_policy import ClientTlsPolicy -from .types.client_tls_policy import CreateClientTlsPolicyRequest -from .types.client_tls_policy import DeleteClientTlsPolicyRequest -from .types.client_tls_policy import GetClientTlsPolicyRequest -from .types.client_tls_policy import ListClientTlsPoliciesRequest -from .types.client_tls_policy import ListClientTlsPoliciesResponse -from .types.client_tls_policy import UpdateClientTlsPolicyRequest +from .services.network_security import NetworkSecurityAsyncClient, NetworkSecurityClient +from .types.authorization_policy import ( + AuthorizationPolicy, + CreateAuthorizationPolicyRequest, + DeleteAuthorizationPolicyRequest, + GetAuthorizationPolicyRequest, + ListAuthorizationPoliciesRequest, + ListAuthorizationPoliciesResponse, + UpdateAuthorizationPolicyRequest, +) +from .types.client_tls_policy import ( + ClientTlsPolicy, + CreateClientTlsPolicyRequest, + DeleteClientTlsPolicyRequest, + GetClientTlsPolicyRequest, + ListClientTlsPoliciesRequest, + ListClientTlsPoliciesResponse, + UpdateClientTlsPolicyRequest, +) from .types.common import OperationMetadata -from .types.server_tls_policy import CreateServerTlsPolicyRequest -from .types.server_tls_policy import DeleteServerTlsPolicyRequest -from .types.server_tls_policy import GetServerTlsPolicyRequest -from .types.server_tls_policy import ListServerTlsPoliciesRequest -from .types.server_tls_policy import ListServerTlsPoliciesResponse -from .types.server_tls_policy import ServerTlsPolicy -from .types.server_tls_policy import UpdateServerTlsPolicyRequest -from .types.tls import CertificateProvider -from .types.tls import CertificateProviderInstance -from .types.tls import GrpcEndpoint -from .types.tls import ValidationCA +from .types.server_tls_policy import ( + CreateServerTlsPolicyRequest, + DeleteServerTlsPolicyRequest, + GetServerTlsPolicyRequest, + ListServerTlsPoliciesRequest, + ListServerTlsPoliciesResponse, + ServerTlsPolicy, + UpdateServerTlsPolicyRequest, +) +from .types.tls import ( + CertificateProvider, + CertificateProviderInstance, + GrpcEndpoint, + ValidationCA, +) __all__ = ( "NetworkSecurityAsyncClient", diff --git a/google/cloud/network_security_v1beta1/services/network_security/__init__.py b/google/cloud/network_security_v1beta1/services/network_security/__init__.py index 99a40c8..a6eef08 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/__init__.py +++ b/google/cloud/network_security_v1beta1/services/network_security/__init__.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # -from .client import NetworkSecurityClient from .async_client import NetworkSecurityAsyncClient +from .client import NetworkSecurityClient __all__ = ( "NetworkSecurityClient", diff --git a/google/cloud/network_security_v1beta1/services/network_security/async_client.py b/google/cloud/network_security_v1beta1/services/network_security/async_client.py index 95f4c08..7afe6e3 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/async_client.py +++ b/google/cloud/network_security_v1beta1/services/network_security/async_client.py @@ -16,15 +16,15 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, 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] @@ -33,27 +33,29 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.network_security_v1beta1.services.network_security import pagers -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import common -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import common +from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import tls -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import NetworkSecurityTransport, DEFAULT_CLIENT_INFO -from .transports.grpc_asyncio import NetworkSecurityGrpcAsyncIOTransport + from .client import NetworkSecurityClient +from .transports.base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport +from .transports.grpc_asyncio import NetworkSecurityGrpcAsyncIOTransport class NetworkSecurityAsyncClient: @@ -249,14 +251,13 @@ async def list_authorization_policies( r"""Lists AuthorizationPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_list_authorization_policies(): + async def sample_list_authorization_policies(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.ListAuthorizationPoliciesRequest( @@ -267,7 +268,7 @@ def sample_list_authorization_policies(): page_result = client.list_authorization_policies(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -329,12 +330,20 @@ def sample_list_authorization_policies(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListAuthorizationPoliciesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -355,9 +364,9 @@ async def get_authorization_policy( from google.cloud import network_security_v1beta1 - def sample_get_authorization_policy(): + async def sample_get_authorization_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.GetAuthorizationPolicyRequest( @@ -365,7 +374,7 @@ def sample_get_authorization_policy(): ) # Make the request - response = client.get_authorization_policy(request=request) + response = await client.get_authorization_policy(request=request) # Handle the response print(response) @@ -431,7 +440,12 @@ def sample_get_authorization_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -452,14 +466,13 @@ async def create_authorization_policy( r"""Creates a new AuthorizationPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_create_authorization_policy(): + async def sample_create_authorization_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) authorization_policy = network_security_v1beta1.AuthorizationPolicy() @@ -477,7 +490,7 @@ def sample_create_authorization_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -566,7 +579,12 @@ def sample_create_authorization_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -594,14 +612,13 @@ async def update_authorization_policy( r"""Updates the parameters of a single AuthorizationPolicy. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_update_authorization_policy(): + async def sample_update_authorization_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) authorization_policy = network_security_v1beta1.AuthorizationPolicy() @@ -617,7 +634,7 @@ def sample_update_authorization_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -698,7 +715,12 @@ def sample_update_authorization_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -728,9 +750,9 @@ async def delete_authorization_policy( from google.cloud import network_security_v1beta1 - def sample_delete_authorization_policy(): + async def sample_delete_authorization_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.DeleteAuthorizationPolicyRequest( @@ -742,7 +764,7 @@ def sample_delete_authorization_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -816,7 +838,12 @@ def sample_delete_authorization_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -841,14 +868,13 @@ async def list_server_tls_policies( r"""Lists ServerTlsPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_list_server_tls_policies(): + async def sample_list_server_tls_policies(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.ListServerTlsPoliciesRequest( @@ -859,7 +885,7 @@ def sample_list_server_tls_policies(): page_result = client.list_server_tls_policies(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -921,12 +947,20 @@ def sample_list_server_tls_policies(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListServerTlsPoliciesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -947,9 +981,9 @@ async def get_server_tls_policy( from google.cloud import network_security_v1beta1 - def sample_get_server_tls_policy(): + async def sample_get_server_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.GetServerTlsPolicyRequest( @@ -957,7 +991,7 @@ def sample_get_server_tls_policy(): ) # Make the request - response = client.get_server_tls_policy(request=request) + response = await client.get_server_tls_policy(request=request) # Handle the response print(response) @@ -1023,7 +1057,12 @@ def sample_get_server_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1042,14 +1081,13 @@ async def create_server_tls_policy( r"""Creates a new ServerTlsPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_create_server_tls_policy(): + async def sample_create_server_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) server_tls_policy = network_security_v1beta1.ServerTlsPolicy() @@ -1066,7 +1104,7 @@ def sample_create_server_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1153,7 +1191,12 @@ def sample_create_server_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1182,9 +1225,9 @@ async def update_server_tls_policy( from google.cloud import network_security_v1beta1 - def sample_update_server_tls_policy(): + async def sample_update_server_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) server_tls_policy = network_security_v1beta1.ServerTlsPolicy() @@ -1199,7 +1242,7 @@ def sample_update_server_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1280,7 +1323,12 @@ def sample_update_server_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1308,9 +1356,9 @@ async def delete_server_tls_policy( from google.cloud import network_security_v1beta1 - def sample_delete_server_tls_policy(): + async def sample_delete_server_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.DeleteServerTlsPolicyRequest( @@ -1322,7 +1370,7 @@ def sample_delete_server_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1396,7 +1444,12 @@ def sample_delete_server_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1421,14 +1474,13 @@ async def list_client_tls_policies( r"""Lists ClientTlsPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_list_client_tls_policies(): + async def sample_list_client_tls_policies(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.ListClientTlsPoliciesRequest( @@ -1439,7 +1491,7 @@ def sample_list_client_tls_policies(): page_result = client.list_client_tls_policies(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1501,12 +1553,20 @@ def sample_list_client_tls_policies(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListClientTlsPoliciesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1527,9 +1587,9 @@ async def get_client_tls_policy( from google.cloud import network_security_v1beta1 - def sample_get_client_tls_policy(): + async def sample_get_client_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.GetClientTlsPolicyRequest( @@ -1537,7 +1597,7 @@ def sample_get_client_tls_policy(): ) # Make the request - response = client.get_client_tls_policy(request=request) + response = await client.get_client_tls_policy(request=request) # Handle the response print(response) @@ -1602,7 +1662,12 @@ def sample_get_client_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1621,14 +1686,13 @@ async def create_client_tls_policy( r"""Creates a new ClientTlsPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 - def sample_create_client_tls_policy(): + async def sample_create_client_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) client_tls_policy = network_security_v1beta1.ClientTlsPolicy() @@ -1645,7 +1709,7 @@ def sample_create_client_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1731,7 +1795,12 @@ def sample_create_client_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1760,9 +1829,9 @@ async def update_client_tls_policy( from google.cloud import network_security_v1beta1 - def sample_update_client_tls_policy(): + async def sample_update_client_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) client_tls_policy = network_security_v1beta1.ClientTlsPolicy() @@ -1777,7 +1846,7 @@ def sample_update_client_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1857,7 +1926,12 @@ def sample_update_client_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -1885,9 +1959,9 @@ async def delete_client_tls_policy( from google.cloud import network_security_v1beta1 - def sample_delete_client_tls_policy(): + async def sample_delete_client_tls_policy(): # Create a client - client = network_security_v1beta1.NetworkSecurityClient() + client = network_security_v1beta1.NetworkSecurityAsyncClient() # Initialize request argument(s) request = network_security_v1beta1.DeleteClientTlsPolicyRequest( @@ -1899,7 +1973,7 @@ def sample_delete_client_tls_policy(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -1973,7 +2047,12 @@ def sample_delete_client_tls_policy(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( diff --git a/google/cloud/network_security_v1beta1/services/network_security/client.py b/google/cloud/network_security_v1beta1/services/network_security/client.py index ad9ab85..1e5fd91 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/client.py +++ b/google/cloud/network_security_v1beta1/services/network_security/client.py @@ -16,18 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union -import pkg_resources +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union 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] @@ -36,25 +36,27 @@ from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore +from google.protobuf import empty_pb2 # type: ignore +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore + from google.cloud.network_security_v1beta1.services.network_security import pagers -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import common -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import common +from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import tls -from google.protobuf import empty_pb2 # type: ignore -from google.protobuf import field_mask_pb2 # type: ignore -from google.protobuf import timestamp_pb2 # type: ignore -from .transports.base import NetworkSecurityTransport, DEFAULT_CLIENT_INFO + +from .transports.base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport from .transports.grpc import NetworkSecurityGrpcTransport from .transports.grpc_asyncio import NetworkSecurityGrpcAsyncIOTransport @@ -73,7 +75,10 @@ class NetworkSecurityClientMeta(type): _transport_registry["grpc"] = NetworkSecurityGrpcTransport _transport_registry["grpc_asyncio"] = NetworkSecurityGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[NetworkSecurityTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[NetworkSecurityTransport]: """Returns an appropriate transport class. Args: @@ -182,7 +187,9 @@ def transport(self) -> NetworkSecurityTransport: @staticmethod def authorization_policy_path( - project: str, location: str, authorization_policy: str, + project: str, + location: str, + authorization_policy: str, ) -> str: """Returns a fully-qualified authorization_policy string.""" return "projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}".format( @@ -202,11 +209,15 @@ def parse_authorization_policy_path(path: str) -> Dict[str, str]: @staticmethod def client_tls_policy_path( - project: str, location: str, client_tls_policy: str, + project: str, + location: str, + client_tls_policy: str, ) -> str: """Returns a fully-qualified client_tls_policy string.""" return "projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}".format( - project=project, location=location, client_tls_policy=client_tls_policy, + project=project, + location=location, + client_tls_policy=client_tls_policy, ) @staticmethod @@ -220,11 +231,15 @@ def parse_client_tls_policy_path(path: str) -> Dict[str, str]: @staticmethod def server_tls_policy_path( - project: str, location: str, server_tls_policy: str, + project: str, + location: str, + server_tls_policy: str, ) -> str: """Returns a fully-qualified server_tls_policy string.""" return "projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}".format( - project=project, location=location, server_tls_policy=server_tls_policy, + project=project, + location=location, + server_tls_policy=server_tls_policy, ) @staticmethod @@ -237,7 +252,9 @@ def parse_server_tls_policy_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -250,9 +267,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -261,9 +282,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -272,9 +297,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -283,10 +312,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -474,7 +507,6 @@ def list_authorization_policies( r"""Lists AuthorizationPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -558,12 +590,20 @@ def sample_list_authorization_policies(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListAuthorizationPoliciesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -660,7 +700,12 @@ def sample_get_authorization_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -681,7 +726,6 @@ def create_authorization_policy( r"""Creates a new AuthorizationPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -799,7 +843,12 @@ def sample_create_authorization_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -827,7 +876,6 @@ def update_authorization_policy( r"""Updates the parameters of a single AuthorizationPolicy. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -935,7 +983,12 @@ def sample_update_authorization_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1057,7 +1110,12 @@ def sample_delete_authorization_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1082,7 +1140,6 @@ def list_server_tls_policies( r"""Lists ServerTlsPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -1162,12 +1219,20 @@ def sample_list_server_tls_policies(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListServerTlsPoliciesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1264,7 +1329,12 @@ def sample_get_server_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1283,7 +1353,6 @@ def create_server_tls_policy( r"""Creates a new ServerTlsPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -1394,7 +1463,12 @@ def sample_create_server_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1521,7 +1595,12 @@ def sample_update_server_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1637,7 +1716,12 @@ def sample_delete_server_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -1662,7 +1746,6 @@ def list_client_tls_policies( r"""Lists ClientTlsPolicies in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -1742,12 +1825,20 @@ def sample_list_client_tls_policies(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListClientTlsPoliciesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1843,7 +1934,12 @@ def sample_get_client_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1862,7 +1958,6 @@ def create_client_tls_policy( r"""Creates a new ClientTlsPolicy in a given project and location. - .. code-block:: python from google.cloud import network_security_v1beta1 @@ -1972,7 +2067,12 @@ def sample_create_client_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2098,7 +2198,12 @@ def sample_update_client_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2214,7 +2319,12 @@ def sample_delete_client_tls_policy(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( diff --git a/google/cloud/network_security_v1beta1/services/network_security/pagers.py b/google/cloud/network_security_v1beta1/services/network_security/pagers.py index 4ad775e..5231f0f 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/pagers.py +++ b/google/cloud/network_security_v1beta1/services/network_security/pagers.py @@ -18,15 +18,17 @@ AsyncIterator, Awaitable, Callable, + Iterator, + Optional, Sequence, Tuple, - Optional, - Iterator, ) -from google.cloud.network_security_v1beta1.types import authorization_policy -from google.cloud.network_security_v1beta1.types import client_tls_policy -from google.cloud.network_security_v1beta1.types import server_tls_policy +from google.cloud.network_security_v1beta1.types import ( + authorization_policy, + client_tls_policy, + server_tls_policy, +) class ListAuthorizationPoliciesPager: diff --git a/google/cloud/network_security_v1beta1/services/network_security/transports/__init__.py b/google/cloud/network_security_v1beta1/services/network_security/transports/__init__.py index 6aadee0..e6f7341 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/transports/__init__.py +++ b/google/cloud/network_security_v1beta1/services/network_security/transports/__init__.py @@ -20,7 +20,6 @@ from .grpc import NetworkSecurityGrpcTransport from .grpc_asyncio import NetworkSecurityGrpcAsyncIOTransport - # Compile a registry of transports. _transport_registry = OrderedDict() # type: Dict[str, Type[NetworkSecurityTransport]] _transport_registry["grpc"] = NetworkSecurityGrpcTransport diff --git a/google/cloud/network_security_v1beta1/services/network_security/transports/base.py b/google/cloud/network_security_v1beta1/services/network_security/transports/base.py index 5d6954b..7c12955 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/transports/base.py +++ b/google/cloud/network_security_v1beta1/services/network_security/transports/base.py @@ -15,30 +15,29 @@ # 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 gapic_v1, operations_v1 from google.api_core import retry as retries -from google.api_core import operations_v1 +import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore +from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore +import pkg_resources -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) -from google.longrunning import operations_pb2 # type: ignore +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import server_tls_policy try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( @@ -93,6 +92,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -213,9 +213,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -377,5 +377,9 @@ def delete_client_tls_policy( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("NetworkSecurityTransport",) diff --git a/google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py b/google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py index ec292c0..443f1bb 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py +++ b/google/cloud/network_security_v1beta1/services/network_security/transports/grpc.py @@ -13,32 +13,30 @@ # 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 operations_v1 -from google.api_core import gapic_v1 +from google.api_core import gapic_v1, grpc_helpers, operations_v1 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.longrunning import operations_pb2 # type: ignore import grpc # type: ignore -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) -from google.longrunning import operations_pb2 # type: ignore -from .base import NetworkSecurityTransport, DEFAULT_CLIENT_INFO +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import server_tls_policy + +from .base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport class NetworkSecurityGrpcTransport(NetworkSecurityTransport): @@ -240,8 +238,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -695,5 +692,9 @@ def delete_client_tls_policy( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("NetworkSecurityGrpcTransport",) diff --git a/google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py b/google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py index e86bf2e..fecae04 100644 --- a/google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py +++ b/google/cloud/network_security_v1beta1/services/network_security/transports/grpc_asyncio.py @@ -13,32 +13,30 @@ # 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 operations_v1 +from google.api_core import gapic_v1, grpc_helpers_async, operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore - +from google.longrunning import operations_pb2 # type: ignore import grpc # type: ignore from grpc.experimental import aio # type: ignore -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) -from google.longrunning import operations_pb2 # type: ignore -from .base import NetworkSecurityTransport, DEFAULT_CLIENT_INFO +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import server_tls_policy + +from .base import DEFAULT_CLIENT_INFO, NetworkSecurityTransport from .grpc import NetworkSecurityGrpcTransport diff --git a/google/cloud/network_security_v1beta1/types/authorization_policy.py b/google/cloud/network_security_v1beta1/types/authorization_policy.py index ba43733..0365c53 100644 --- a/google/cloud/network_security_v1beta1/types/authorization_policy.py +++ b/google/cloud/network_security_v1beta1/types/authorization_policy.py @@ -13,11 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - 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.networksecurity.v1beta1", @@ -53,7 +51,7 @@ class AuthorizationPolicy(proto.Message): update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when the resource was updated. - labels (Sequence[google.cloud.network_security_v1beta1.types.AuthorizationPolicy.LabelsEntry]): + labels (Mapping[str, str]): Optional. Set of label tags associated with the AuthorizationPolicy resource. action (google.cloud.network_security_v1beta1.types.AuthorizationPolicy.Action): @@ -118,8 +116,14 @@ class Source(proto.Message): or proxies should be considered untrusted. """ - principals = proto.RepeatedField(proto.STRING, number=1,) - ip_blocks = proto.RepeatedField(proto.STRING, number=2,) + principals = proto.RepeatedField( + proto.STRING, + number=1, + ) + ip_blocks = proto.RepeatedField( + proto.STRING, + number=2, + ) class Destination(proto.Message): r"""Specification of traffic destination attributes. @@ -174,12 +178,28 @@ class HttpHeaderMatch(proto.Message): method, use the headerName ":method". """ - regex_match = proto.Field(proto.STRING, number=2, oneof="type",) - header_name = proto.Field(proto.STRING, number=1,) - - hosts = proto.RepeatedField(proto.STRING, number=1,) - ports = proto.RepeatedField(proto.UINT32, number=2,) - methods = proto.RepeatedField(proto.STRING, number=4,) + regex_match = proto.Field( + proto.STRING, + number=2, + oneof="type", + ) + header_name = proto.Field( + proto.STRING, + number=1, + ) + + hosts = proto.RepeatedField( + proto.STRING, + number=1, + ) + ports = proto.RepeatedField( + proto.UINT32, + number=2, + ) + methods = proto.RepeatedField( + proto.STRING, + number=4, + ) http_header_match = proto.Field( proto.MESSAGE, number=5, @@ -187,19 +207,49 @@ class HttpHeaderMatch(proto.Message): ) sources = proto.RepeatedField( - proto.MESSAGE, number=1, message="AuthorizationPolicy.Rule.Source", + proto.MESSAGE, + number=1, + message="AuthorizationPolicy.Rule.Source", ) destinations = proto.RepeatedField( - proto.MESSAGE, number=2, message="AuthorizationPolicy.Rule.Destination", + proto.MESSAGE, + number=2, + message="AuthorizationPolicy.Rule.Destination", ) - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=5,) - action = proto.Field(proto.ENUM, number=6, enum=Action,) - rules = proto.RepeatedField(proto.MESSAGE, number=7, message=Rule,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + create_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + action = proto.Field( + proto.ENUM, + number=6, + enum=Action, + ) + rules = proto.RepeatedField( + proto.MESSAGE, + number=7, + message=Rule, + ) class ListAuthorizationPoliciesRequest(proto.Message): @@ -221,9 +271,18 @@ class ListAuthorizationPoliciesRequest(proto.Message): data. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListAuthorizationPoliciesResponse(proto.Message): @@ -244,9 +303,14 @@ def raw_page(self): return self authorization_policies = proto.RepeatedField( - proto.MESSAGE, number=1, message="AuthorizationPolicy", + proto.MESSAGE, + number=1, + message="AuthorizationPolicy", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetAuthorizationPolicyRequest(proto.Message): @@ -259,7 +323,10 @@ class GetAuthorizationPolicyRequest(proto.Message): ``projects/{project}/locations/{location}/authorizationPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateAuthorizationPolicyRequest(proto.Message): @@ -280,10 +347,18 @@ class CreateAuthorizationPolicyRequest(proto.Message): created. """ - parent = proto.Field(proto.STRING, number=1,) - authorization_policy_id = proto.Field(proto.STRING, number=2,) + parent = proto.Field( + proto.STRING, + number=1, + ) + authorization_policy_id = proto.Field( + proto.STRING, + number=2, + ) authorization_policy = proto.Field( - proto.MESSAGE, number=3, message="AuthorizationPolicy", + proto.MESSAGE, + number=3, + message="AuthorizationPolicy", ) @@ -304,10 +379,14 @@ class UpdateAuthorizationPolicyRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, ) authorization_policy = proto.Field( - proto.MESSAGE, number=2, message="AuthorizationPolicy", + proto.MESSAGE, + number=2, + message="AuthorizationPolicy", ) @@ -321,7 +400,10 @@ class DeleteAuthorizationPolicyRequest(proto.Message): ``projects/{project}/locations/{location}/authorizationPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/network_security_v1beta1/types/client_tls_policy.py b/google/cloud/network_security_v1beta1/types/client_tls_policy.py index 8d924f8..c527d0b 100644 --- a/google/cloud/network_security_v1beta1/types/client_tls_policy.py +++ b/google/cloud/network_security_v1beta1/types/client_tls_policy.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.network_security_v1beta1.types import tls from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.network_security_v1beta1.types import tls __protobuf__ = proto.module( package="google.cloud.networksecurity.v1beta1", @@ -54,7 +53,7 @@ class ClientTlsPolicy(proto.Message): update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when the resource was updated. - labels (Sequence[google.cloud.network_security_v1beta1.types.ClientTlsPolicy.LabelsEntry]): + labels (Mapping[str, str]): Optional. Set of label tags associated with the resource. sni (str): @@ -73,17 +72,42 @@ class ClientTlsPolicy(proto.Message): not validate the server certificate. """ - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=5,) - sni = proto.Field(proto.STRING, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + create_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + sni = proto.Field( + proto.STRING, + number=6, + ) client_certificate = proto.Field( - proto.MESSAGE, number=7, message=tls.CertificateProvider, + proto.MESSAGE, + number=7, + message=tls.CertificateProvider, ) server_validation_ca = proto.RepeatedField( - proto.MESSAGE, number=8, message=tls.ValidationCA, + proto.MESSAGE, + number=8, + message=tls.ValidationCA, ) @@ -105,9 +129,18 @@ class ListClientTlsPoliciesRequest(proto.Message): that the system should return the next page of data. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListClientTlsPoliciesResponse(proto.Message): @@ -128,9 +161,14 @@ def raw_page(self): return self client_tls_policies = proto.RepeatedField( - proto.MESSAGE, number=1, message="ClientTlsPolicy", + proto.MESSAGE, + number=1, + message="ClientTlsPolicy", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetClientTlsPolicyRequest(proto.Message): @@ -143,7 +181,10 @@ class GetClientTlsPolicyRequest(proto.Message): ``projects/*/locations/{location}/clientTlsPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateClientTlsPolicyRequest(proto.Message): @@ -164,9 +205,19 @@ class CreateClientTlsPolicyRequest(proto.Message): created. """ - parent = proto.Field(proto.STRING, number=1,) - client_tls_policy_id = proto.Field(proto.STRING, number=2,) - client_tls_policy = proto.Field(proto.MESSAGE, number=3, message="ClientTlsPolicy",) + parent = proto.Field( + proto.STRING, + number=1, + ) + client_tls_policy_id = proto.Field( + proto.STRING, + number=2, + ) + client_tls_policy = proto.Field( + proto.MESSAGE, + number=3, + message="ClientTlsPolicy", + ) class UpdateClientTlsPolicyRequest(proto.Message): @@ -185,9 +236,15 @@ class UpdateClientTlsPolicyRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + client_tls_policy = proto.Field( + proto.MESSAGE, + number=2, + message="ClientTlsPolicy", ) - client_tls_policy = proto.Field(proto.MESSAGE, number=2, message="ClientTlsPolicy",) class DeleteClientTlsPolicyRequest(proto.Message): @@ -200,7 +257,10 @@ class DeleteClientTlsPolicyRequest(proto.Message): ``projects/*/locations/{location}/clientTlsPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/network_security_v1beta1/types/common.py b/google/cloud/network_security_v1beta1/types/common.py index 58cd6da..1a5b565 100644 --- a/google/cloud/network_security_v1beta1/types/common.py +++ b/google/cloud/network_security_v1beta1/types/common.py @@ -13,13 +13,14 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - from google.protobuf import timestamp_pb2 # type: ignore - +import proto # type: ignore __protobuf__ = proto.module( - package="google.cloud.networksecurity.v1beta1", manifest={"OperationMetadata",}, + package="google.cloud.networksecurity.v1beta1", + manifest={ + "OperationMetadata", + }, ) @@ -53,13 +54,36 @@ class OperationMetadata(proto.Message): operation. """ - create_time = proto.Field(proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - target = proto.Field(proto.STRING, number=3,) - verb = proto.Field(proto.STRING, number=4,) - status_message = proto.Field(proto.STRING, number=5,) - requested_cancellation = proto.Field(proto.BOOL, number=6,) - api_version = proto.Field(proto.STRING, number=7,) + create_time = proto.Field( + proto.MESSAGE, + number=1, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + target = proto.Field( + proto.STRING, + number=3, + ) + verb = proto.Field( + proto.STRING, + number=4, + ) + status_message = proto.Field( + proto.STRING, + number=5, + ) + requested_cancellation = proto.Field( + proto.BOOL, + number=6, + ) + api_version = proto.Field( + proto.STRING, + number=7, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/network_security_v1beta1/types/network_security.py b/google/cloud/network_security_v1beta1/types/network_security.py index ce8708f..e722c9a 100644 --- a/google/cloud/network_security_v1beta1/types/network_security.py +++ b/google/cloud/network_security_v1beta1/types/network_security.py @@ -16,7 +16,8 @@ __protobuf__ = proto.module( - package="google.cloud.networksecurity.v1beta1", manifest={}, + package="google.cloud.networksecurity.v1beta1", + manifest={}, ) diff --git a/google/cloud/network_security_v1beta1/types/server_tls_policy.py b/google/cloud/network_security_v1beta1/types/server_tls_policy.py index 3181f82..cdb8968 100644 --- a/google/cloud/network_security_v1beta1/types/server_tls_policy.py +++ b/google/cloud/network_security_v1beta1/types/server_tls_policy.py @@ -13,12 +13,11 @@ # See the License for the specific language governing permissions and # limitations under the License. # -import proto # type: ignore - -from google.cloud.network_security_v1beta1.types import tls from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore +import proto # type: ignore +from google.cloud.network_security_v1beta1.types import tls __protobuf__ = proto.module( package="google.cloud.networksecurity.v1beta1", @@ -53,7 +52,7 @@ class ServerTlsPolicy(proto.Message): update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. The timestamp when the resource was updated. - labels (Sequence[google.cloud.network_security_v1beta1.types.ServerTlsPolicy.LabelsEntry]): + labels (Mapping[str, str]): Set of label tags associated with the resource. allow_open (bool): @@ -89,19 +88,48 @@ class MTLSPolicy(proto.Message): """ client_validation_ca = proto.RepeatedField( - proto.MESSAGE, number=1, message=tls.ValidationCA, + proto.MESSAGE, + number=1, + message=tls.ValidationCA, ) - name = proto.Field(proto.STRING, number=1,) - description = proto.Field(proto.STRING, number=2,) - create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,) - labels = proto.MapField(proto.STRING, proto.STRING, number=5,) - allow_open = proto.Field(proto.BOOL, number=6,) + name = proto.Field( + proto.STRING, + number=1, + ) + description = proto.Field( + proto.STRING, + number=2, + ) + create_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=4, + message=timestamp_pb2.Timestamp, + ) + labels = proto.MapField( + proto.STRING, + proto.STRING, + number=5, + ) + allow_open = proto.Field( + proto.BOOL, + number=6, + ) server_certificate = proto.Field( - proto.MESSAGE, number=7, message=tls.CertificateProvider, + proto.MESSAGE, + number=7, + message=tls.CertificateProvider, + ) + mtls_policy = proto.Field( + proto.MESSAGE, + number=8, + message=MTLSPolicy, ) - mtls_policy = proto.Field(proto.MESSAGE, number=8, message=MTLSPolicy,) class ListServerTlsPoliciesRequest(proto.Message): @@ -122,9 +150,18 @@ class ListServerTlsPoliciesRequest(proto.Message): that the system should return the next page of data. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListServerTlsPoliciesResponse(proto.Message): @@ -145,9 +182,14 @@ def raw_page(self): return self server_tls_policies = proto.RepeatedField( - proto.MESSAGE, number=1, message="ServerTlsPolicy", + proto.MESSAGE, + number=1, + message="ServerTlsPolicy", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, ) - next_page_token = proto.Field(proto.STRING, number=2,) class GetServerTlsPolicyRequest(proto.Message): @@ -160,7 +202,10 @@ class GetServerTlsPolicyRequest(proto.Message): ``projects/*/locations/{location}/serverTlsPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateServerTlsPolicyRequest(proto.Message): @@ -181,9 +226,19 @@ class CreateServerTlsPolicyRequest(proto.Message): created. """ - parent = proto.Field(proto.STRING, number=1,) - server_tls_policy_id = proto.Field(proto.STRING, number=2,) - server_tls_policy = proto.Field(proto.MESSAGE, number=3, message="ServerTlsPolicy",) + parent = proto.Field( + proto.STRING, + number=1, + ) + server_tls_policy_id = proto.Field( + proto.STRING, + number=2, + ) + server_tls_policy = proto.Field( + proto.MESSAGE, + number=3, + message="ServerTlsPolicy", + ) class UpdateServerTlsPolicyRequest(proto.Message): @@ -202,9 +257,15 @@ class UpdateServerTlsPolicyRequest(proto.Message): """ update_mask = proto.Field( - proto.MESSAGE, number=1, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=1, + message=field_mask_pb2.FieldMask, + ) + server_tls_policy = proto.Field( + proto.MESSAGE, + number=2, + message="ServerTlsPolicy", ) - server_tls_policy = proto.Field(proto.MESSAGE, number=2, message="ServerTlsPolicy",) class DeleteServerTlsPolicyRequest(proto.Message): @@ -217,7 +278,10 @@ class DeleteServerTlsPolicyRequest(proto.Message): ``projects/*/locations/{location}/serverTlsPolicies/*``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/network_security_v1beta1/types/tls.py b/google/cloud/network_security_v1beta1/types/tls.py index 1a58dbd..bbebd45 100644 --- a/google/cloud/network_security_v1beta1/types/tls.py +++ b/google/cloud/network_security_v1beta1/types/tls.py @@ -15,7 +15,6 @@ # import proto # type: ignore - __protobuf__ = proto.module( package="google.cloud.networksecurity.v1beta1", manifest={ @@ -37,7 +36,10 @@ class GrpcEndpoint(proto.Message): start with “unix:”. """ - target_uri = proto.Field(proto.STRING, number=1,) + target_uri = proto.Field( + proto.STRING, + number=1, + ) class ValidationCA(proto.Message): @@ -68,10 +70,16 @@ class ValidationCA(proto.Message): """ grpc_endpoint = proto.Field( - proto.MESSAGE, number=2, oneof="type", message="GrpcEndpoint", + proto.MESSAGE, + number=2, + oneof="type", + message="GrpcEndpoint", ) certificate_provider_instance = proto.Field( - proto.MESSAGE, number=3, oneof="type", message="CertificateProviderInstance", + proto.MESSAGE, + number=3, + oneof="type", + message="CertificateProviderInstance", ) @@ -91,7 +99,10 @@ class CertificateProviderInstance(proto.Message): Service certificate provider instance. """ - plugin_instance = proto.Field(proto.STRING, number=1,) + plugin_instance = proto.Field( + proto.STRING, + number=1, + ) class CertificateProvider(proto.Message): @@ -122,10 +133,16 @@ class CertificateProvider(proto.Message): """ grpc_endpoint = proto.Field( - proto.MESSAGE, number=2, oneof="type", message="GrpcEndpoint", + proto.MESSAGE, + number=2, + oneof="type", + message="GrpcEndpoint", ) certificate_provider_instance = proto.Field( - proto.MESSAGE, number=3, oneof="type", message="CertificateProviderInstance", + proto.MESSAGE, + number=3, + oneof="type", + message="CertificateProviderInstance", ) diff --git a/noxfile.py b/noxfile.py index 2a2001c..7c1742d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -17,19 +17,45 @@ # Generated by synthtool. DO NOT EDIT! from __future__ import absolute_import + import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +83,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +95,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +127,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +185,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,13 +236,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_async.py deleted file mode 100644 index 7b32dae..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateAuthorizationPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_create_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - authorization_policy = network_security_v1beta1.AuthorizationPolicy() - authorization_policy.name = "name_value" - authorization_policy.action = "DENY" - - request = network_security_v1beta1.CreateAuthorizationPolicyRequest( - parent="parent_value", - authorization_policy_id="authorization_policy_id_value", - authorization_policy=authorization_policy, - ) - - # Make the request - operation = client.create_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateAuthorizationPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_sync.py deleted file mode 100644 index 3196715..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_authorization_policy_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateAuthorizationPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_create_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - authorization_policy = network_security_v1beta1.AuthorizationPolicy() - authorization_policy.name = "name_value" - authorization_policy.action = "DENY" - - request = network_security_v1beta1.CreateAuthorizationPolicyRequest( - parent="parent_value", - authorization_policy_id="authorization_policy_id_value", - authorization_policy=authorization_policy, - ) - - # Make the request - operation = client.create_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateAuthorizationPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_async.py deleted file mode 100644 index c185bca..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateClientTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_create_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - client_tls_policy = network_security_v1beta1.ClientTlsPolicy() - client_tls_policy.name = "name_value" - - request = network_security_v1beta1.CreateClientTlsPolicyRequest( - parent="parent_value", - client_tls_policy_id="client_tls_policy_id_value", - client_tls_policy=client_tls_policy, - ) - - # Make the request - operation = client.create_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateClientTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_sync.py deleted file mode 100644 index b463ce1..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_client_tls_policy_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateClientTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_create_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - client_tls_policy = network_security_v1beta1.ClientTlsPolicy() - client_tls_policy.name = "name_value" - - request = network_security_v1beta1.CreateClientTlsPolicyRequest( - parent="parent_value", - client_tls_policy_id="client_tls_policy_id_value", - client_tls_policy=client_tls_policy, - ) - - # Make the request - operation = client.create_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateClientTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_async.py deleted file mode 100644 index e9ed105..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateServerTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_create_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - server_tls_policy = network_security_v1beta1.ServerTlsPolicy() - server_tls_policy.name = "name_value" - - request = network_security_v1beta1.CreateServerTlsPolicyRequest( - parent="parent_value", - server_tls_policy_id="server_tls_policy_id_value", - server_tls_policy=server_tls_policy, - ) - - # Make the request - operation = client.create_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateServerTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_sync.py deleted file mode 100644 index d669d19..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_create_server_tls_policy_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateServerTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_create_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - server_tls_policy = network_security_v1beta1.ServerTlsPolicy() - server_tls_policy.name = "name_value" - - request = network_security_v1beta1.CreateServerTlsPolicyRequest( - parent="parent_value", - server_tls_policy_id="server_tls_policy_id_value", - server_tls_policy=server_tls_policy, - ) - - # Make the request - operation = client.create_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_CreateServerTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_async.py deleted file mode 100644 index 19661b0..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteAuthorizationPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_delete_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteAuthorizationPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteAuthorizationPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_sync.py deleted file mode 100644 index 8bf6adc..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_authorization_policy_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteAuthorizationPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_delete_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteAuthorizationPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteAuthorizationPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_async.py deleted file mode 100644 index 5800903..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteClientTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_delete_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteClientTlsPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteClientTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_sync.py deleted file mode 100644 index 5f2a012..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_client_tls_policy_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteClientTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_delete_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteClientTlsPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteClientTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_async.py deleted file mode 100644 index bb72dd6..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteServerTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_delete_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteServerTlsPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteServerTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_sync.py deleted file mode 100644 index 8c4403b..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_delete_server_tls_policy_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteServerTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_delete_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.DeleteServerTlsPolicyRequest( - name="name_value", - ) - - # Make the request - operation = client.delete_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_DeleteServerTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_async.py deleted file mode 100644 index d4940f6..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetAuthorizationPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_get_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetAuthorizationPolicyRequest( - name="name_value", - ) - - # Make the request - response = await client.get_authorization_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetAuthorizationPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_sync.py deleted file mode 100644 index 5e8b96c..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_authorization_policy_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetAuthorizationPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_get_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetAuthorizationPolicyRequest( - name="name_value", - ) - - # Make the request - response = client.get_authorization_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetAuthorizationPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_async.py deleted file mode 100644 index 7e5d3bd..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetClientTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_get_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetClientTlsPolicyRequest( - name="name_value", - ) - - # Make the request - response = await client.get_client_tls_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetClientTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_sync.py deleted file mode 100644 index 8030682..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_client_tls_policy_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetClientTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_get_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetClientTlsPolicyRequest( - name="name_value", - ) - - # Make the request - response = client.get_client_tls_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetClientTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_async.py deleted file mode 100644 index 3973e77..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_async.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetServerTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_get_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetServerTlsPolicyRequest( - name="name_value", - ) - - # Make the request - response = await client.get_server_tls_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetServerTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_sync.py deleted file mode 100644 index 990b3a3..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_get_server_tls_policy_sync.py +++ /dev/null @@ -1,45 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetServerTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_get_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.GetServerTlsPolicyRequest( - name="name_value", - ) - - # Make the request - response = client.get_server_tls_policy(request=request) - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_GetServerTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_async.py deleted file mode 100644 index 62d9a91..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizationPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListAuthorizationPolicies_async] -from google.cloud import network_security_v1beta1 - - -async def sample_list_authorization_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListAuthorizationPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_authorization_policies(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListAuthorizationPolicies_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_sync.py deleted file mode 100644 index e51ca16..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_authorization_policies_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAuthorizationPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListAuthorizationPolicies_sync] -from google.cloud import network_security_v1beta1 - - -def sample_list_authorization_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListAuthorizationPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_authorization_policies(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListAuthorizationPolicies_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_async.py deleted file mode 100644 index 02bfd94..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListClientTlsPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListClientTlsPolicies_async] -from google.cloud import network_security_v1beta1 - - -async def sample_list_client_tls_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListClientTlsPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_client_tls_policies(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListClientTlsPolicies_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_sync.py deleted file mode 100644 index 3be086a..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_client_tls_policies_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListClientTlsPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListClientTlsPolicies_sync] -from google.cloud import network_security_v1beta1 - - -def sample_list_client_tls_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListClientTlsPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_client_tls_policies(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListClientTlsPolicies_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_async.py deleted file mode 100644 index a9b6405..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_async.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListServerTlsPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListServerTlsPolicies_async] -from google.cloud import network_security_v1beta1 - - -async def sample_list_server_tls_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListServerTlsPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_server_tls_policies(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListServerTlsPolicies_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_sync.py deleted file mode 100644 index 3bcc150..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_list_server_tls_policies_sync.py +++ /dev/null @@ -1,46 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListServerTlsPolicies -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListServerTlsPolicies_sync] -from google.cloud import network_security_v1beta1 - - -def sample_list_server_tls_policies(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - request = network_security_v1beta1.ListServerTlsPoliciesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_server_tls_policies(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_ListServerTlsPolicies_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_async.py deleted file mode 100644 index 3258e3e..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateAuthorizationPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_update_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - authorization_policy = network_security_v1beta1.AuthorizationPolicy() - authorization_policy.name = "name_value" - authorization_policy.action = "DENY" - - request = network_security_v1beta1.UpdateAuthorizationPolicyRequest( - authorization_policy=authorization_policy, - ) - - # Make the request - operation = client.update_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateAuthorizationPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_sync.py deleted file mode 100644 index 2278da8..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_authorization_policy_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAuthorizationPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateAuthorizationPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_update_authorization_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - authorization_policy = network_security_v1beta1.AuthorizationPolicy() - authorization_policy.name = "name_value" - authorization_policy.action = "DENY" - - request = network_security_v1beta1.UpdateAuthorizationPolicyRequest( - authorization_policy=authorization_policy, - ) - - # Make the request - operation = client.update_authorization_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateAuthorizationPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_async.py deleted file mode 100644 index bf6851a..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateClientTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_update_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - client_tls_policy = network_security_v1beta1.ClientTlsPolicy() - client_tls_policy.name = "name_value" - - request = network_security_v1beta1.UpdateClientTlsPolicyRequest( - client_tls_policy=client_tls_policy, - ) - - # Make the request - operation = client.update_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateClientTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_sync.py deleted file mode 100644 index f85c728..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_client_tls_policy_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateClientTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateClientTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_update_client_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - client_tls_policy = network_security_v1beta1.ClientTlsPolicy() - client_tls_policy.name = "name_value" - - request = network_security_v1beta1.UpdateClientTlsPolicyRequest( - client_tls_policy=client_tls_policy, - ) - - # Make the request - operation = client.update_client_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateClientTlsPolicy_sync] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_async.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_async.py deleted file mode 100644 index 27cb2fc..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateServerTlsPolicy_async] -from google.cloud import network_security_v1beta1 - - -async def sample_update_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityAsyncClient() - - # Initialize request argument(s) - server_tls_policy = network_security_v1beta1.ServerTlsPolicy() - server_tls_policy.name = "name_value" - - request = network_security_v1beta1.UpdateServerTlsPolicyRequest( - server_tls_policy=server_tls_policy, - ) - - # Make the request - operation = client.update_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = await operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateServerTlsPolicy_async] diff --git a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_sync.py b/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_sync.py deleted file mode 100644 index e43433c..0000000 --- a/samples/generated_samples/networksecurity_generated_network_security_v1beta1_network_security_update_server_tls_policy_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2020 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. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateServerTlsPolicy -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-cloud-network-security - - -# [START networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateServerTlsPolicy_sync] -from google.cloud import network_security_v1beta1 - - -def sample_update_server_tls_policy(): - # Create a client - client = network_security_v1beta1.NetworkSecurityClient() - - # Initialize request argument(s) - server_tls_policy = network_security_v1beta1.ServerTlsPolicy() - server_tls_policy.name = "name_value" - - request = network_security_v1beta1.UpdateServerTlsPolicyRequest( - server_tls_policy=server_tls_policy, - ) - - # Make the request - operation = client.update_server_tls_policy(request=request) - - print("Waiting for operation to complete...") - - response = operation.result() - - # Handle the response - print(response) - -# [END networksecurity_generated_network_security_v1beta1_NetworkSecurity_UpdateServerTlsPolicy_sync] diff --git a/samples/generated_samples/snippet_metadata_network-security_v1beta1.json b/samples/generated_samples/snippet_metadata_network-security_v1beta1.json index 79a5fc2..75c83ea 100644 --- a/samples/generated_samples/snippet_metadata_network-security_v1beta1.json +++ b/samples/generated_samples/snippet_metadata_network-security_v1beta1.json @@ -1,16 +1,69 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.networksecurity.v1beta1", + "version": "v1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-network-security" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.create_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateAuthorizationPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "authorization_policy", + "type": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy" + }, + { + "name": "authorization_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_authorization_policy" }, + "description": "Sample for CreateAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_authorization_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_async", "segments": [ { @@ -43,18 +96,62 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_authorization_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.create_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateAuthorizationPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "authorization_policy", + "type": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy" + }, + { + "name": "authorization_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_authorization_policy" }, + "description": "Sample for CreateAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_authorization_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateAuthorizationPolicy_sync", "segments": [ { @@ -87,19 +184,63 @@ "start": 52, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_authorization_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.create_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateClientTlsPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "client_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy" + }, + { + "name": "client_tls_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_client_tls_policy" }, + "description": "Sample for CreateClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_client_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_async", "segments": [ { @@ -132,18 +273,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_client_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.create_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateClientTlsPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "client_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy" + }, + { + "name": "client_tls_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_client_tls_policy" }, + "description": "Sample for CreateClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_client_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateClientTlsPolicy_sync", "segments": [ { @@ -176,19 +361,63 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_client_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.create_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateServerTlsPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "server_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy" + }, + { + "name": "server_tls_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "create_server_tls_policy" }, + "description": "Sample for CreateServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_server_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_async", "segments": [ { @@ -221,18 +450,62 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_server_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.create_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.CreateServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "CreateServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.CreateServerTlsPolicyRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "server_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy" + }, + { + "name": "server_tls_policy_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "create_server_tls_policy" }, + "description": "Sample for CreateServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_create_server_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_CreateServerTlsPolicy_sync", "segments": [ { @@ -265,19 +538,55 @@ "start": 51, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_create_server_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.delete_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteAuthorizationPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_authorization_policy" }, + "description": "Sample for DeleteAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_authorization_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_async", "segments": [ { @@ -310,18 +619,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_authorization_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.delete_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteAuthorizationPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_authorization_policy" }, + "description": "Sample for DeleteAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_authorization_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteAuthorizationPolicy_sync", "segments": [ { @@ -354,19 +699,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_authorization_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.delete_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteClientTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_client_tls_policy" }, + "description": "Sample for DeleteClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_client_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_async", "segments": [ { @@ -399,18 +780,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_client_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.delete_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteClientTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_client_tls_policy" }, + "description": "Sample for DeleteClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_client_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteClientTlsPolicy_sync", "segments": [ { @@ -443,19 +860,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_client_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.delete_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteServerTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "delete_server_tls_policy" }, + "description": "Sample for DeleteServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_server_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_async", "segments": [ { @@ -488,18 +941,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_server_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.delete_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.DeleteServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "DeleteServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.DeleteServerTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "delete_server_tls_policy" }, + "description": "Sample for DeleteServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_delete_server_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_DeleteServerTlsPolicy_sync", "segments": [ { @@ -532,19 +1021,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_delete_server_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.get_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetAuthorizationPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy", + "shortName": "get_authorization_policy" }, + "description": "Sample for GetAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_authorization_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_async", "segments": [ { @@ -577,18 +1102,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_authorization_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.get_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetAuthorizationPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy", + "shortName": "get_authorization_policy" }, + "description": "Sample for GetAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_authorization_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetAuthorizationPolicy_sync", "segments": [ { @@ -621,19 +1182,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_authorization_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.get_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetClientTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy", + "shortName": "get_client_tls_policy" }, + "description": "Sample for GetClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_client_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetClientTlsPolicy_async", "segments": [ { @@ -666,18 +1263,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_client_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.get_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetClientTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy", + "shortName": "get_client_tls_policy" }, + "description": "Sample for GetClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_client_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetClientTlsPolicy_sync", "segments": [ { @@ -710,19 +1343,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_client_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.get_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetServerTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy", + "shortName": "get_server_tls_policy" }, + "description": "Sample for GetServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_server_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetServerTlsPolicy_async", "segments": [ { @@ -755,18 +1424,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_server_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.get_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.GetServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "GetServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.GetServerTlsPolicyRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy", + "shortName": "get_server_tls_policy" }, + "description": "Sample for GetServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_get_server_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_GetServerTlsPolicy_sync", "segments": [ { @@ -799,19 +1504,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_get_server_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.list_authorization_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListAuthorizationPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListAuthorizationPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListAuthorizationPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListAuthorizationPoliciesAsyncPager", + "shortName": "list_authorization_policies" }, + "description": "Sample for ListAuthorizationPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_authorization_policies_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListAuthorizationPolicies_async", "segments": [ { @@ -844,18 +1585,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_authorization_policies_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.list_authorization_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListAuthorizationPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListAuthorizationPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListAuthorizationPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListAuthorizationPoliciesPager", + "shortName": "list_authorization_policies" }, + "description": "Sample for ListAuthorizationPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_authorization_policies_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListAuthorizationPolicies_sync", "segments": [ { @@ -888,19 +1665,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_authorization_policies_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.list_client_tls_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListClientTlsPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListClientTlsPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListClientTlsPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListClientTlsPoliciesAsyncPager", + "shortName": "list_client_tls_policies" }, + "description": "Sample for ListClientTlsPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_client_tls_policies_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListClientTlsPolicies_async", "segments": [ { @@ -933,18 +1746,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_client_tls_policies_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.list_client_tls_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListClientTlsPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListClientTlsPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListClientTlsPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListClientTlsPoliciesPager", + "shortName": "list_client_tls_policies" }, + "description": "Sample for ListClientTlsPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_client_tls_policies_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListClientTlsPolicies_sync", "segments": [ { @@ -977,19 +1826,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_client_tls_policies_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.list_server_tls_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListServerTlsPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListServerTlsPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListServerTlsPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListServerTlsPoliciesAsyncPager", + "shortName": "list_server_tls_policies" }, + "description": "Sample for ListServerTlsPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_server_tls_policies_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListServerTlsPolicies_async", "segments": [ { @@ -1022,18 +1907,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_server_tls_policies_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.list_server_tls_policies", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.ListServerTlsPolicies", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "ListServerTlsPolicies" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.ListServerTlsPoliciesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.network_security_v1beta1.services.network_security.pagers.ListServerTlsPoliciesPager", + "shortName": "list_server_tls_policies" }, + "description": "Sample for ListServerTlsPolicies", "file": "networksecurity_v1beta1_generated_network_security_list_server_tls_policies_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_ListServerTlsPolicies_sync", "segments": [ { @@ -1066,19 +1987,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_list_server_tls_policies_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.update_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateAuthorizationPolicyRequest" + }, + { + "name": "authorization_policy", + "type": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_authorization_policy" }, + "description": "Sample for UpdateAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_authorization_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_async", "segments": [ { @@ -1111,18 +2072,58 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_authorization_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.update_authorization_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateAuthorizationPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateAuthorizationPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateAuthorizationPolicyRequest" + }, + { + "name": "authorization_policy", + "type": "google.cloud.network_security_v1beta1.types.AuthorizationPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_authorization_policy" }, + "description": "Sample for UpdateAuthorizationPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_authorization_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateAuthorizationPolicy_sync", "segments": [ { @@ -1155,19 +2156,59 @@ "start": 50, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_authorization_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.update_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateClientTlsPolicyRequest" + }, + { + "name": "client_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_client_tls_policy" }, + "description": "Sample for UpdateClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_client_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_async", "segments": [ { @@ -1200,18 +2241,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_client_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.update_client_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateClientTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateClientTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateClientTlsPolicyRequest" + }, + { + "name": "client_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ClientTlsPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_client_tls_policy" }, + "description": "Sample for UpdateClientTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_client_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateClientTlsPolicy_sync", "segments": [ { @@ -1244,19 +2325,59 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_client_tls_policy_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient", + "shortName": "NetworkSecurityAsyncClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityAsyncClient.update_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateServerTlsPolicyRequest" + }, + { + "name": "server_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "update_server_tls_policy" }, + "description": "Sample for UpdateServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_server_tls_policy_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_async", "segments": [ { @@ -1289,18 +2410,58 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_server_tls_policy_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient", + "shortName": "NetworkSecurityClient" + }, + "fullName": "google.cloud.network_security_v1beta1.NetworkSecurityClient.update_server_tls_policy", "method": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity.UpdateServerTlsPolicy", "service": { + "fullName": "google.cloud.networksecurity.v1beta1.NetworkSecurity", "shortName": "NetworkSecurity" }, "shortName": "UpdateServerTlsPolicy" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.network_security_v1beta1.types.UpdateServerTlsPolicyRequest" + }, + { + "name": "server_tls_policy", + "type": "google.cloud.network_security_v1beta1.types.ServerTlsPolicy" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "update_server_tls_policy" }, + "description": "Sample for UpdateServerTlsPolicy", "file": "networksecurity_v1beta1_generated_network_security_update_server_tls_policy_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "networksecurity_v1beta1_generated_NetworkSecurity_UpdateServerTlsPolicy_sync", "segments": [ { @@ -1333,7 +2494,8 @@ "start": 49, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "networksecurity_v1beta1_generated_network_security_update_server_tls_policy_sync.py" } ] } diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e..91b5967 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index d050323..7711f28 100644 --- a/setup.py +++ b/setup.py @@ -19,17 +19,17 @@ import setuptools - name = "google-cloud-network-security" description = "Network Security API client library" -version = "0.4.1" +version = "0.4.2" release_status = "Development Status :: 4 - Beta" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ] package_root = os.path.abspath(os.path.dirname(__file__)) diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index be5a64f..786e637 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -6,3 +6,4 @@ # Then this file should have google-cloud-foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29..786e637 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,9 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List all library dependencies and extras in this file. +# Pin the version to the lower bound. +# 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.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/tests/unit/gapic/network_security_v1beta1/test_network_security.py b/tests/unit/gapic/network_security_v1beta1/test_network_security.py index 6669302..6896343 100644 --- a/tests/unit/gapic/network_security_v1beta1/test_network_security.py +++ b/tests/unit/gapic/network_security_v1beta1/test_network_security.py @@ -14,54 +14,60 @@ # limitations under the License. # import os -import mock -import grpc -from grpc.experimental import aio -import math -import pytest -from proto.marshal.rules.dates import DurationRule, TimestampRule +# try/except added for compatibility with python < 3.8 +try: + from unittest import mock + from unittest.mock import AsyncMock +except ImportError: + import mock +import math +from google.api_core import ( + future, + gapic_v1, + grpc_helpers, + grpc_helpers_async, + operation, + operations_v1, + path_template, +) from google.api_core import client_options from google.api_core import exceptions as core_exceptions -from google.api_core import future -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 operation from google.api_core import operation_async # type: ignore -from google.api_core import operations_v1 -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.longrunning import operations_pb2 +from google.oauth2 import service_account +from google.protobuf import field_mask_pb2 # type: ignore +from google.protobuf import timestamp_pb2 # type: ignore +import grpc +from grpc.experimental import aio +from proto.marshal.rules.dates import DurationRule, TimestampRule +import pytest + from google.cloud.network_security_v1beta1.services.network_security import ( NetworkSecurityAsyncClient, -) -from google.cloud.network_security_v1beta1.services.network_security import ( NetworkSecurityClient, + pagers, + transports, ) -from google.cloud.network_security_v1beta1.services.network_security import pagers -from google.cloud.network_security_v1beta1.services.network_security import transports -from google.cloud.network_security_v1beta1.types import authorization_policy from google.cloud.network_security_v1beta1.types import ( authorization_policy as gcn_authorization_policy, ) -from google.cloud.network_security_v1beta1.types import client_tls_policy from google.cloud.network_security_v1beta1.types import ( client_tls_policy as gcn_client_tls_policy, ) -from google.cloud.network_security_v1beta1.types import common -from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import ( server_tls_policy as gcn_server_tls_policy, ) +from google.cloud.network_security_v1beta1.types import authorization_policy +from google.cloud.network_security_v1beta1.types import client_tls_policy +from google.cloud.network_security_v1beta1.types import common +from google.cloud.network_security_v1beta1.types import server_tls_policy from google.cloud.network_security_v1beta1.types import tls -from google.longrunning import operations_pb2 -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 def client_cert_source_callback(): @@ -109,20 +115,26 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [NetworkSecurityClient, NetworkSecurityAsyncClient,] + "client_class,transport_name", + [ + (NetworkSecurityClient, "grpc"), + (NetworkSecurityAsyncClient, "grpc_asyncio"), + ], ) -def test_network_security_client_from_service_account_info(client_class): +def test_network_security_client_from_service_account_info( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "networksecurity.googleapis.com:443" + assert client.transport._host == ("networksecurity.googleapis.com:443") @pytest.mark.parametrize( @@ -151,23 +163,33 @@ def test_network_security_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [NetworkSecurityClient, NetworkSecurityAsyncClient,] + "client_class,transport_name", + [ + (NetworkSecurityClient, "grpc"), + (NetworkSecurityAsyncClient, "grpc_asyncio"), + ], ) -def test_network_security_client_from_service_account_file(client_class): +def test_network_security_client_from_service_account_file( + client_class, transport_name +): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "networksecurity.googleapis.com:443" + assert client.transport._host == ("networksecurity.googleapis.com:443") def test_network_security_client_get_transport_class(): @@ -525,7 +547,9 @@ def test_network_security_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -666,11 +690,16 @@ def test_network_security_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [authorization_policy.ListAuthorizationPoliciesRequest, dict,] + "request_type", + [ + authorization_policy.ListAuthorizationPoliciesRequest, + dict, + ], ) def test_list_authorization_policies(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -701,7 +730,8 @@ def test_list_authorization_policies_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -720,7 +750,8 @@ async def test_list_authorization_policies_async( request_type=authorization_policy.ListAuthorizationPoliciesRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -755,13 +786,15 @@ async def test_list_authorization_policies_async_from_dict(): def test_list_authorization_policies_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = authorization_policy.ListAuthorizationPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -777,7 +810,10 @@ def test_list_authorization_policies_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -790,7 +826,7 @@ async def test_list_authorization_policies_field_headers_async(): # a field header. Set these to a non-empty value. request = authorization_policy.ListAuthorizationPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -808,11 +844,16 @@ async def test_list_authorization_policies_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_authorization_policies_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -822,7 +863,9 @@ def test_list_authorization_policies_flattened(): call.return_value = authorization_policy.ListAuthorizationPoliciesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_authorization_policies(parent="parent_value",) + client.list_authorization_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -834,7 +877,9 @@ def test_list_authorization_policies_flattened(): def test_list_authorization_policies_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -863,7 +908,9 @@ async def test_list_authorization_policies_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_authorization_policies(parent="parent_value",) + response = await client.list_authorization_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -891,7 +938,8 @@ async def test_list_authorization_policies_flattened_error_async(): def test_list_authorization_policies_pager(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -909,10 +957,13 @@ def test_list_authorization_policies_pager(transport_name: str = "grpc"): next_page_token="abc", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[], next_page_token="def", + authorization_policies=[], + next_page_token="def", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[authorization_policy.AuthorizationPolicy(),], + authorization_policies=[ + authorization_policy.AuthorizationPolicy(), + ], next_page_token="ghi", ), authorization_policy.ListAuthorizationPoliciesResponse( @@ -932,7 +983,7 @@ def test_list_authorization_policies_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, authorization_policy.AuthorizationPolicy) for i in results @@ -941,7 +992,8 @@ def test_list_authorization_policies_pager(transport_name: str = "grpc"): def test_list_authorization_policies_pages(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -959,10 +1011,13 @@ def test_list_authorization_policies_pages(transport_name: str = "grpc"): next_page_token="abc", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[], next_page_token="def", + authorization_policies=[], + next_page_token="def", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[authorization_policy.AuthorizationPolicy(),], + authorization_policies=[ + authorization_policy.AuthorizationPolicy(), + ], next_page_token="ghi", ), authorization_policy.ListAuthorizationPoliciesResponse( @@ -1001,10 +1056,13 @@ async def test_list_authorization_policies_async_pager(): next_page_token="abc", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[], next_page_token="def", + authorization_policies=[], + next_page_token="def", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[authorization_policy.AuthorizationPolicy(),], + authorization_policies=[ + authorization_policy.AuthorizationPolicy(), + ], next_page_token="ghi", ), authorization_policy.ListAuthorizationPoliciesResponse( @@ -1015,10 +1073,12 @@ async def test_list_authorization_policies_async_pager(): ), RuntimeError, ) - async_pager = await client.list_authorization_policies(request={},) + async_pager = await client.list_authorization_policies( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1050,10 +1110,13 @@ async def test_list_authorization_policies_async_pages(): next_page_token="abc", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[], next_page_token="def", + authorization_policies=[], + next_page_token="def", ), authorization_policy.ListAuthorizationPoliciesResponse( - authorization_policies=[authorization_policy.AuthorizationPolicy(),], + authorization_policies=[ + authorization_policy.AuthorizationPolicy(), + ], next_page_token="ghi", ), authorization_policy.ListAuthorizationPoliciesResponse( @@ -1065,18 +1128,25 @@ async def test_list_authorization_policies_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_authorization_policies(request={})).pages: + async for page_ in ( + await client.list_authorization_policies(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [authorization_policy.GetAuthorizationPolicyRequest, dict,] + "request_type", + [ + authorization_policy.GetAuthorizationPolicyRequest, + dict, + ], ) def test_get_authorization_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1111,7 +1181,8 @@ def test_get_authorization_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1130,7 +1201,8 @@ async def test_get_authorization_policy_async( request_type=authorization_policy.GetAuthorizationPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1169,13 +1241,15 @@ async def test_get_authorization_policy_async_from_dict(): def test_get_authorization_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = authorization_policy.GetAuthorizationPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1191,7 +1265,10 @@ def test_get_authorization_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1204,7 +1281,7 @@ async def test_get_authorization_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = authorization_policy.GetAuthorizationPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1222,11 +1299,16 @@ async def test_get_authorization_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_authorization_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1236,7 +1318,9 @@ def test_get_authorization_policy_flattened(): call.return_value = authorization_policy.AuthorizationPolicy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_authorization_policy(name="name_value",) + client.get_authorization_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1248,13 +1332,16 @@ def test_get_authorization_policy_flattened(): def test_get_authorization_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_authorization_policy( - authorization_policy.GetAuthorizationPolicyRequest(), name="name_value", + authorization_policy.GetAuthorizationPolicyRequest(), + name="name_value", ) @@ -1276,7 +1363,9 @@ async def test_get_authorization_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_authorization_policy(name="name_value",) + response = await client.get_authorization_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1297,16 +1386,22 @@ async def test_get_authorization_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_authorization_policy( - authorization_policy.GetAuthorizationPolicyRequest(), name="name_value", + authorization_policy.GetAuthorizationPolicyRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcn_authorization_policy.CreateAuthorizationPolicyRequest, dict,] + "request_type", + [ + gcn_authorization_policy.CreateAuthorizationPolicyRequest, + dict, + ], ) def test_create_authorization_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1334,7 +1429,8 @@ def test_create_authorization_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1353,7 +1449,8 @@ async def test_create_authorization_policy_async( request_type=gcn_authorization_policy.CreateAuthorizationPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1385,13 +1482,15 @@ async def test_create_authorization_policy_async_from_dict(): def test_create_authorization_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1407,7 +1506,10 @@ def test_create_authorization_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1420,7 +1522,7 @@ async def test_create_authorization_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_authorization_policy.CreateAuthorizationPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1438,11 +1540,16 @@ async def test_create_authorization_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_authorization_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1476,7 +1583,9 @@ def test_create_authorization_policy_flattened(): def test_create_authorization_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1552,11 +1661,16 @@ async def test_create_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcn_authorization_policy.UpdateAuthorizationPolicyRequest, dict,] + "request_type", + [ + gcn_authorization_policy.UpdateAuthorizationPolicyRequest, + dict, + ], ) def test_update_authorization_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1584,7 +1698,8 @@ def test_update_authorization_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1603,7 +1718,8 @@ async def test_update_authorization_policy_async( request_type=gcn_authorization_policy.UpdateAuthorizationPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1635,13 +1751,15 @@ async def test_update_authorization_policy_async_from_dict(): def test_update_authorization_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - request.authorization_policy.name = "authorization_policy.name/value" + request.authorization_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1659,7 +1777,7 @@ def test_update_authorization_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "authorization_policy.name=authorization_policy.name/value", + "authorization_policy.name=name_value", ) in kw["metadata"] @@ -1673,7 +1791,7 @@ async def test_update_authorization_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_authorization_policy.UpdateAuthorizationPolicyRequest() - request.authorization_policy.name = "authorization_policy.name/value" + request.authorization_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1693,12 +1811,14 @@ async def test_update_authorization_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "authorization_policy.name=authorization_policy.name/value", + "authorization_policy.name=name_value", ) in kw["metadata"] def test_update_authorization_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1728,7 +1848,9 @@ def test_update_authorization_policy_flattened(): def test_update_authorization_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1798,11 +1920,16 @@ async def test_update_authorization_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [authorization_policy.DeleteAuthorizationPolicyRequest, dict,] + "request_type", + [ + authorization_policy.DeleteAuthorizationPolicyRequest, + dict, + ], ) def test_delete_authorization_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1830,7 +1957,8 @@ def test_delete_authorization_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1849,7 +1977,8 @@ async def test_delete_authorization_policy_async( request_type=authorization_policy.DeleteAuthorizationPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1881,13 +2010,15 @@ async def test_delete_authorization_policy_async_from_dict(): def test_delete_authorization_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = authorization_policy.DeleteAuthorizationPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1903,7 +2034,10 @@ def test_delete_authorization_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1916,7 +2050,7 @@ async def test_delete_authorization_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = authorization_policy.DeleteAuthorizationPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1934,11 +2068,16 @@ async def test_delete_authorization_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_authorization_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1948,7 +2087,9 @@ def test_delete_authorization_policy_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_authorization_policy(name="name_value",) + client.delete_authorization_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1960,13 +2101,16 @@ def test_delete_authorization_policy_flattened(): def test_delete_authorization_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_authorization_policy( - authorization_policy.DeleteAuthorizationPolicyRequest(), name="name_value", + authorization_policy.DeleteAuthorizationPolicyRequest(), + name="name_value", ) @@ -1988,7 +2132,9 @@ async def test_delete_authorization_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_authorization_policy(name="name_value",) + response = await client.delete_authorization_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2009,16 +2155,22 @@ async def test_delete_authorization_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_authorization_policy( - authorization_policy.DeleteAuthorizationPolicyRequest(), name="name_value", + authorization_policy.DeleteAuthorizationPolicyRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [server_tls_policy.ListServerTlsPoliciesRequest, dict,] + "request_type", + [ + server_tls_policy.ListServerTlsPoliciesRequest, + dict, + ], ) def test_list_server_tls_policies(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2049,7 +2201,8 @@ def test_list_server_tls_policies_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2068,7 +2221,8 @@ async def test_list_server_tls_policies_async( request_type=server_tls_policy.ListServerTlsPoliciesRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2103,13 +2257,15 @@ async def test_list_server_tls_policies_async_from_dict(): def test_list_server_tls_policies_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = server_tls_policy.ListServerTlsPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2125,7 +2281,10 @@ def test_list_server_tls_policies_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2138,7 +2297,7 @@ async def test_list_server_tls_policies_field_headers_async(): # a field header. Set these to a non-empty value. request = server_tls_policy.ListServerTlsPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2156,11 +2315,16 @@ async def test_list_server_tls_policies_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_server_tls_policies_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2170,7 +2334,9 @@ def test_list_server_tls_policies_flattened(): call.return_value = server_tls_policy.ListServerTlsPoliciesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_server_tls_policies(parent="parent_value",) + client.list_server_tls_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2182,13 +2348,16 @@ def test_list_server_tls_policies_flattened(): def test_list_server_tls_policies_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_server_tls_policies( - server_tls_policy.ListServerTlsPoliciesRequest(), parent="parent_value", + server_tls_policy.ListServerTlsPoliciesRequest(), + parent="parent_value", ) @@ -2210,7 +2379,9 @@ async def test_list_server_tls_policies_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_server_tls_policies(parent="parent_value",) + response = await client.list_server_tls_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2231,13 +2402,15 @@ async def test_list_server_tls_policies_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_server_tls_policies( - server_tls_policy.ListServerTlsPoliciesRequest(), parent="parent_value", + server_tls_policy.ListServerTlsPoliciesRequest(), + parent="parent_value", ) def test_list_server_tls_policies_pager(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2255,10 +2428,13 @@ def test_list_server_tls_policies_pager(transport_name: str = "grpc"): next_page_token="abc", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[], next_page_token="def", + server_tls_policies=[], + next_page_token="def", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[server_tls_policy.ServerTlsPolicy(),], + server_tls_policies=[ + server_tls_policy.ServerTlsPolicy(), + ], next_page_token="ghi", ), server_tls_policy.ListServerTlsPoliciesResponse( @@ -2278,14 +2454,15 @@ def test_list_server_tls_policies_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, server_tls_policy.ServerTlsPolicy) for i in results) def test_list_server_tls_policies_pages(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2303,10 +2480,13 @@ def test_list_server_tls_policies_pages(transport_name: str = "grpc"): next_page_token="abc", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[], next_page_token="def", + server_tls_policies=[], + next_page_token="def", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[server_tls_policy.ServerTlsPolicy(),], + server_tls_policies=[ + server_tls_policy.ServerTlsPolicy(), + ], next_page_token="ghi", ), server_tls_policy.ListServerTlsPoliciesResponse( @@ -2345,10 +2525,13 @@ async def test_list_server_tls_policies_async_pager(): next_page_token="abc", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[], next_page_token="def", + server_tls_policies=[], + next_page_token="def", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[server_tls_policy.ServerTlsPolicy(),], + server_tls_policies=[ + server_tls_policy.ServerTlsPolicy(), + ], next_page_token="ghi", ), server_tls_policy.ListServerTlsPoliciesResponse( @@ -2359,10 +2542,12 @@ async def test_list_server_tls_policies_async_pager(): ), RuntimeError, ) - async_pager = await client.list_server_tls_policies(request={},) + async_pager = await client.list_server_tls_policies( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2392,10 +2577,13 @@ async def test_list_server_tls_policies_async_pages(): next_page_token="abc", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[], next_page_token="def", + server_tls_policies=[], + next_page_token="def", ), server_tls_policy.ListServerTlsPoliciesResponse( - server_tls_policies=[server_tls_policy.ServerTlsPolicy(),], + server_tls_policies=[ + server_tls_policy.ServerTlsPolicy(), + ], next_page_token="ghi", ), server_tls_policy.ListServerTlsPoliciesResponse( @@ -2407,18 +2595,25 @@ async def test_list_server_tls_policies_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_server_tls_policies(request={})).pages: + async for page_ in ( + await client.list_server_tls_policies(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [server_tls_policy.GetServerTlsPolicyRequest, dict,] + "request_type", + [ + server_tls_policy.GetServerTlsPolicyRequest, + dict, + ], ) def test_get_server_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2431,7 +2626,9 @@ def test_get_server_tls_policy(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = server_tls_policy.ServerTlsPolicy( - name="name_value", description="description_value", allow_open=True, + name="name_value", + description="description_value", + allow_open=True, ) response = client.get_server_tls_policy(request) @@ -2451,7 +2648,8 @@ def test_get_server_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2470,7 +2668,8 @@ async def test_get_server_tls_policy_async( request_type=server_tls_policy.GetServerTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2484,7 +2683,9 @@ async def test_get_server_tls_policy_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( server_tls_policy.ServerTlsPolicy( - name="name_value", description="description_value", allow_open=True, + name="name_value", + description="description_value", + allow_open=True, ) ) response = await client.get_server_tls_policy(request) @@ -2507,13 +2708,15 @@ async def test_get_server_tls_policy_async_from_dict(): def test_get_server_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = server_tls_policy.GetServerTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2529,7 +2732,10 @@ def test_get_server_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2542,7 +2748,7 @@ async def test_get_server_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = server_tls_policy.GetServerTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2560,11 +2766,16 @@ async def test_get_server_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_server_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2574,7 +2785,9 @@ def test_get_server_tls_policy_flattened(): call.return_value = server_tls_policy.ServerTlsPolicy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_server_tls_policy(name="name_value",) + client.get_server_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2586,13 +2799,16 @@ def test_get_server_tls_policy_flattened(): def test_get_server_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_server_tls_policy( - server_tls_policy.GetServerTlsPolicyRequest(), name="name_value", + server_tls_policy.GetServerTlsPolicyRequest(), + name="name_value", ) @@ -2614,7 +2830,9 @@ async def test_get_server_tls_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_server_tls_policy(name="name_value",) + response = await client.get_server_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2635,16 +2853,22 @@ async def test_get_server_tls_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_server_tls_policy( - server_tls_policy.GetServerTlsPolicyRequest(), name="name_value", + server_tls_policy.GetServerTlsPolicyRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcn_server_tls_policy.CreateServerTlsPolicyRequest, dict,] + "request_type", + [ + gcn_server_tls_policy.CreateServerTlsPolicyRequest, + dict, + ], ) def test_create_server_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2672,7 +2896,8 @@ def test_create_server_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2691,7 +2916,8 @@ async def test_create_server_tls_policy_async( request_type=gcn_server_tls_policy.CreateServerTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2723,13 +2949,15 @@ async def test_create_server_tls_policy_async_from_dict(): def test_create_server_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2745,7 +2973,10 @@ def test_create_server_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2758,7 +2989,7 @@ async def test_create_server_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_server_tls_policy.CreateServerTlsPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2776,11 +3007,16 @@ async def test_create_server_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_server_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2812,7 +3048,9 @@ def test_create_server_tls_policy_flattened(): def test_create_server_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2882,11 +3120,16 @@ async def test_create_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcn_server_tls_policy.UpdateServerTlsPolicyRequest, dict,] + "request_type", + [ + gcn_server_tls_policy.UpdateServerTlsPolicyRequest, + dict, + ], ) def test_update_server_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2914,7 +3157,8 @@ def test_update_server_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2933,7 +3177,8 @@ async def test_update_server_tls_policy_async( request_type=gcn_server_tls_policy.UpdateServerTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2965,13 +3210,15 @@ async def test_update_server_tls_policy_async_from_dict(): def test_update_server_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - request.server_tls_policy.name = "server_tls_policy.name/value" + request.server_tls_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2989,7 +3236,7 @@ def test_update_server_tls_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "server_tls_policy.name=server_tls_policy.name/value", + "server_tls_policy.name=name_value", ) in kw["metadata"] @@ -3003,7 +3250,7 @@ async def test_update_server_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_server_tls_policy.UpdateServerTlsPolicyRequest() - request.server_tls_policy.name = "server_tls_policy.name/value" + request.server_tls_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3023,12 +3270,14 @@ async def test_update_server_tls_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "server_tls_policy.name=server_tls_policy.name/value", + "server_tls_policy.name=name_value", ) in kw["metadata"] def test_update_server_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3056,7 +3305,9 @@ def test_update_server_tls_policy_flattened(): def test_update_server_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3120,11 +3371,16 @@ async def test_update_server_tls_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [server_tls_policy.DeleteServerTlsPolicyRequest, dict,] + "request_type", + [ + server_tls_policy.DeleteServerTlsPolicyRequest, + dict, + ], ) def test_delete_server_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3152,7 +3408,8 @@ def test_delete_server_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3171,7 +3428,8 @@ async def test_delete_server_tls_policy_async( request_type=server_tls_policy.DeleteServerTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3203,13 +3461,15 @@ async def test_delete_server_tls_policy_async_from_dict(): def test_delete_server_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = server_tls_policy.DeleteServerTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3225,7 +3485,10 @@ def test_delete_server_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3238,7 +3501,7 @@ async def test_delete_server_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = server_tls_policy.DeleteServerTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3256,11 +3519,16 @@ async def test_delete_server_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_server_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3270,7 +3538,9 @@ def test_delete_server_tls_policy_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_server_tls_policy(name="name_value",) + client.delete_server_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3282,13 +3552,16 @@ def test_delete_server_tls_policy_flattened(): def test_delete_server_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_server_tls_policy( - server_tls_policy.DeleteServerTlsPolicyRequest(), name="name_value", + server_tls_policy.DeleteServerTlsPolicyRequest(), + name="name_value", ) @@ -3310,7 +3583,9 @@ async def test_delete_server_tls_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_server_tls_policy(name="name_value",) + response = await client.delete_server_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3331,16 +3606,22 @@ async def test_delete_server_tls_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_server_tls_policy( - server_tls_policy.DeleteServerTlsPolicyRequest(), name="name_value", + server_tls_policy.DeleteServerTlsPolicyRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [client_tls_policy.ListClientTlsPoliciesRequest, dict,] + "request_type", + [ + client_tls_policy.ListClientTlsPoliciesRequest, + dict, + ], ) def test_list_client_tls_policies(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3371,7 +3652,8 @@ def test_list_client_tls_policies_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3390,7 +3672,8 @@ async def test_list_client_tls_policies_async( request_type=client_tls_policy.ListClientTlsPoliciesRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3425,13 +3708,15 @@ async def test_list_client_tls_policies_async_from_dict(): def test_list_client_tls_policies_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = client_tls_policy.ListClientTlsPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3447,7 +3732,10 @@ def test_list_client_tls_policies_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3460,7 +3748,7 @@ async def test_list_client_tls_policies_field_headers_async(): # a field header. Set these to a non-empty value. request = client_tls_policy.ListClientTlsPoliciesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3478,11 +3766,16 @@ async def test_list_client_tls_policies_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_client_tls_policies_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3492,7 +3785,9 @@ def test_list_client_tls_policies_flattened(): call.return_value = client_tls_policy.ListClientTlsPoliciesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_client_tls_policies(parent="parent_value",) + client.list_client_tls_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3504,13 +3799,16 @@ def test_list_client_tls_policies_flattened(): def test_list_client_tls_policies_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_client_tls_policies( - client_tls_policy.ListClientTlsPoliciesRequest(), parent="parent_value", + client_tls_policy.ListClientTlsPoliciesRequest(), + parent="parent_value", ) @@ -3532,7 +3830,9 @@ async def test_list_client_tls_policies_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_client_tls_policies(parent="parent_value",) + response = await client.list_client_tls_policies( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3553,13 +3853,15 @@ async def test_list_client_tls_policies_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_client_tls_policies( - client_tls_policy.ListClientTlsPoliciesRequest(), parent="parent_value", + client_tls_policy.ListClientTlsPoliciesRequest(), + parent="parent_value", ) def test_list_client_tls_policies_pager(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3577,10 +3879,13 @@ def test_list_client_tls_policies_pager(transport_name: str = "grpc"): next_page_token="abc", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[], next_page_token="def", + client_tls_policies=[], + next_page_token="def", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[client_tls_policy.ClientTlsPolicy(),], + client_tls_policies=[ + client_tls_policy.ClientTlsPolicy(), + ], next_page_token="ghi", ), client_tls_policy.ListClientTlsPoliciesResponse( @@ -3600,14 +3905,15 @@ def test_list_client_tls_policies_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, client_tls_policy.ClientTlsPolicy) for i in results) def test_list_client_tls_policies_pages(transport_name: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3625,10 +3931,13 @@ def test_list_client_tls_policies_pages(transport_name: str = "grpc"): next_page_token="abc", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[], next_page_token="def", + client_tls_policies=[], + next_page_token="def", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[client_tls_policy.ClientTlsPolicy(),], + client_tls_policies=[ + client_tls_policy.ClientTlsPolicy(), + ], next_page_token="ghi", ), client_tls_policy.ListClientTlsPoliciesResponse( @@ -3667,10 +3976,13 @@ async def test_list_client_tls_policies_async_pager(): next_page_token="abc", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[], next_page_token="def", + client_tls_policies=[], + next_page_token="def", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[client_tls_policy.ClientTlsPolicy(),], + client_tls_policies=[ + client_tls_policy.ClientTlsPolicy(), + ], next_page_token="ghi", ), client_tls_policy.ListClientTlsPoliciesResponse( @@ -3681,10 +3993,12 @@ async def test_list_client_tls_policies_async_pager(): ), RuntimeError, ) - async_pager = await client.list_client_tls_policies(request={},) + async_pager = await client.list_client_tls_policies( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -3714,10 +4028,13 @@ async def test_list_client_tls_policies_async_pages(): next_page_token="abc", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[], next_page_token="def", + client_tls_policies=[], + next_page_token="def", ), client_tls_policy.ListClientTlsPoliciesResponse( - client_tls_policies=[client_tls_policy.ClientTlsPolicy(),], + client_tls_policies=[ + client_tls_policy.ClientTlsPolicy(), + ], next_page_token="ghi", ), client_tls_policy.ListClientTlsPoliciesResponse( @@ -3729,18 +4046,25 @@ async def test_list_client_tls_policies_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_client_tls_policies(request={})).pages: + async for page_ in ( + await client.list_client_tls_policies(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [client_tls_policy.GetClientTlsPolicyRequest, dict,] + "request_type", + [ + client_tls_policy.GetClientTlsPolicyRequest, + dict, + ], ) def test_get_client_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3753,7 +4077,9 @@ def test_get_client_tls_policy(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = client_tls_policy.ClientTlsPolicy( - name="name_value", description="description_value", sni="sni_value", + name="name_value", + description="description_value", + sni="sni_value", ) response = client.get_client_tls_policy(request) @@ -3773,7 +4099,8 @@ def test_get_client_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3792,7 +4119,8 @@ async def test_get_client_tls_policy_async( request_type=client_tls_policy.GetClientTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3806,7 +4134,9 @@ async def test_get_client_tls_policy_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( client_tls_policy.ClientTlsPolicy( - name="name_value", description="description_value", sni="sni_value", + name="name_value", + description="description_value", + sni="sni_value", ) ) response = await client.get_client_tls_policy(request) @@ -3829,13 +4159,15 @@ async def test_get_client_tls_policy_async_from_dict(): def test_get_client_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = client_tls_policy.GetClientTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3851,7 +4183,10 @@ def test_get_client_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3864,7 +4199,7 @@ async def test_get_client_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = client_tls_policy.GetClientTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3882,11 +4217,16 @@ async def test_get_client_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_client_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3896,7 +4236,9 @@ def test_get_client_tls_policy_flattened(): call.return_value = client_tls_policy.ClientTlsPolicy() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_client_tls_policy(name="name_value",) + client.get_client_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3908,13 +4250,16 @@ def test_get_client_tls_policy_flattened(): def test_get_client_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_client_tls_policy( - client_tls_policy.GetClientTlsPolicyRequest(), name="name_value", + client_tls_policy.GetClientTlsPolicyRequest(), + name="name_value", ) @@ -3936,7 +4281,9 @@ async def test_get_client_tls_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_client_tls_policy(name="name_value",) + response = await client.get_client_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3957,16 +4304,22 @@ async def test_get_client_tls_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_client_tls_policy( - client_tls_policy.GetClientTlsPolicyRequest(), name="name_value", + client_tls_policy.GetClientTlsPolicyRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [gcn_client_tls_policy.CreateClientTlsPolicyRequest, dict,] + "request_type", + [ + gcn_client_tls_policy.CreateClientTlsPolicyRequest, + dict, + ], ) def test_create_client_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3994,7 +4347,8 @@ def test_create_client_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4013,7 +4367,8 @@ async def test_create_client_tls_policy_async( request_type=gcn_client_tls_policy.CreateClientTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4045,13 +4400,15 @@ async def test_create_client_tls_policy_async_from_dict(): def test_create_client_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4067,7 +4424,10 @@ def test_create_client_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4080,7 +4440,7 @@ async def test_create_client_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_client_tls_policy.CreateClientTlsPolicyRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4098,11 +4458,16 @@ async def test_create_client_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_client_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4134,7 +4499,9 @@ def test_create_client_tls_policy_flattened(): def test_create_client_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4204,11 +4571,16 @@ async def test_create_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [gcn_client_tls_policy.UpdateClientTlsPolicyRequest, dict,] + "request_type", + [ + gcn_client_tls_policy.UpdateClientTlsPolicyRequest, + dict, + ], ) def test_update_client_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4236,7 +4608,8 @@ def test_update_client_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4255,7 +4628,8 @@ async def test_update_client_tls_policy_async( request_type=gcn_client_tls_policy.UpdateClientTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4287,13 +4661,15 @@ async def test_update_client_tls_policy_async_from_dict(): def test_update_client_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - request.client_tls_policy.name = "client_tls_policy.name/value" + request.client_tls_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4311,7 +4687,7 @@ def test_update_client_tls_policy_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "client_tls_policy.name=client_tls_policy.name/value", + "client_tls_policy.name=name_value", ) in kw["metadata"] @@ -4325,7 +4701,7 @@ async def test_update_client_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = gcn_client_tls_policy.UpdateClientTlsPolicyRequest() - request.client_tls_policy.name = "client_tls_policy.name/value" + request.client_tls_policy.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4345,12 +4721,14 @@ async def test_update_client_tls_policy_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "client_tls_policy.name=client_tls_policy.name/value", + "client_tls_policy.name=name_value", ) in kw["metadata"] def test_update_client_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4378,7 +4756,9 @@ def test_update_client_tls_policy_flattened(): def test_update_client_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4442,11 +4822,16 @@ async def test_update_client_tls_policy_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [client_tls_policy.DeleteClientTlsPolicyRequest, dict,] + "request_type", + [ + client_tls_policy.DeleteClientTlsPolicyRequest, + dict, + ], ) def test_delete_client_tls_policy(request_type, transport: str = "grpc"): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4474,7 +4859,8 @@ def test_delete_client_tls_policy_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4493,7 +4879,8 @@ async def test_delete_client_tls_policy_async( request_type=client_tls_policy.DeleteClientTlsPolicyRequest, ): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4525,13 +4912,15 @@ async def test_delete_client_tls_policy_async_from_dict(): def test_delete_client_tls_policy_field_headers(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = client_tls_policy.DeleteClientTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4547,7 +4936,10 @@ def test_delete_client_tls_policy_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4560,7 +4952,7 @@ async def test_delete_client_tls_policy_field_headers_async(): # a field header. Set these to a non-empty value. request = client_tls_policy.DeleteClientTlsPolicyRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4578,11 +4970,16 @@ async def test_delete_client_tls_policy_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_client_tls_policy_flattened(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4592,7 +4989,9 @@ def test_delete_client_tls_policy_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_client_tls_policy(name="name_value",) + client.delete_client_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4604,13 +5003,16 @@ def test_delete_client_tls_policy_flattened(): def test_delete_client_tls_policy_flattened_error(): - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_client_tls_policy( - client_tls_policy.DeleteClientTlsPolicyRequest(), name="name_value", + client_tls_policy.DeleteClientTlsPolicyRequest(), + name="name_value", ) @@ -4632,7 +5034,9 @@ async def test_delete_client_tls_policy_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_client_tls_policy(name="name_value",) + response = await client.delete_client_tls_policy( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4653,7 +5057,8 @@ async def test_delete_client_tls_policy_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_client_tls_policy( - client_tls_policy.DeleteClientTlsPolicyRequest(), name="name_value", + client_tls_policy.DeleteClientTlsPolicyRequest(), + name="name_value", ) @@ -4664,7 +5069,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -4684,7 +5090,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = NetworkSecurityClient(client_options=options, transport=transport,) + client = NetworkSecurityClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -4700,7 +5109,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = NetworkSecurityClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -4743,10 +5153,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = NetworkSecurityClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = NetworkSecurityClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.NetworkSecurityGrpcTransport,) + client = NetworkSecurityClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.NetworkSecurityGrpcTransport, + ) def test_network_security_base_transport_error(): @@ -4799,6 +5227,14 @@ def test_network_security_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_network_security_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -4810,7 +5246,8 @@ def test_network_security_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.NetworkSecurityTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -4943,24 +5380,40 @@ def test_network_security_grpc_transport_client_cert_source_for_mtls(transport_c ) -def test_network_security_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_network_security_host_no_port(transport_name): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="networksecurity.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "networksecurity.googleapis.com:443" + assert client.transport._host == ("networksecurity.googleapis.com:443") -def test_network_security_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_network_security_host_with_port(transport_name): client = NetworkSecurityClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="networksecurity.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "networksecurity.googleapis.com:8000" + assert client.transport._host == ("networksecurity.googleapis.com:8000") def test_network_security_grpc_transport_channel(): @@ -4968,7 +5421,8 @@ def test_network_security_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.NetworkSecurityGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -4980,7 +5434,8 @@ def test_network_security_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.NetworkSecurityGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5089,12 +5544,16 @@ def test_network_security_transport_channel_mtls_with_adc(transport_class): def test_network_security_grpc_lro_client(): client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -5102,12 +5561,16 @@ def test_network_security_grpc_lro_client(): def test_network_security_grpc_lro_async_client(): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -5118,7 +5581,9 @@ def test_authorization_policy_path(): location = "clam" authorization_policy = "whelk" expected = "projects/{project}/locations/{location}/authorizationPolicies/{authorization_policy}".format( - project=project, location=location, authorization_policy=authorization_policy, + project=project, + location=location, + authorization_policy=authorization_policy, ) actual = NetworkSecurityClient.authorization_policy_path( project, location, authorization_policy @@ -5144,7 +5609,9 @@ def test_client_tls_policy_path(): location = "mussel" client_tls_policy = "winkle" expected = "projects/{project}/locations/{location}/clientTlsPolicies/{client_tls_policy}".format( - project=project, location=location, client_tls_policy=client_tls_policy, + project=project, + location=location, + client_tls_policy=client_tls_policy, ) actual = NetworkSecurityClient.client_tls_policy_path( project, location, client_tls_policy @@ -5170,7 +5637,9 @@ def test_server_tls_policy_path(): location = "clam" server_tls_policy = "whelk" expected = "projects/{project}/locations/{location}/serverTlsPolicies/{server_tls_policy}".format( - project=project, location=location, server_tls_policy=server_tls_policy, + project=project, + location=location, + server_tls_policy=server_tls_policy, ) actual = NetworkSecurityClient.server_tls_policy_path( project, location, server_tls_policy @@ -5213,7 +5682,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "winkle" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = NetworkSecurityClient.common_folder_path(folder) assert expected == actual @@ -5231,7 +5702,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "scallop" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = NetworkSecurityClient.common_organization_path(organization) assert expected == actual @@ -5249,7 +5722,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "squid" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = NetworkSecurityClient.common_project_path(project) assert expected == actual @@ -5269,7 +5744,8 @@ def test_common_location_path(): project = "whelk" location = "octopus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = NetworkSecurityClient.common_location_path(project, location) assert expected == actual @@ -5294,7 +5770,8 @@ def test_client_with_default_client_info(): transports.NetworkSecurityTransport, "_prep_wrapped_messages" ) as prep: client = NetworkSecurityClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5303,7 +5780,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = NetworkSecurityClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -5311,7 +5789,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = NetworkSecurityAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"