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

Commit 60e221b

Browse files
feat!: migrate to microgenerator (#26)
1 parent 54b54af commit 60e221b

44 files changed

Lines changed: 4573 additions & 2402 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.coveragerc‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ branch = True
2121
[report]
2222
fail_under = 100
2323
show_missing = True
24+
omit = google/cloud/iam_credentials_v1/__init__.py
2425
exclude_lines =
2526
# Re-enable the standard pragma
2627
pragma: NO COVER
2728
# Ignore debug-only repr
2829
def __repr__
29-
# Ignore abstract methods
30-
raise NotImplementedError
31-
omit =
32-
*/gapic/*.py
33-
*/proto/*.py
34-
*/core/*.py
35-
*/site-packages/*.py
30+
# Ignore pkg_resources exceptions.
31+
# This is added at the module level as a safeguard for if someone
32+
# generates the code and tries to run it without pip installing. This
33+
# makes it virtually impossible to test properly.
34+
except pkg_resources.DistributionNotFound

‎README.rst‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,13 @@ dependencies.
5151

5252
Supported Python Versions
5353
^^^^^^^^^^^^^^^^^^^^^^^^^
54-
Python >= 3.5
54+
Python >= 3.6
5555

5656
Deprecated Python Versions
5757
^^^^^^^^^^^^^^^^^^^^^^^^^^
58-
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
58+
Python == 2.7.
59+
60+
The last version of this library compatible with Python 2.7 is google-cloud-iam==1.0.1.
5961

6062

6163
Mac/Linux

‎UPGRADING.md‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-iam` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
4+
5+
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-iam/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
11+
The 2.0.0 release requires Python 3.6+.
12+
13+
14+
## Method Calls
15+
16+
> **WARNING**: Breaking change
17+
18+
Methods expect request objects. We provide a script that will convert most common use cases.
19+
20+
* Install the library
21+
22+
```py
23+
python3 -m pip install google-cloud-iam
24+
```
25+
26+
* The script `fixup_credentials_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.
27+
28+
```sh
29+
$ fixup_credentials_v1_keywords.py --input-directory .samples/ --output-directory samples/
30+
```
31+
32+
**Before:**
33+
```py
34+
from google.cloud import iam_credentials
35+
36+
client = iam_credentials.IAMCredentialsClient()
37+
38+
access_token = client.generate_access_token(
39+
name, scope, delegates = delegates, lifetime = lifetime
40+
)
41+
```
42+
43+
44+
**After:**
45+
```py
46+
from google.cloud import iam_credentials
47+
48+
client = iam_credentials.IAMCredentialsClient()
49+
50+
access_token = client.generate_access_token(
51+
request = {'name': name, 'scope': scope, 'delegates': delegates, 'lifetime': lifetime}
52+
)
53+
```
54+
55+
### More Details
56+
57+
In `google-cloud-iam<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
58+
59+
**Before:**
60+
```py
61+
def generate_access_token(
62+
self,
63+
name,
64+
scope,
65+
delegates=None,
66+
lifetime=None,
67+
retry=google.api_core.gapic_v1.method.DEFAULT,
68+
timeout=google.api_core.gapic_v1.method.DEFAULT,
69+
metadata=None,
70+
):
71+
```
72+
73+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
74+
75+
Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation](https://github.com/googleapis/googleapis/blob/master/google/iam/credentials/v1/iamcredentials.proto#L49) specified by the API producer.
76+
77+
78+
**After:**
79+
```py
80+
def generate_access_token(
81+
self,
82+
request: common.GenerateAccessTokenRequest = None,
83+
*,
84+
name: str = None,
85+
scope: Sequence[str] = None,
86+
delegates: Sequence[str] = None,
87+
lifetime: duration.Duration = None,
88+
retry: retries.Retry = gapic_v1.method.DEFAULT,
89+
timeout: float = None,
90+
metadata: Sequence[Tuple[str, str]] = (),
91+
) -> common.GenerateAccessTokenResponse:
92+
```
93+
94+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
95+
> Passing both will result in an error.
96+
97+
98+
Both of these calls are valid:
99+
100+
```py
101+
access_token = client.generate_access_token(
102+
request={
103+
"name": name,
104+
"scope": scope,
105+
"delegates": delegates,
106+
"lifetime": lifetime
107+
}
108+
)
109+
```
110+
111+
```py
112+
access_token = client.generate_access_token(
113+
name, scope, delegates = delegates, lifetime = lifetime
114+
)
115+
```
116+
117+
This call is invalid because it mixes `request` with a keyword argument `lifetime`. Executing this code will result in an error.
118+
119+
```py
120+
access_token = client.generate_access_token(
121+
request={
122+
"name": name,
123+
"scope": scope,
124+
"delegates": delegates
125+
},
126+
lifetime = lifetime
127+
)
128+
```
129+
130+
131+
132+
## Types
133+
134+
135+
> **WARNING**: Breaking change
136+
137+
The submodule `types` has been removed.
138+
139+
**Before:**
140+
```py
141+
from google.cloud import iam_credentials
142+
143+
request = iam_credentials.types.GenerateAccessTokenRequest(name="name")
144+
```
145+
146+
147+
**After:**
148+
```py
149+
from google.cloud import iam_credentials
150+
151+
request = iam_credentials.GenerateAccessTokenRequest(name="name")
152+
```

‎docs/UPGRADING.md‎

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-iam` client is a significant upgrade based on a [next-gen code generator](https://github.com/googleapis/gapic-generator-python), and includes substantial interface changes. Existing code written for earlier versions of this library will likely require updates to use this version. This document describes the changes that have been made, and what you need to do to update your usage.
4+
5+
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-iam/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
11+
The 2.0.0 release requires Python 3.6+.
12+
13+
14+
## Method Calls
15+
16+
> **WARNING**: Breaking change
17+
18+
Methods expect request objects. We provide a script that will convert most common use cases.
19+
20+
* Install the library
21+
22+
```py
23+
python3 -m pip install google-cloud-iam
24+
```
25+
26+
* The script `fixup_credentials_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.
27+
28+
```sh
29+
$ fixup_credentials_v1_keywords.py --input-directory .samples/ --output-directory samples/
30+
```
31+
32+
**Before:**
33+
```py
34+
from google.cloud import iam_credentials
35+
36+
client = iam_credentials.IAMCredentialsClient()
37+
38+
access_token = client.generate_access_token(
39+
name, scope, delegates = delegates, lifetime = lifetime
40+
)
41+
```
42+
43+
44+
**After:**
45+
```py
46+
from google.cloud import iam_credentials
47+
48+
client = iam_credentials.IAMCredentialsClient()
49+
50+
access_token = client.generate_access_token(
51+
request = {'name': name, 'scope': scope, 'delegates': delegates, 'lifetime': lifetime}
52+
)
53+
```
54+
55+
### More Details
56+
57+
In `google-cloud-iam<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
58+
59+
**Before:**
60+
```py
61+
def generate_access_token(
62+
self,
63+
name,
64+
scope,
65+
delegates=None,
66+
lifetime=None,
67+
retry=google.api_core.gapic_v1.method.DEFAULT,
68+
timeout=google.api_core.gapic_v1.method.DEFAULT,
69+
metadata=None,
70+
):
71+
```
72+
73+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
74+
75+
Some methods have additional keyword only parameters. The available parameters depend on the [`google.api.method_signature` annotation](https://github.com/googleapis/googleapis/blob/master/google/iam/credentials/v1/iamcredentials.proto#L49) specified by the API producer.
76+
77+
78+
**After:**
79+
```py
80+
def generate_access_token(
81+
self,
82+
request: common.GenerateAccessTokenRequest = None,
83+
*,
84+
name: str = None,
85+
scope: Sequence[str] = None,
86+
delegates: Sequence[str] = None,
87+
lifetime: duration.Duration = None,
88+
retry: retries.Retry = gapic_v1.method.DEFAULT,
89+
timeout: float = None,
90+
metadata: Sequence[Tuple[str, str]] = (),
91+
) -> common.GenerateAccessTokenResponse:
92+
```
93+
94+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
95+
> Passing both will result in an error.
96+
97+
98+
Both of these calls are valid:
99+
100+
```py
101+
access_token = client.generate_access_token(
102+
request={
103+
"name": name,
104+
"scope": scope,
105+
"delegates": delegates,
106+
"lifetime": lifetime
107+
}
108+
)
109+
```
110+
111+
```py
112+
access_token = client.generate_access_token(
113+
name, scope, delegates = delegates, lifetime = lifetime
114+
)
115+
```
116+
117+
This call is invalid because it mixes `request` with a keyword argument `lifetime`. Executing this code will result in an error.
118+
119+
```py
120+
access_token = client.generate_access_token(
121+
request={
122+
"name": name,
123+
"scope": scope,
124+
"delegates": delegates
125+
},
126+
lifetime = lifetime
127+
)
128+
```
129+
130+
131+
132+
## Types
133+
134+
135+
> **WARNING**: Breaking change
136+
137+
The submodule `types` has been removed.
138+
139+
**Before:**
140+
```py
141+
from google.cloud import iam_credentials
142+
143+
request = iam_credentials.types.GenerateAccessTokenRequest(name="name")
144+
```
145+
146+
147+
**After:**
148+
```py
149+
from google.cloud import iam_credentials
150+
151+
request = iam_credentials.GenerateAccessTokenRequest(name="name")
152+
```

‎docs/credentials_v1/services.rst‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Iam Credentials v1 API
2+
==========================================
3+
4+
.. automodule:: google.cloud.iam_credentials_v1.services.iam_credentials
5+
:members:
6+
:inherited-members:

‎docs/credentials_v1/types.rst‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Iam Credentials v1 API
2+
=======================================
3+
4+
.. automodule:: google.cloud.iam_credentials_v1.types
5+
:members:

‎docs/gapic/v1/api.rst‎

Lines changed: 0 additions & 6 deletions
This file was deleted.

‎docs/gapic/v1/types.rst‎

Lines changed: 0 additions & 5 deletions
This file was deleted.

‎docs/index.rst‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ API Reference
88
.. toctree::
99
:maxdepth: 2
1010

11-
gapic/v1/api
12-
gapic/v1/types
11+
credentials_v1/services
12+
credentials_v1/types
13+
14+
15+
Migration Guide
16+
---------------
17+
18+
See the guide below for instructions on migrating to the 2.x release of this library.
19+
20+
.. toctree::
21+
:maxdepth: 2
22+
23+
UPGRADING
1324

1425

1526
Changelog

0 commit comments

Comments
 (0)