This repository has been archived by the owner on Sep 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
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
01ea98e
commit 446cc42
Showing
51 changed files
with
4,287 additions
and
3,077 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
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,121 @@ | ||
# 1.0.0 Migration Guide | ||
|
||
The 1.0 release of the `google-cloud-billing-budgets` 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-billingbudgets/issues). | ||
|
||
## Supported Python Versions | ||
|
||
> **WARNING**: Breaking change | ||
The 1.0.0 release requires Python 3.6+. | ||
|
||
|
||
## Namespace Change | ||
|
||
> **WARNING**: Breaking change | ||
The 1.0.0 release changes namespace from `google.cloud.billing_budgets` to `google.cloud.billing.budgets`. | ||
|
||
**Before:** | ||
```py | ||
from google.cloud import billing_budgets | ||
|
||
client = billing_budgets.BudgetServiceClient() | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.billing import budgets | ||
|
||
client = budgets.BudgetServiceClient() | ||
``` | ||
|
||
|
||
## 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-billing-budgets | ||
``` | ||
|
||
* The script `fixup_budgets_v1beta1_keywords.py` is shipped with the library. It expects | ||
an input directory (with the code to convert) and an empty destination directory. | ||
|
||
```sh | ||
$ fixup_budgets_v1beta1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
``` | ||
|
||
**Before:** | ||
```py | ||
budget = client.get_budget(name="billingAccounts/account/budgets/budget") | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
budget = client.get_budget(request = {'name': "billingAccounts/account/budgets/budget"}) | ||
``` | ||
|
||
### More Details | ||
|
||
In `google-cloud-billing-budgets<1.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
||
**Before:** | ||
```py | ||
def create_budget( | ||
self, | ||
parent, | ||
budget, | ||
retry=google.api_core.gapic_v1.method.DEFAULT, | ||
timeout=google.api_core.gapic_v1.method.DEFAULT, | ||
metadata=None, | ||
): | ||
``` | ||
|
||
In the 1.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional. | ||
|
||
|
||
**After:** | ||
```py | ||
def create_budget( | ||
self, | ||
request: budget_service.CreateBudgetRequest = None, | ||
*, | ||
retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
timeout: float = None, | ||
metadata: Sequence[Tuple[str, str]] = (), | ||
) -> budget_model.Budget: | ||
``` | ||
|
||
|
||
## Enums and Types | ||
|
||
|
||
> **WARNING**: Breaking change | ||
The submodules `enums` and `types` have been removed. | ||
|
||
**Before:** | ||
```py | ||
|
||
from google.cloud import billing_budgets | ||
|
||
filter = billing_budgets.enums.Filter.CreditTypesTreatment.INCLUDE_ALL_CREDITS | ||
budget = billing_budgets.types.Budget() | ||
``` | ||
|
||
|
||
**After:** | ||
```py | ||
from google.cloud.billing import budgets | ||
|
||
filter = budgets.Filter.CreditTypesTreatment.INCLUDE_ALL_CREDITS | ||
budget = budgets.Budget() | ||
``` |
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 Billing Budgets v1beta1 API | ||
===================================================== | ||
|
||
.. automodule:: google.cloud.billing.budgets_v1beta1.services.budget_service | ||
: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 Billing Budgets v1beta1 API | ||
================================================== | ||
|
||
.. automodule:: google.cloud.billing.budgets_v1beta1.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
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,60 @@ | ||
# -*- 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.billing.budgets_v1beta1.services.budget_service.async_client import ( | ||
BudgetServiceAsyncClient, | ||
) | ||
from google.cloud.billing.budgets_v1beta1.services.budget_service.client import ( | ||
BudgetServiceClient, | ||
) | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import AllUpdatesRule | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import Budget | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import BudgetAmount | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import Filter | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import LastPeriodAmount | ||
from google.cloud.billing.budgets_v1beta1.types.budget_model import ThresholdRule | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import ( | ||
CreateBudgetRequest, | ||
) | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import ( | ||
DeleteBudgetRequest, | ||
) | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import GetBudgetRequest | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import ListBudgetsRequest | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import ( | ||
ListBudgetsResponse, | ||
) | ||
from google.cloud.billing.budgets_v1beta1.types.budget_service import ( | ||
UpdateBudgetRequest, | ||
) | ||
|
||
__all__ = ( | ||
"AllUpdatesRule", | ||
"Budget", | ||
"BudgetAmount", | ||
"BudgetServiceAsyncClient", | ||
"BudgetServiceClient", | ||
"CreateBudgetRequest", | ||
"DeleteBudgetRequest", | ||
"Filter", | ||
"GetBudgetRequest", | ||
"LastPeriodAmount", | ||
"ListBudgetsRequest", | ||
"ListBudgetsResponse", | ||
"ThresholdRule", | ||
"UpdateBudgetRequest", | ||
) |
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-billing-budgets package uses inline types. |
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,47 @@ | ||
# -*- 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 .services.budget_service import BudgetServiceClient | ||
from .types.budget_model import AllUpdatesRule | ||
from .types.budget_model import Budget | ||
from .types.budget_model import BudgetAmount | ||
from .types.budget_model import Filter | ||
from .types.budget_model import LastPeriodAmount | ||
from .types.budget_model import ThresholdRule | ||
from .types.budget_service import CreateBudgetRequest | ||
from .types.budget_service import DeleteBudgetRequest | ||
from .types.budget_service import GetBudgetRequest | ||
from .types.budget_service import ListBudgetsRequest | ||
from .types.budget_service import ListBudgetsResponse | ||
from .types.budget_service import UpdateBudgetRequest | ||
|
||
|
||
__all__ = ( | ||
"AllUpdatesRule", | ||
"Budget", | ||
"BudgetAmount", | ||
"CreateBudgetRequest", | ||
"DeleteBudgetRequest", | ||
"Filter", | ||
"GetBudgetRequest", | ||
"LastPeriodAmount", | ||
"ListBudgetsRequest", | ||
"ListBudgetsResponse", | ||
"ThresholdRule", | ||
"UpdateBudgetRequest", | ||
"BudgetServiceClient", | ||
) |
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Marker file for PEP 561. | ||
# The google-cloud-billing-budgets package uses inline types. |
14 changes: 3 additions & 11 deletions
14
google/cloud/__init__.py → ...ling/budgets_v1beta1/services/__init__.py
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,24 +1,16 @@ | ||
# -*- 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 | ||
# 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. | ||
|
||
try: | ||
import pkg_resources | ||
|
||
pkg_resources.declare_namespace(__name__) | ||
except ImportError: | ||
import pkgutil | ||
|
||
__path__ = pkgutil.extend_path(__path__, __name__) | ||
# |
18 changes: 9 additions & 9 deletions
18
google/__init__.py → ...beta1/services/budget_service/__init__.py
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,24 +1,24 @@ | ||
# -*- 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 | ||
# 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. | ||
# | ||
|
||
try: | ||
import pkg_resources | ||
|
||
pkg_resources.declare_namespace(__name__) | ||
except ImportError: | ||
import pkgutil | ||
from .client import BudgetServiceClient | ||
from .async_client import BudgetServiceAsyncClient | ||
|
||
__path__ = pkgutil.extend_path(__path__, __name__) | ||
__all__ = ( | ||
"BudgetServiceClient", | ||
"BudgetServiceAsyncClient", | ||
) |
Oops, something went wrong.