-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: move API to python microgenerator (#26)
* remove generated directories * change synthtool * unit test * update README * setupfile change * regeneration * update documentation * restructure * clean up * feedback * clean
- Loading branch information
1 parent
7b0bb26
commit b8609bc
Showing
110 changed files
with
10,380 additions
and
6,839 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
121 changes: 121 additions & 0 deletions
121
packages/google-cloud-monitoring-dashboards/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,121 @@ | ||
# 2.0.0 Migration Guide | ||
|
||
The 1.0 release of the `google-cloud-monitoring-dashboards` 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-monitoring-dashboards/issues). | ||
|
||
## Supported Python Versions | ||
|
||
> **WARNING**: Breaking change | ||
The 2.0.0 release requires Python 3.6+. | ||
|
||
## Create Service Client | ||
> **WARNING**: Breaking change | ||
The namespace for importing the service gets changed in the new release. | ||
|
||
|
||
**Before:** | ||
```py | ||
from google.cloud.monitoring_dashboard import v1 | ||
client = v1.DashboardsServiceClient() | ||
``` | ||
**After:** | ||
```py | ||
from google.cloud import monitoring_dashboard_v1 | ||
client = monitoring_dashboard_v1.DashboardsServiceClient() | ||
``` | ||
|
||
## 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-monitoring-dashboards | ||
``` | ||
|
||
* The scripts `fixup_dashboard_v1_keywords.py` shipped with the library. It expects | ||
an input directory (with the code to convert) and an empty destination directory. | ||
|
||
```sh | ||
$ fixup_dashboard_v1_keywords.py --input-directory .samples/ --output-directory samples/ | ||
``` | ||
|
||
**Before:** | ||
```py | ||
# TODO: Initialize `parent`: | ||
parent = '' | ||
# TODO: Initialize `dashboard`: | ||
dashboard = {} | ||
response = client.create_dashboard(parent, dashboard) | ||
``` | ||
|
||
**After:** | ||
```py | ||
response = client.create_dashboard(request={"parent": "''", "dashboard": "{}"}) | ||
``` | ||
|
||
### More Details | ||
|
||
In `google-cloud-monitoring-dashboards<2.0.0`, parameters required by the API were positional parameters and optional parameters were keyword parameters. | ||
|
||
**Before:** | ||
```py | ||
def create_dashboard( | ||
self, | ||
parent, | ||
dashboard, | ||
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_dashboard( | ||
self, | ||
request: dashboards_service.CreateDashboardRequest = None, | ||
*, | ||
retry: retries.Retry = gapic_v1.method.DEFAULT, | ||
timeout: float = None, | ||
metadata: Sequence[Tuple[str, str]] = (), | ||
) -> dashboard.Dashboard: | ||
``` | ||
|
||
> **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_dashboard( | ||
request={ | ||
"parent": parent, | ||
"dashboard": dashboard, | ||
} | ||
) | ||
``` | ||
|
||
```py | ||
response = client.create_dashboard( | ||
parent=parent, | ||
dashboard=dashboard, | ||
) | ||
``` | ||
|
||
This call is invalid because it mixes `request` with a keyword argument `dashboard`. Executing this code will result in an error. | ||
|
||
```py | ||
response = client.create_dashboard( | ||
request={ | ||
"parent": parent, | ||
}, | ||
dashboard=dashboard | ||
) | ||
``` |
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 |
6 changes: 6 additions & 0 deletions
6
packages/google-cloud-monitoring-dashboards/docs/dashboard_v1/services.rst
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 Monitoring Dashboard v1 API | ||
=============================================== | ||
|
||
.. automodule:: google.cloud.monitoring_dashboard_v1.services.dashboards_service | ||
:members: | ||
:inherited-members: |
5 changes: 5 additions & 0 deletions
5
packages/google-cloud-monitoring-dashboards/docs/dashboard_v1/types.rst
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 Monitoring Dashboard v1 API | ||
============================================ | ||
|
||
.. automodule:: google.cloud.monitoring_dashboard_v1.types | ||
:members: |
6 changes: 0 additions & 6 deletions
6
packages/google-cloud-monitoring-dashboards/docs/gapic/v1/api.rst
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
packages/google-cloud-monitoring-dashboards/docs/gapic/v1/types.rst
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
24 changes: 0 additions & 24 deletions
24
packages/google-cloud-monitoring-dashboards/google/__init__.py
This file was deleted.
Oops, something went wrong.
24 changes: 0 additions & 24 deletions
24
packages/google-cloud-monitoring-dashboards/google/cloud/__init__.py
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,88 @@ | ||
# -*- 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.monitoring_dashboard_v1.services.dashboards_service.async_client import ( | ||
DashboardsServiceAsyncClient, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.services.dashboards_service.client import ( | ||
DashboardsServiceClient, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.common import Aggregation | ||
from google.cloud.monitoring_dashboard_v1.types.common import PickTimeSeriesFilter | ||
from google.cloud.monitoring_dashboard_v1.types.common import ( | ||
StatisticalTimeSeriesFilter, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboard import Dashboard | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
CreateDashboardRequest, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
DeleteDashboardRequest, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
GetDashboardRequest, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
ListDashboardsRequest, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
ListDashboardsResponse, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.dashboards_service import ( | ||
UpdateDashboardRequest, | ||
) | ||
from google.cloud.monitoring_dashboard_v1.types.layouts import ColumnLayout | ||
from google.cloud.monitoring_dashboard_v1.types.layouts import GridLayout | ||
from google.cloud.monitoring_dashboard_v1.types.layouts import RowLayout | ||
from google.cloud.monitoring_dashboard_v1.types.metrics import SparkChartType | ||
from google.cloud.monitoring_dashboard_v1.types.metrics import Threshold | ||
from google.cloud.monitoring_dashboard_v1.types.metrics import TimeSeriesFilter | ||
from google.cloud.monitoring_dashboard_v1.types.metrics import TimeSeriesFilterRatio | ||
from google.cloud.monitoring_dashboard_v1.types.metrics import TimeSeriesQuery | ||
from google.cloud.monitoring_dashboard_v1.types.scorecard import Scorecard | ||
from google.cloud.monitoring_dashboard_v1.types.text import Text | ||
from google.cloud.monitoring_dashboard_v1.types.widget import Widget | ||
from google.cloud.monitoring_dashboard_v1.types.xychart import ChartOptions | ||
from google.cloud.monitoring_dashboard_v1.types.xychart import XyChart | ||
|
||
__all__ = ( | ||
"Aggregation", | ||
"ChartOptions", | ||
"ColumnLayout", | ||
"CreateDashboardRequest", | ||
"Dashboard", | ||
"DashboardsServiceAsyncClient", | ||
"DashboardsServiceClient", | ||
"DeleteDashboardRequest", | ||
"GetDashboardRequest", | ||
"GridLayout", | ||
"ListDashboardsRequest", | ||
"ListDashboardsResponse", | ||
"PickTimeSeriesFilter", | ||
"RowLayout", | ||
"Scorecard", | ||
"SparkChartType", | ||
"StatisticalTimeSeriesFilter", | ||
"Text", | ||
"Threshold", | ||
"TimeSeriesFilter", | ||
"TimeSeriesFilterRatio", | ||
"TimeSeriesQuery", | ||
"UpdateDashboardRequest", | ||
"Widget", | ||
"XyChart", | ||
) |
2 changes: 2 additions & 0 deletions
2
packages/google-cloud-monitoring-dashboards/google/cloud/monitoring_dashboard/py.typed
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-monitoring-dashboard package uses inline types. |
29 changes: 0 additions & 29 deletions
29
packages/google-cloud-monitoring-dashboards/google/cloud/monitoring_dashboard/v1.py
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.