Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit cabe55d

Browse files
feat: add support for google.cloud.api_keys.__version__ (#26)
* chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud.<api>.__version__` PiperOrigin-RevId: 484665853 Source-Link: googleapis/googleapis@8eb249a Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add .release-please-manifest.json with correct version * regenerate code using templated owlbot.py and setup.py Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 113d99e commit cabe55d

33 files changed

+320
-1665
lines changed

‎.github/release-please.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
releaseType: python
2+
manifest: true
23
handleGHRelease: true

‎.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "0.2.2"
3+
}

‎google/cloud/api_keys/__init__.py

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
from google.cloud.api_keys import gapic_version as package_version
17+
18+
__version__ = package_version.__version__
19+
20+
21+
from google.cloud.api_keys_v2.services.api_keys.async_client import ApiKeysAsyncClient
22+
from google.cloud.api_keys_v2.services.api_keys.client import ApiKeysClient
23+
from google.cloud.api_keys_v2.types.apikeys import (
24+
CreateKeyRequest,
25+
DeleteKeyRequest,
26+
GetKeyRequest,
27+
GetKeyStringRequest,
28+
GetKeyStringResponse,
29+
ListKeysRequest,
30+
ListKeysResponse,
31+
LookupKeyRequest,
32+
LookupKeyResponse,
33+
UndeleteKeyRequest,
34+
UpdateKeyRequest,
35+
)
36+
from google.cloud.api_keys_v2.types.resources import (
37+
AndroidApplication,
38+
AndroidKeyRestrictions,
39+
ApiTarget,
40+
BrowserKeyRestrictions,
41+
IosKeyRestrictions,
42+
Key,
43+
Restrictions,
44+
ServerKeyRestrictions,
45+
)
46+
47+
__all__ = (
48+
"ApiKeysClient",
49+
"ApiKeysAsyncClient",
50+
"CreateKeyRequest",
51+
"DeleteKeyRequest",
52+
"GetKeyRequest",
53+
"GetKeyStringRequest",
54+
"GetKeyStringResponse",
55+
"ListKeysRequest",
56+
"ListKeysResponse",
57+
"LookupKeyRequest",
58+
"LookupKeyResponse",
59+
"UndeleteKeyRequest",
60+
"UpdateKeyRequest",
61+
"AndroidApplication",
62+
"AndroidKeyRestrictions",
63+
"ApiTarget",
64+
"BrowserKeyRestrictions",
65+
"IosKeyRestrictions",
66+
"Key",
67+
"Restrictions",
68+
"ServerKeyRestrictions",
69+
)
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "0.2.2" # {x-release-please-version}

‎google/cloud/api_keys/py.typed

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Marker file for PEP 561.
2+
# The google-cloud-api-keys package uses inline types.

‎google/cloud/api_keys_v2/__init__.py

+4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16+
from google.cloud.api_keys import gapic_version as package_version
17+
18+
__version__ = package_version.__version__
19+
1620

1721
from .services.api_keys import ApiKeysAsyncClient, ApiKeysClient
1822
from .types.apikeys import (

‎google/cloud/api_keys_v2/services/api_keys/client.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from collections import OrderedDict
1717
import os
1818
import re
19-
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union
19+
from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast
2020

2121
from google.api_core import client_options as client_options_lib
2222
from google.api_core import exceptions as core_exceptions
@@ -341,7 +341,7 @@ def __init__(
341341
*,
342342
credentials: Optional[ga_credentials.Credentials] = None,
343343
transport: Union[str, ApiKeysTransport, None] = None,
344-
client_options: Optional[client_options_lib.ClientOptions] = None,
344+
client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None,
345345
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
346346
) -> None:
347347
"""Instantiates the api keys client.
@@ -358,7 +358,7 @@ def __init__(
358358
NOTE: "rest" transport functionality is currently in a
359359
beta state (preview). We welcome your feedback via an
360360
issue in this library's source repository.
361-
client_options (google.api_core.client_options.ClientOptions): Custom options for the
361+
client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the
362362
client. It won't take effect if a ``transport`` instance is provided.
363363
(1) The ``api_endpoint`` property can be used to override the
364364
default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
@@ -388,6 +388,7 @@ def __init__(
388388
client_options = client_options_lib.from_dict(client_options)
389389
if client_options is None:
390390
client_options = client_options_lib.ClientOptions()
391+
client_options = cast(client_options_lib.ClientOptions, client_options)
391392

392393
api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source(
393394
client_options

‎owlbot.py

+15-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import json
1516
from pathlib import Path
17+
import shutil
1618

1719
import synthtool as s
1820
import synthtool.gcp as gcp
@@ -22,25 +24,33 @@
2224
# Copy the generated client from the owl-bot staging directory
2325
# ----------------------------------------------------------------------------
2426

25-
default_version = "v2"
27+
clean_up_generated_samples = True
28+
29+
# Load the default version defined in .repo-metadata.json.
30+
default_version = json.load(open(".repo-metadata.json", "rt")).get(
31+
"default_version"
32+
)
2633

2734
for library in s.get_staging_dirs(default_version):
28-
s.move(library, excludes=["google/cloud/api_keys/", "setup.py"])
35+
if clean_up_generated_samples:
36+
shutil.rmtree("samples/generated_samples", ignore_errors=True)
37+
clean_up_generated_samples = False
38+
s.move([library], excludes=["**/gapic_version.py"])
2939
s.remove_staging_dirs()
3040

3141
# ----------------------------------------------------------------------------
3242
# Add templated files
3343
# ----------------------------------------------------------------------------
3444

3545
templated_files = gcp.CommonTemplates().py_library(
46+
cov_level=100,
3647
microgenerator=True,
3748
versions=gcp.common.detect_versions(path="./google", default_first=True),
3849
)
39-
s.move(templated_files, excludes=[".coveragerc"]) # the microgenerator has a good coveragerc file
50+
s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"])
4051

4152
python.py_samples(skip_readmes=True)
4253

43-
44-
# run blacken session for all directories which have a noxfile
54+
# run format session for all directories which have a noxfile
4555
for noxfile in Path(".").glob("**/noxfile.py"):
4656
s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False)

‎release-please-config.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "python",
6+
"extra-files": [
7+
"google/cloud/api_keys/gapic_version.py"
8+
]
9+
}
10+
},
11+
"release-type": "python",
12+
"plugins": [
13+
{
14+
"type": "sentence-case"
15+
}
16+
],
17+
"initial-version": "0.1.0"
18+
}

‎samples/generated_samples/apikeys_v2_generated_api_keys_create_key_sync_17a03238.py

-56
This file was deleted.

‎samples/generated_samples/apikeys_v2_generated_api_keys_create_key_sync_abc0a166.py

-56
This file was deleted.

‎samples/generated_samples/apikeys_v2_generated_api_keys_delete_key_sync_5fa17803.py

-56
This file was deleted.

0 commit comments

Comments
 (0)