This repository has been archived by the owner on Dec 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-containeranalysis/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> 🦕
- Loading branch information
1 parent
4f3bcdd
commit 6098905
Showing
46 changed files
with
3,918 additions
and
1,544 deletions.
There are no files selected for viewing
This file contains 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,35 +1,17 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Generated by synthtool. DO NOT EDIT! | ||
[run] | ||
branch = True | ||
|
||
[report] | ||
fail_under = 100 | ||
show_missing = True | ||
omit = google/cloud/devtools/containeranalysis/__init__.py | ||
exclude_lines = | ||
# Re-enable the standard pragma | ||
pragma: NO COVER | ||
# Ignore debug-only repr | ||
def __repr__ | ||
# Ignore abstract methods | ||
raise NotImplementedError | ||
omit = | ||
*/gapic/*.py | ||
*/proto/*.py | ||
*/core/*.py | ||
*/site-packages/*.py | ||
# Ignore pkg_resources exceptions. | ||
# This is added at the module level as a safeguard for if someone | ||
# generates the code and tries to run it without pip installing. This | ||
# makes it virtually impossible to test properly. | ||
except pkg_resources.DistributionNotFound |
This file contains 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 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,142 @@ | ||
# 2.0.0 Migration Guide | ||
|
||
The 2.0 release of the `google-cloud-containeranalysis` 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-containeranalysis/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-containeranalysis | ||
``` | ||
|
||
* The script `fixup_containeranalysis_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_containeranalysis_v1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
``` | ||
|
||
**Before:** | ||
```py | ||
from google.cloud.devtools import containeranalysis_v1 | ||
|
||
client = containeranalysis_v1.ContainerAnalysisClient() | ||
resource = "projects/[PROJECT_ID]/notes/[NOTE_ID]" | ||
policy = client.get_iam_policy(resource) | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.devtools import containeranalysis_v1 | ||
|
||
client = containeranalysis_v1.ContainerAnalysisClient() | ||
request = {"resource": "projects/[PROJECT_ID]/notes/[NOTE_ID]"} | ||
policy = client.get_iam_policy(request=request) | ||
``` | ||
|
||
### More Details | ||
|
||
In `google-cloud-containeranalysis<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
||
**Before:** | ||
```py | ||
def get_iam_policy( | ||
self, | ||
resource, | ||
options_=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](https://github.com/googleapis/googleapis/blob/b77cacf1ed06e0301a39d6328b599e24102f04be/google/devtools/containeranalysis/v1/containeranalysis.proto#L67) specified by the API producer. | ||
|
||
|
||
**After:** | ||
```py | ||
def get_iam_policy( | ||
self, | ||
request: iam_policy.GetIamPolicyRequest = None, | ||
*, | ||
resource: str = None, | ||
retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
timeout: float = None, | ||
metadata: Sequence[Tuple[str, str]] = (), | ||
) -> policy.Policy: | ||
``` | ||
|
||
> **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.test_iam_permissions( | ||
request={ | ||
"resource": resource, | ||
"permissions": permissions, | ||
} | ||
) | ||
``` | ||
|
||
```py | ||
response = client.test_iam_permissions( | ||
resource=resource, | ||
permissions=permissions, | ||
) | ||
``` | ||
|
||
This call is invalid because it mixes `request` with a keyword argument `permissions`. Executing this code | ||
will result in an error. | ||
|
||
```py | ||
response = client.test_iam_permissions( | ||
request={ | ||
"resource": resource, | ||
}, | ||
permissions=permissions | ||
) | ||
``` | ||
|
||
|
||
|
||
## Enums and Types | ||
|
||
|
||
> **WARNING**: Breaking change | ||
The submodule `types` has been removed. | ||
|
||
**Before:** | ||
```py | ||
from google.cloud.devtools import containeranalysis_v1 | ||
|
||
audit_config = containeranalysis_v1.types.AuditConfigDelta() | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.devtools import containeranalysis_v1 | ||
|
||
audit_config = containeranalysis_v1.AuditConfigDelta() | ||
``` |
This file contains 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 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 Devtools Containeranalysis v1 API | ||
=========================================================== | ||
|
||
.. automodule:: google.cloud.devtools.containeranalysis_v1.services.container_analysis | ||
:members: | ||
:inherited-members: |
This file contains 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 Devtools Containeranalysis v1 API | ||
======================================================== | ||
|
||
.. automodule:: google.cloud.devtools.containeranalysis_v1.types | ||
:members: |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains 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
100 changes: 0 additions & 100 deletions
100
google/cloud/containeranalysis_v1/proto/containeranalysis.proto
This file was deleted.
Oops, something went wrong.
This file contains 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,28 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Copyright 2020 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
from google.cloud.devtools.containeranalysis_v1.services.container_analysis.async_client import ( | ||
ContainerAnalysisAsyncClient, | ||
) | ||
from google.cloud.devtools.containeranalysis_v1.services.container_analysis.client import ( | ||
ContainerAnalysisClient, | ||
) | ||
|
||
__all__ = ( | ||
"ContainerAnalysisAsyncClient", | ||
"ContainerAnalysisClient", | ||
) |
This file contains 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,2 @@ | ||
# Marker file for PEP 561. | ||
# The google-cloud-devtools-containeranalysis package uses inline types. |
Oops, something went wrong.