This repository was archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
feat: Migrate API client to Microgenerator #54
Merged
hkdevandla
merged 29 commits into
googleapis:master
from
hkdevandla:add-snippets-samples
Aug 20, 2020
Merged
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
d15145b
Add samples for Data Catalog lookup_entry [(#2148)](https://github.co…
ae918c6
Add region tags to support Data Catalog docs [(#2169)](https://github…
45dfe60
Adds updates including compute [(#2436)](https://github.com/GoogleClo…
gguuss 8acdfd1
Auto-update dependencies. [(#2005)](https://github.com/GoogleCloudPla…
dpebot 0edabe8
chore(deps): update dependency google-cloud-datacatalog to v0.6.0 [(#…
renovate-bot 6edf172
Simplify noxfile setup. [(#2806)](https://github.com/GoogleCloudPlatf…
kurtisvg c42616a
Update dependency google-cloud-datacatalog to v0.7.0 [(#3320)](https:…
renovate-bot 9f14362
Update Data Catalog samples to V1 [(#3382)](https://github.com/Google…
mesmacosta 978ba8a
chore(deps): update dependency google-cloud-datacatalog to v0.8.0 [(#…
renovate-bot 7ecbb87
Update dependency google-cloud-datacatalog to v1 [(#4115)](https://gi…
renovate-bot 796d0fd
chore(deps): update dependency pytest to v5.4.3 [(#4279)](https://git…
renovate-bot 6e3ce9a
Update dependency pytest to v6 [(#4390)](https://github.com/GoogleClo…
renovate-bot cb9c41e
Merge branch 'snippets-samples' into add-snippets-samples
hkdevandla bc14411
chore: update templates
hkdevandla f570d73
chore: update templates
hkdevandla 81b11fc
feat: Migrate to use Microgenerator
hkdevandla 3d5904a
Merge branch 'master' into add-snippets-samples
hkdevandla 3f89158
feat: Migrate to use Microgenerator
hkdevandla 09d02eb
feat: Migrate to use Microgenerator
hkdevandla f988dfd
Migrate API to microgenerator
hkdevandla bbbde39
Migrate API to microgenerator
hkdevandla 972ce0c
Samples tests
hkdevandla 4403214
fix samples tests
hkdevandla 01d07f5
fix lint errors and test coverage metrics
hkdevandla 7981014
docs update
hkdevandla 2038912
fix docs
hkdevandla cf28425
fix docs
hkdevandla 86cb41d
fix docs
hkdevandla 188fb41
remove .python-version file
hkdevandla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| python-datacatalog | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| # 2.0.0 Migration Guide | ||
|
|
||
| The 2.0 release of the `google-cloud-datacatalog` 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. | ||
|
|
||
| If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-datacatalog/issues). | ||
|
|
||
| ## Supported Python Versions | ||
|
|
||
| > **WARNING**: Breaking change | ||
| The 2.0.0 release requires Python 3.6+. | ||
|
|
||
|
|
||
| ## Method Calls | ||
|
|
||
| > **WARNING**: Breaking change | ||
| Methods expect request objects. We provide a script that will convert most common use cases. | ||
|
|
||
| * Install the library | ||
|
|
||
| ```py | ||
| python3 -m pip install google-cloud-datacatalog | ||
| ``` | ||
|
|
||
| * The script `fixup_datacatalog_v1_keywords.py` is shipped with the library. It expects | ||
| an input directory (with the code to convert) and an empty destination directory. | ||
|
|
||
| ```sh | ||
| $ fixup_datacatalog_v1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
| ``` | ||
|
|
||
| **Before:** | ||
| ```py | ||
| from google.cloud import datacatalog_v1 | ||
| datacatalog = datacatalog_v1.DataCatalogClient() | ||
| return datacatalog.lookup_entry(linked_resource=resource_name) | ||
| ``` | ||
|
|
||
|
|
||
| **After:** | ||
| ```py | ||
| from google.cloud import datacatalog_v1 | ||
| datacatalog = datacatalog_v1.DataCatalogClient() | ||
| return datacatalog.lookup_entry(request={'linked_resource': resource_name}) | ||
| ``` | ||
|
|
||
| ### More Details | ||
|
|
||
| In `google-cloud-datacatalog<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
|
||
| **Before:** | ||
| ```py | ||
| def create_entry_group( | ||
| self, | ||
| parent, | ||
| entry_group_id, | ||
| entry_group=None, | ||
| retry=google.api_core.gapic_v1.method.DEFAULT, | ||
| timeout=google.api_core.gapic_v1.method.DEFAULT, | ||
| metadata=None, | ||
| ): | ||
| ``` | ||
|
|
||
| In the 2.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional. | ||
|
|
||
| Some methods have additional keyword only parameters. The available parameters depend on the `google.api.method_signature` annotation specified by the API producer. | ||
|
|
||
|
|
||
| **After:** | ||
| ```py | ||
| def create_entry_group( | ||
| self, | ||
| request: datacatalog.CreateEntryGroupRequest = None, | ||
| *, | ||
| parent: str = None, | ||
| entry_group_id: str = None, | ||
| entry_group: datacatalog.EntryGroup = None, | ||
| retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
| timeout: float = None, | ||
| metadata: Sequence[Tuple[str, str]] = (), | ||
| ) -> datacatalog.EntryGroup: | ||
| ``` | ||
|
|
||
| > **NOTE:** The `request` parameter and flattened keyword parameters for the API are mutually exclusive. | ||
| > Passing both will result in an error. | ||
|
|
||
| Both of these calls are valid: | ||
|
|
||
| ```py | ||
| response = client.create_entry_group( | ||
| request={ | ||
| "parent": parent, | ||
| "entry_group_id": entry_group_id, | ||
| "entry_group": entry_group | ||
| } | ||
| ) | ||
| ``` | ||
|
|
||
| ```py | ||
| response = client.create_entry_group( | ||
| parent=parent, | ||
| entry_group_id=entry_group_id, | ||
| entry_group=entry_group | ||
| ) # Make an API request. | ||
| ``` | ||
|
|
||
| This call is invalid because it mixes `request` with a keyword argument `entry_group`. Executing this code | ||
| will result in an error. | ||
|
|
||
| ```py | ||
| response = client.create_entry_group( | ||
| request={ | ||
| "parent": parent, | ||
| "entry_group_id"=entry_group_id | ||
| }, | ||
| entry_group=entry_group | ||
| ) | ||
| ``` | ||
|
|
||
|
|
||
|
|
||
| ## Enums and Types | ||
|
|
||
|
|
||
| > **WARNING**: Breaking change | ||
| The submodules `enums` and `types` have been removed. | ||
|
|
||
| **Before:** | ||
| ```py | ||
| from google.cloud import datacatalog_v1 | ||
| entry = datacatalog_v1beta1.types.Entry() | ||
| entry.type = datacatalog_v1beta1.enums.EntryType.FILESET | ||
| ``` | ||
|
|
||
|
|
||
| **After:** | ||
| ```py | ||
| from google.cloud import datacatalog_v1 | ||
| entry = datacatalog_v1beta1.Entry() | ||
| entry.type = datacatalog_v1beta1.EntryType.FILESET | ||
| ``` | ||
|
|
||
| ## Project Path Helper Methods | ||
|
|
||
| The project path helper method `project_path` has been removed. Please construct | ||
| this path manually. | ||
|
|
||
| ```py | ||
| project = 'my-project' | ||
| project_path = f'projects/{project}' | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| ../UPGRADING.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Services for Google Cloud Datacatalog v1 API | ||
| ============================================ | ||
|
|
||
| .. automodule:: google.cloud.datacatalog_v1.services.data_catalog | ||
| :members: | ||
| :inherited-members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Types for Google Cloud Datacatalog v1 API | ||
| ========================================= | ||
|
|
||
| .. automodule:: google.cloud.datacatalog_v1.types | ||
| :members: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| Services for Google Cloud Datacatalog v1beta1 API | ||
| ================================================= | ||
|
|
||
| .. automodule:: google.cloud.datacatalog_v1beta1.services.data_catalog | ||
| :members: | ||
| :inherited-members: | ||
| .. automodule:: google.cloud.datacatalog_v1beta1.services.policy_tag_manager | ||
| :members: | ||
| :inherited-members: | ||
| .. automodule:: google.cloud.datacatalog_v1beta1.services.policy_tag_manager_serialization | ||
| :members: | ||
| :inherited-members: |
4 changes: 2 additions & 2 deletions
4
docs/gapic/v1beta1/types.rst → docs/datacatalog_v1beta1/types.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| Types for Google Cloud Data Catalog API Client | ||
| Types for Google Cloud Datacatalog v1beta1 API | ||
| ============================================== | ||
|
|
||
| .. automodule:: google.cloud.datacatalog_v1beta1.types | ||
| :members: | ||
| :members: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.