Skip to content

Commit b39bf25

Browse files
feat!: migrate to microgenerator (#33)
1 parent 8b822d8 commit b39bf25

Some content is hidden

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

71 files changed

+44696
-41481
lines changed

packages/google-cloud-container/README.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Python Client for Google Kubernetes Engine API
22
==============================================
33

4-
|ga| |pypi| |versions|
4+
|ga| |pypi| |versions|
55

66
`Google Kubernetes Engine API`_: The Google Kubernetes Engine API is used for
77
building and managing container based applications, powered by the open source
@@ -49,11 +49,13 @@ dependencies.
4949

5050
Supported Python Versions
5151
^^^^^^^^^^^^^^^^^^^^^^^^^
52-
Python >= 3.5
52+
Python >= 3.6
5353

5454
Deprecated Python Versions
5555
^^^^^^^^^^^^^^^^^^^^^^^^^^
56-
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
56+
Python == 2.7.
57+
58+
The last version of this library compatible with Python 2.7 is google-cloud-container==1.0.1
5759

5860

5961
Mac/Linux
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-container` 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-container/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-container
24+
```
25+
26+
* The script `fixup_container_v1_keywords.py` and `fixup_container_v1beta1_keywords.py`
27+
are shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory.
28+
29+
```sh
30+
$ fixup_container_v1_keywords.py --input-directory .samples/ --output-directory samples/
31+
```
32+
33+
**Before:**
34+
```py
35+
from google.cloud import container_v1
36+
37+
client = container_v1.ClusterManagerClient()
38+
39+
clusters = client.list_clusters(
40+
project_id="project_id", zone="us-central1-a", parent="parent"
41+
)
42+
```
43+
44+
45+
**After:**
46+
```py
47+
from google.cloud import container_v1
48+
49+
client = container_v1.ClusterManagerClient()
50+
51+
clusters = client.list_clusters(
52+
request = {'project_id': "project_id", 'zone': "us-central1-a", 'parent': "parent"}
53+
)
54+
```
55+
56+
### More Details
57+
58+
In `google-cloud-container<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
59+
60+
**Before:**
61+
```py
62+
def list_clusters(
63+
self,
64+
project_id=None,
65+
zone=None,
66+
parent=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/container/v1/cluster_service.proto#L48) specified by the API producer.
76+
77+
78+
**After:**
79+
```py
80+
def list_clusters(
81+
self,
82+
request: cluster_service.ListClustersRequest = None,
83+
*,
84+
project_id: str = None,
85+
zone: str = None,
86+
parent: str = None,
87+
retry: retries.Retry = gapic_v1.method.DEFAULT,
88+
timeout: float = None,
89+
metadata: Sequence[Tuple[str, str]] = (),
90+
) -> cluster_service.ListClustersResponse:
91+
```
92+
93+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
94+
> Passing both will result in an error.
95+
96+
97+
Both of these calls are valid:
98+
99+
```py
100+
response = client.list_clusters(
101+
request={
102+
"project_id": project_id,
103+
"zone": zone,
104+
"parent": parent,
105+
}
106+
)
107+
```
108+
109+
```py
110+
response = client.list_clusters(
111+
project_id=project_id,
112+
zone=zone,
113+
parent=parent,
114+
)
115+
```
116+
117+
This call is invalid because it mixes `request` with a keyword argument `parent`. Executing this code will result in an error.
118+
119+
```py
120+
response = client.list_clusters(
121+
request={
122+
"project_id": project_id,
123+
"zone": zone,
124+
},
125+
parent=parent
126+
)
127+
```
128+
129+
130+
131+
## Enums and Types
132+
133+
134+
> **WARNING**: Breaking change
135+
136+
The submodules `enums` and `types` have been removed.
137+
138+
**Before:**
139+
```py
140+
141+
from google.cloud import container
142+
143+
status = container.enums.Cluster.Status.RUNNING
144+
cluster = container.types.Cluster(name="name")
145+
```
146+
147+
148+
**After:**
149+
```py
150+
from google.cloud import container
151+
152+
status = container.Cluster.Status.RUNNING
153+
cluster = container.Cluster(name="name")
154+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../UPGRADING.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Container v1 API
2+
====================================
3+
4+
.. automodule:: google.cloud.container_v1.services.cluster_manager
5+
:members:
6+
:inherited-members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Container v1 API
2+
=================================
3+
4+
.. automodule:: google.cloud.container_v1.types
5+
:members:
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Container v1beta1 API
2+
=========================================
3+
4+
.. automodule:: google.cloud.container_v1beta1.services.cluster_manager
5+
:members:
6+
:inherited-members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Container v1beta1 API
2+
======================================
3+
4+
.. automodule:: google.cloud.container_v1beta1.types
5+
:members:

packages/google-cloud-container/docs/gapic/v1/api.rst

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

packages/google-cloud-container/docs/gapic/v1/types.rst

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

packages/google-cloud-container/docs/index.rst

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,33 @@
44

55
API Reference
66
-------------
7+
8+
v1
9+
-------------
710
.. toctree::
8-
:maxdepth: 2
11+
:maxdepth: 2
12+
13+
container_v1/services
14+
container_v1/types
15+
16+
v1beta1
17+
-------------
18+
.. toctree::
19+
:maxdepth: 2
20+
21+
container_v1beta1/services
22+
container_v1beta1/types
23+
24+
Migration Guide
25+
---------------
26+
27+
See the guide below for instructions on migrating to the 2.x release of this library.
28+
29+
.. toctree::
30+
:maxdepth: 2
31+
32+
UPGRADING
933

10-
gapic/v1/api
11-
gapic/v1/types
1234

1335
Changelog
1436
---------

packages/google-cloud-container/google/__init__.py

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

packages/google-cloud-container/google/cloud/__init__.py

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

0 commit comments

Comments
 (0)