Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 3219b64

Browse files
feat!: move to microgenerator (#58)
* feat!: move to microgenerator * update UPGRADING.md * rebase after the samples are moved * update sample * update sample * update sample * update sample * fix linter * fix linter
1 parent 00b43e8 commit 3219b64

File tree

238 files changed

+25630
-21703
lines changed

Some content is hidden

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

238 files changed

+25630
-21703
lines changed

.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/asset/__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
@@ -48,11 +48,13 @@ dependencies.
4848

4949
Supported Python Versions
5050
^^^^^^^^^^^^^^^^^^^^^^^^^
51-
Python >= 3.5
51+
Python >= 3.6
5252

5353
Deprecated Python Versions
5454
^^^^^^^^^^^^^^^^^^^^^^^^^^
55-
Python == 2.7. Python 2.7 support will be removed on January 1, 2020.
55+
Python == 2.7.
56+
57+
The last version of this library compatible with Python 2.7 is google-cloud-asset==1.3.0.
5658

5759

5860
Mac/Linux

UPGRADING.md

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# 2.0.0 Migration Guide
2+
3+
The 2.0 release of the `google-cloud-asset` 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-asset/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-asset
24+
```
25+
26+
* The script `fixup_asset_v1_keywords.py` is shipped with the library. It expects
27+
an input directory (with the code to convert) and an empty destination directory.
28+
29+
```sh
30+
$ fixup_asset_v1_keywords.py --input-directory .samples/ --output-directory samples/
31+
```
32+
33+
**Before:**
34+
```py
35+
from google.cloud import asset
36+
37+
client = asset.AssetServiceClient()
38+
39+
feeds = client.list_feeds("folders/12345")
40+
```
41+
42+
43+
**After:**
44+
```py
45+
from google.cloud import asset
46+
47+
client = asset.AssetServiceClient()
48+
49+
feeds = client.list_feeds(request = {'parent': "folders/12345"})
50+
```
51+
52+
### More Details
53+
54+
In `google-cloud-asset<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
55+
56+
**Before:**
57+
```py
58+
def search_all_resources(
59+
self,
60+
scope,
61+
query=None,
62+
asset_types=None,
63+
page_size=None,
64+
order_by=None,
65+
retry=google.api_core.gapic_v1.method.DEFAULT,
66+
timeout=google.api_core.gapic_v1.method.DEFAULT,
67+
metadata=None,
68+
):
69+
```
70+
71+
In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
72+
73+
Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer.
74+
75+
76+
**After:**
77+
```py
78+
def search_all_resources(
79+
self,
80+
request: asset_service.SearchAllResourcesRequest = None,
81+
*,
82+
scope: str = None,
83+
query: str = None,
84+
asset_types: Sequence[str] = None,
85+
retry: retries.Retry = gapic_v1.method.DEFAULT,
86+
timeout: float = None,
87+
metadata: Sequence[Tuple[str, str]] = (),
88+
) -> pagers.SearchAllResourcesPager:
89+
```
90+
91+
> **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive.
92+
> Passing both will result in an error.
93+
94+
95+
Both of these calls are valid:
96+
97+
```py
98+
response = client.search_all_resources(
99+
request={
100+
"scope": scope,
101+
"query": query,
102+
"asset_types": asset_types,
103+
}
104+
)
105+
```
106+
107+
```py
108+
response = client.search_all_resources(
109+
scope=scope,
110+
query=query,
111+
asset_types=asset_types
112+
)
113+
```
114+
115+
This call is invalid because it mixes `request` with a keyword argument `asset_types`. Executing this code
116+
will result in an error.
117+
118+
```py
119+
response = client.search_all_resources(
120+
request={
121+
"scope": scope,
122+
"query": query,
123+
},
124+
asset_types=asset_types
125+
)
126+
```
127+
128+
129+
130+
## Enums and Types
131+
132+
133+
> **WARNING**: Breaking change
134+
135+
The submodules `enums` and `types` have been removed.
136+
137+
**Before:**
138+
```py
139+
from google.cloud import asset
140+
141+
resource = asset.enums.ContentType.RESOURCE
142+
cloud_asset = asset.types.Asset(name="name")
143+
```
144+
145+
146+
**After:**
147+
```py
148+
from google.cloud import asset
149+
150+
resource = asset.ContentType.RESOURCE
151+
cloud_asset = asset.Asset(name="name")
152+
```
153+
154+
## Project Path Helper Methods
155+
156+
The project path helper method `project_path` has been removed. Please construct
157+
this path manually.
158+
159+
```py
160+
project = 'my-project'
161+
project_path = f'projects/{project}'
162+
```

docs/UPGRADING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../UPGRADING.md

docs/asset_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 Cloud Asset v1 API
2+
======================================
3+
4+
.. automodule:: google.cloud.asset_v1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_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 Cloud Asset v1 API
2+
===================================
3+
4+
.. automodule:: google.cloud.asset_v1.types
5+
:members:

docs/asset_v1beta1/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Asset v1beta1 API
2+
===========================================
3+
4+
.. automodule:: google.cloud.asset_v1beta1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_v1beta1/types.rst

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

docs/asset_v1p1beta1/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Asset v1p1beta1 API
2+
=============================================
3+
4+
.. automodule:: google.cloud.asset_v1p1beta1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_v1p1beta1/types.rst

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

docs/asset_v1p2beta1/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Asset v1p2beta1 API
2+
=============================================
3+
4+
.. automodule:: google.cloud.asset_v1p2beta1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_v1p2beta1/types.rst

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

docs/asset_v1p4beta1/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Asset v1p4beta1 API
2+
=============================================
3+
4+
.. automodule:: google.cloud.asset_v1p4beta1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_v1p4beta1/types.rst

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

docs/asset_v1p5beta1/services.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Asset v1p5beta1 API
2+
=============================================
3+
4+
.. automodule:: google.cloud.asset_v1p5beta1.services.asset_service
5+
:members:
6+
:inherited-members:

docs/asset_v1p5beta1/types.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Cloud Asset v1p5beta1 API
2+
==========================================
3+
4+
.. automodule:: google.cloud.asset_v1p5beta1.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/gapic/v1beta1/api.rst

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

docs/gapic/v1beta1/types.rst

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

docs/gapic/v1p1beta1/api.rst

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

docs/gapic/v1p1beta1/types.rst

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

docs/gapic/v1p2beta1/api.rst

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

docs/gapic/v1p2beta1/types.rst

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

docs/gapic/v1p4beta1/api.rst

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

docs/gapic/v1p4beta1/types.rst

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

docs/gapic/v1p5beta1/api.rst

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

docs/gapic/v1p5beta1/types.rst

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy