Skip to content
This repository has been archived by the owner on Oct 16, 2023. It is now read-only.

chore: use gapic-generator-python 0.56.2 #136

Merged
merged 5 commits into from
Nov 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 2 additions & 19 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
# -*- 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
#
# https://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 by synthtool. DO NOT EDIT!
[run]
branch = True

[report]
fail_under = 100
show_missing = True
omit = google/cloud/iam_credentials_v1/__init__.py
omit =
google/cloud/iam_credentials/__init__.py
exclude_lines =
# Re-enable the standard pragma
pragma: NO COVER
Expand Down
6 changes: 0 additions & 6 deletions docs/credentials_v1/services.rst

This file was deleted.

6 changes: 6 additions & 0 deletions docs/iam_credentials_v1/services.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Services for Google Cloud Iam Credentials v1 API
================================================
.. toctree::
:maxdepth: 2

iam_credentials
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Types for Google Iam Credentials v1 API
=======================================
Types for Google Cloud Iam Credentials v1 API
=============================================

.. automodule:: google.cloud.iam_credentials_v1.types
:members:
Expand Down
16 changes: 8 additions & 8 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@
API Reference
-------------
.. toctree::
:maxdepth: 2
:maxdepth: 2

credentials_v1/services
credentials_v1/types
iam_credentials_v1/services
iam_credentials_v1/types


Migration Guide
---------------

See the guide below for instructions on migrating to the 2.x release of this library.
See the guide below for instructions on migrating to the latest version.

.. toctree::
:maxdepth: 2
:maxdepth: 2

UPGRADING
 UPGRADING


Changelog
Expand All @@ -29,6 +29,6 @@ Changelog
For a list of all ``google-cloud-iam`` releases:

.. toctree::
:maxdepth: 2
:maxdepth: 2

changelog
changelog
2 changes: 1 addition & 1 deletion google/cloud/iam_credentials/py.typed
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Marker file for PEP 561.
# The google-iam-credentials package uses inline types.
# The google-cloud-iam package uses inline types.
2 changes: 1 addition & 1 deletion google/cloud/iam_credentials_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.iam.credentials_v1",
"libraryPackage": "google.cloud.iam_credentials_v1",
"protoPackage": "google.iam.credentials.v1",
"schema": "1.0",
"services": {
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/iam_credentials_v1/py.typed
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Marker file for PEP 561.
# The google-iam-credentials package uses inline types.
# The google-cloud-iam package uses inline types.
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core.client_options import ClientOptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
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.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

OptionalRetry = Union[retries.Retry, object]
try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.cloud.iam_credentials_v1.types import common
from google.protobuf import duration_pb2 # type: ignore
Expand Down
25 changes: 17 additions & 8 deletions google/cloud/iam_credentials_v1/services/iam_credentials/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,25 @@
# limitations under the License.
#
from collections import OrderedDict
from distutils import util
import os
import re
from typing import Dict, Optional, Sequence, Tuple, Type, Union
import pkg_resources

from google.api_core import client_options as client_options_lib # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
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.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

OptionalRetry = Union[retries.Retry, object]
try:
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
except AttributeError: # pragma: NO COVER
OptionalRetry = Union[retries.Retry, object] # type: ignore

from google.cloud.iam_credentials_v1.types import common
from google.protobuf import duration_pb2 # type: ignore
Expand Down Expand Up @@ -294,8 +296,15 @@ def __init__(
client_options = client_options_lib.ClientOptions()

# Create SSL credentials for mutual TLS if needed.
use_client_cert = bool(
util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false"))
if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in (
"true",
"false",
):
raise ValueError(
"Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`"
)
use_client_cert = (
os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true"
)

client_cert_source_func = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
import pkg_resources

import google.auth # type: ignore
import google.api_core # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
import google.api_core
from google.api_core import exceptions as core_exceptions
from google.api_core import gapic_v1
from google.api_core import retry as retries
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import warnings
from typing import Callable, Dict, Optional, Sequence, Tuple, Union

from google.api_core import grpc_helpers # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import grpc_helpers
from google.api_core import gapic_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
import warnings
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union

from google.api_core import gapic_v1 # type: ignore
from google.api_core import grpc_helpers_async # type: ignore
from google.api_core import gapic_v1
from google.api_core import grpc_helpers_async
from google.auth import credentials as ga_credentials # type: ignore
from google.auth.transport.grpc import SslCredentials # type: ignore

Expand Down
3 changes: 3 additions & 0 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[mypy]
python_version = 3.6
namespace_packages = True
2 changes: 1 addition & 1 deletion noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def cover(session):
test runs (not system test runs), and then erases coverage data.
"""
session.install("coverage", "pytest-cov")
session.run("coverage", "report", "--show-missing", "--fail-under=99")
session.run("coverage", "report", "--show-missing", "--fail-under=100")

session.run("coverage", "erase")

Expand Down
83 changes: 0 additions & 83 deletions owlbot.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def partition(
return results[1], results[0]


class credentialsCallTransformer(cst.CSTTransformer):
class iam_credentialsCallTransformer(cst.CSTTransformer):
CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata')
METHOD_TO_PARAMS: Dict[str, Tuple[str]] = {
'generate_access_token': ('name', 'scope', 'delegates', 'lifetime', ),
Expand Down Expand Up @@ -91,7 +91,7 @@ def fix_files(
in_dir: pathlib.Path,
out_dir: pathlib.Path,
*,
transformer=credentialsCallTransformer(),
transformer=iam_credentialsCallTransformer(),
):
"""Duplicate the input dir to the output dir, fixing file method calls.

Expand Down Expand Up @@ -124,7 +124,7 @@ def fix_files(

if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="""Fix up source that uses the credentials client library.
description="""Fix up source that uses the iam_credentials client library.

The existing sources are NOT overwritten but are copied to output_dir with changes made.

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
install_requires=dependencies,
extras_require={"fixup": ["libcst >= 0.2.5"]},
python_requires=">=3.6",
scripts=["scripts/fixup_credentials_v1_keywords.py"],
scripts=["scripts/fixup_iam_credentials_v1_keywords.py"],
include_package_data=True,
zip_safe=False,
)
15 changes: 15 additions & 0 deletions tests/unit/gapic/iam_credentials_v1/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# -*- 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.
#
Loading