This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d022f7
commit 04828a3
Showing
143 changed files
with
38,737 additions
and
26,439 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
File renamed without changes.
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,146 @@ | ||
# 2.0.0 Migration Guide | ||
|
||
The 2.0 release of the `google-cloud-build` 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-cloudbuild/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-build | ||
``` | ||
|
||
* The script `fixup_cloudbuild_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_cloudbuild_v1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
``` | ||
|
||
**Before:** | ||
```py | ||
from google.cloud.devtools import cloudbuild | ||
|
||
client = cloudbuild.CloudBuildClient() | ||
|
||
build = client.get_build("project_id") | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.devtools import cloudbuild | ||
|
||
client = cloudbuild.CloudBuildClient() | ||
|
||
build = client.get_build(request = {'project_id': "project_id"}) | ||
``` | ||
|
||
### More Details | ||
|
||
In `google-cloud-build<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
||
**Before:** | ||
```py | ||
def list_builds( | ||
self, | ||
project_id, | ||
page_size=None, | ||
filter_=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/master/google/devtools/cloudbuild/v1/cloudbuild.proto#L82) specified by the API producer. | ||
|
||
|
||
**After:** | ||
```py | ||
def list_builds( | ||
self, | ||
request: cloudbuild.ListBuildsRequest = None, | ||
*, | ||
project_id: str = None, | ||
filter: str = None, | ||
retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
timeout: float = None, | ||
metadata: Sequence[Tuple[str, str]] = (), | ||
) -> pagers.ListBuildsPager: | ||
``` | ||
|
||
> **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.list_builds( | ||
request={ | ||
"project_id": project_id, | ||
"filter": filter, | ||
} | ||
) | ||
``` | ||
|
||
```py | ||
response = client.list_builds( | ||
project_id=project_id, | ||
filter=filter, | ||
) | ||
``` | ||
|
||
This call is invalid because it mixes `request` with a keyword argument `filter`. Executing this code | ||
will result in an error. | ||
|
||
```py | ||
response = client.list_builds( | ||
request={ | ||
"project_id": project_id, | ||
}, | ||
filter=filter | ||
) | ||
``` | ||
|
||
|
||
|
||
## Enums and Types | ||
|
||
|
||
> **WARNING**: Breaking change | ||
The submodules `enums` and `types` have been removed. | ||
|
||
**Before:** | ||
```py | ||
from google.cloud.devtools import cloudbuild | ||
|
||
build_status = cloudbuild.enums.Build.Status.SUCCESS | ||
built_image = cloudbuild.types.BuiltImage(name="name") | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.devtools import cloudbuild | ||
|
||
build_status = cloudbuild.Build.Status.SUCCESS | ||
built_image = cloudbuild.BuiltImage(name="name") | ||
``` |
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 was deleted.
Oops, something went wrong.
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 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
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 Tasks v2 API | ||
====================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2.services.cloud_tasks | ||
: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 Tasks v2 API | ||
=================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2.types | ||
: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,6 @@ | ||
Services for Google Cloud Tasks v2beta2 API | ||
=========================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2beta2.services.cloud_tasks | ||
: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 Tasks v2beta2 API | ||
======================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2beta2.types | ||
: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,6 @@ | ||
Services for Google Cloud Tasks v2beta3 API | ||
=========================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2beta3.services.cloud_tasks | ||
: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 Tasks v2beta3 API | ||
======================================== | ||
|
||
.. automodule:: google.cloud.tasks_v2beta3.types | ||
: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,80 @@ | ||
# -*- 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.tasks_v2.services.cloud_tasks.async_client import ( | ||
CloudTasksAsyncClient, | ||
) | ||
from google.cloud.tasks_v2.services.cloud_tasks.client import CloudTasksClient | ||
from google.cloud.tasks_v2.types.cloudtasks import CreateQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import CreateTaskRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import DeleteQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import DeleteTaskRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import GetQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import GetTaskRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import ListQueuesRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import ListQueuesResponse | ||
from google.cloud.tasks_v2.types.cloudtasks import ListTasksRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import ListTasksResponse | ||
from google.cloud.tasks_v2.types.cloudtasks import PauseQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import PurgeQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import ResumeQueueRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import RunTaskRequest | ||
from google.cloud.tasks_v2.types.cloudtasks import UpdateQueueRequest | ||
from google.cloud.tasks_v2.types.queue import Queue | ||
from google.cloud.tasks_v2.types.queue import RateLimits | ||
from google.cloud.tasks_v2.types.queue import RetryConfig | ||
from google.cloud.tasks_v2.types.queue import StackdriverLoggingConfig | ||
from google.cloud.tasks_v2.types.target import AppEngineHttpRequest | ||
from google.cloud.tasks_v2.types.target import AppEngineRouting | ||
from google.cloud.tasks_v2.types.target import HttpMethod | ||
from google.cloud.tasks_v2.types.target import HttpRequest | ||
from google.cloud.tasks_v2.types.target import OAuthToken | ||
from google.cloud.tasks_v2.types.target import OidcToken | ||
from google.cloud.tasks_v2.types.task import Attempt | ||
from google.cloud.tasks_v2.types.task import Task | ||
|
||
__all__ = ( | ||
"AppEngineHttpRequest", | ||
"AppEngineRouting", | ||
"Attempt", | ||
"CloudTasksAsyncClient", | ||
"CloudTasksClient", | ||
"CreateQueueRequest", | ||
"CreateTaskRequest", | ||
"DeleteQueueRequest", | ||
"DeleteTaskRequest", | ||
"GetQueueRequest", | ||
"GetTaskRequest", | ||
"HttpMethod", | ||
"HttpRequest", | ||
"ListQueuesRequest", | ||
"ListQueuesResponse", | ||
"ListTasksRequest", | ||
"ListTasksResponse", | ||
"OAuthToken", | ||
"OidcToken", | ||
"PauseQueueRequest", | ||
"PurgeQueueRequest", | ||
"Queue", | ||
"RateLimits", | ||
"ResumeQueueRequest", | ||
"RetryConfig", | ||
"RunTaskRequest", | ||
"StackdriverLoggingConfig", | ||
"Task", | ||
"UpdateQueueRequest", | ||
) |
Oops, something went wrong.