Skip to content

Commit ce4eac5

Browse files
feat!: migrate to use microgenerator (#38)
* feat: migrate to use microgenerator * Update README.rst Co-authored-by: Bu Sun Kim <[email protected]> * Update setup.py Co-authored-by: Bu Sun Kim <[email protected]> Co-authored-by: Bu Sun Kim <[email protected]>
1 parent 1f3bc78 commit ce4eac5

Some content is hidden

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

51 files changed

+4287
-3077
lines changed

packages/google-cloud-billing-budgets/.coveragerc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ omit =
3232
*/gapic/*.py
3333
*/proto/*.py
3434
*/core/*.py
35-
*/site-packages/*.py
35+
*/site-packages/*.py
36+
google/cloud/billing/budgets/__init__.py

packages/google-cloud-billing-budgets/README.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Python Client for Cloud Billing Budget API
22
=====================================================
33

4-
|beta| |pypi| |versions|
4+
|beta| |pypi| |versions|
55

66
`Cloud Billing Budget API`_: The Cloud Billing Budget API stores Cloud Billing budgets, which define a
77
budget plan and the rules to execute as spend is tracked against that
@@ -48,6 +48,15 @@ dependencies.
4848

4949
.. _`virtualenv`: https://virtualenv.pypa.io/en/latest/
5050

51+
Supported Python Versions
52+
^^^^^^^^^^^^^^^^^^^^^^^^^
53+
Python >= 3.6
54+
55+
Deprecated Python Versions
56+
^^^^^^^^^^^^^^^^^^^^^^^^^^
57+
Python == 2.7.
58+
59+
The last version of this library compatible with Python 2.7 is google-cloud-billing-budgets==0.4.0.
5160

5261
Mac/Linux
5362
^^^^^^^^^
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# 1.0.0 Migration Guide
2+
3+
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.
4+
5+
If you experience issues or have questions, please file an [issue](https://github.com/googleapis/python-billingbudgets/issues).
6+
7+
## Supported Python Versions
8+
9+
> **WARNING**: Breaking change
10+
11+
The 1.0.0 release requires Python 3.6+.
12+
13+
14+
## Namespace Change
15+
16+
> **WARNING**: Breaking change
17+
18+
The 1.0.0 release changes namespace from `google.cloud.billing_budgets` to `google.cloud.billing.budgets`.
19+
20+
**Before:**
21+
```py
22+
from google.cloud import billing_budgets
23+
24+
client = billing_budgets.BudgetServiceClient()
25+
```
26+
27+
28+
**After:**
29+
```py
30+
from google.cloud.billing import budgets
31+
32+
client = budgets.BudgetServiceClient()
33+
```
34+
35+
36+
## Method Calls
37+
38+
> **WARNING**: Breaking change
39+
40+
Methods expect request objects. We provide a script that will convert most common use cases.
41+
42+
* Install the library
43+
44+
```py
45+
python3 -m pip install google-cloud-billing-budgets
46+
```
47+
48+
* The script `fixup_budgets_v1beta1_keywords.py` is shipped with the library. It expects
49+
an input directory (with the code to convert) and an empty destination directory.
50+
51+
```sh
52+
$ fixup_budgets_v1beta1_keywords.py --input-directory .samples/ --output-directory samples/
53+
```
54+
55+
**Before:**
56+
```py
57+
budget = client.get_budget(name="billingAccounts/account/budgets/budget")
58+
```
59+
60+
61+
**After:**
62+
```py
63+
budget = client.get_budget(request = {'name': "billingAccounts/account/budgets/budget"})
64+
```
65+
66+
### More Details
67+
68+
In `google-cloud-billing-budgets<1.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters.
69+
70+
**Before:**
71+
```py
72+
def create_budget(
73+
self,
74+
parent,
75+
budget,
76+
retry=google.api_core.gapic_v1.method.DEFAULT,
77+
timeout=google.api_core.gapic_v1.method.DEFAULT,
78+
metadata=None,
79+
):
80+
```
81+
82+
In the 1.0.0 release, all methods have a single positional parameter `request`. Method docstrings indicate whether a parameter is required or optional.
83+
84+
85+
**After:**
86+
```py
87+
def create_budget(
88+
self,
89+
request: budget_service.CreateBudgetRequest = None,
90+
*,
91+
retry: retries.Retry = gapic_v1.method.DEFAULT,
92+
timeout: float = None,
93+
metadata: Sequence[Tuple[str, str]] = (),
94+
) -> budget_model.Budget:
95+
```
96+
97+
98+
## Enums and Types
99+
100+
101+
> **WARNING**: Breaking change
102+
103+
The submodules `enums` and `types` have been removed.
104+
105+
**Before:**
106+
```py
107+
108+
from google.cloud import billing_budgets
109+
110+
filter = billing_budgets.enums.Filter.CreditTypesTreatment.INCLUDE_ALL_CREDITS
111+
budget = billing_budgets.types.Budget()
112+
```
113+
114+
115+
**After:**
116+
```py
117+
from google.cloud.billing import budgets
118+
119+
filter = budgets.Filter.CreditTypesTreatment.INCLUDE_ALL_CREDITS
120+
budget = budgets.Budget()
121+
```
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../UPGRADING.md
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Services for Google Cloud Billing Budgets v1beta1 API
2+
=====================================================
3+
4+
.. automodule:: google.cloud.billing.budgets_v1beta1.services.budget_service
5+
:members:
6+
:inherited-members:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Types for Google Cloud Billing Budgets v1beta1 API
2+
==================================================
3+
4+
.. automodule:: google.cloud.billing.budgets_v1beta1.types
5+
:members:

packages/google-cloud-billing-budgets/docs/gapic/v1beta1/api.rst

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

packages/google-cloud-billing-budgets/docs/gapic/v1beta1/types.rst

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

packages/google-cloud-billing-budgets/docs/index.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,18 @@ Api Reference
77
.. toctree::
88
:maxdepth: 2
99

10-
gapic/v1beta1/api
11-
gapic/v1beta1/types
10+
budgets_v1beta1/services
11+
budgets_v1beta1/types
12+
13+
Migration Guide
14+
---------------
15+
16+
See the guide below for instructions on migrating to the 2.x release of this library.
17+
18+
.. toctree::
19+
:maxdepth: 2
20+
21+
UPGRADING
1222

1323
Changelog
1424
---------
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright 2020 Google LLC
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
from google.cloud.billing.budgets_v1beta1.services.budget_service.async_client import (
19+
BudgetServiceAsyncClient,
20+
)
21+
from google.cloud.billing.budgets_v1beta1.services.budget_service.client import (
22+
BudgetServiceClient,
23+
)
24+
from google.cloud.billing.budgets_v1beta1.types.budget_model import AllUpdatesRule
25+
from google.cloud.billing.budgets_v1beta1.types.budget_model import Budget
26+
from google.cloud.billing.budgets_v1beta1.types.budget_model import BudgetAmount
27+
from google.cloud.billing.budgets_v1beta1.types.budget_model import Filter
28+
from google.cloud.billing.budgets_v1beta1.types.budget_model import LastPeriodAmount
29+
from google.cloud.billing.budgets_v1beta1.types.budget_model import ThresholdRule
30+
from google.cloud.billing.budgets_v1beta1.types.budget_service import (
31+
CreateBudgetRequest,
32+
)
33+
from google.cloud.billing.budgets_v1beta1.types.budget_service import (
34+
DeleteBudgetRequest,
35+
)
36+
from google.cloud.billing.budgets_v1beta1.types.budget_service import GetBudgetRequest
37+
from google.cloud.billing.budgets_v1beta1.types.budget_service import ListBudgetsRequest
38+
from google.cloud.billing.budgets_v1beta1.types.budget_service import (
39+
ListBudgetsResponse,
40+
)
41+
from google.cloud.billing.budgets_v1beta1.types.budget_service import (
42+
UpdateBudgetRequest,
43+
)
44+
45+
__all__ = (
46+
"AllUpdatesRule",
47+
"Budget",
48+
"BudgetAmount",
49+
"BudgetServiceAsyncClient",
50+
"BudgetServiceClient",
51+
"CreateBudgetRequest",
52+
"DeleteBudgetRequest",
53+
"Filter",
54+
"GetBudgetRequest",
55+
"LastPeriodAmount",
56+
"ListBudgetsRequest",
57+
"ListBudgetsResponse",
58+
"ThresholdRule",
59+
"UpdateBudgetRequest",
60+
)

0 commit comments

Comments
 (0)