33
33
from google .cloud .monitoring_dashboard_v1 .types import dashboards_service
34
34
from google .cloud .monitoring_dashboard_v1 .types import layouts
35
35
36
- from .transports .base import DashboardsServiceTransport
36
+ from .transports .base import DashboardsServiceTransport , DEFAULT_CLIENT_INFO
37
37
from .transports .grpc_asyncio import DashboardsServiceGrpcAsyncIOTransport
38
38
from .client import DashboardsServiceClient
39
39
@@ -49,10 +49,49 @@ class DashboardsServiceAsyncClient:
49
49
DEFAULT_MTLS_ENDPOINT = DashboardsServiceClient .DEFAULT_MTLS_ENDPOINT
50
50
51
51
dashboard_path = staticmethod (DashboardsServiceClient .dashboard_path )
52
+ parse_dashboard_path = staticmethod (DashboardsServiceClient .parse_dashboard_path )
53
+
54
+ common_billing_account_path = staticmethod (
55
+ DashboardsServiceClient .common_billing_account_path
56
+ )
57
+ parse_common_billing_account_path = staticmethod (
58
+ DashboardsServiceClient .parse_common_billing_account_path
59
+ )
60
+
61
+ common_folder_path = staticmethod (DashboardsServiceClient .common_folder_path )
62
+ parse_common_folder_path = staticmethod (
63
+ DashboardsServiceClient .parse_common_folder_path
64
+ )
65
+
66
+ common_organization_path = staticmethod (
67
+ DashboardsServiceClient .common_organization_path
68
+ )
69
+ parse_common_organization_path = staticmethod (
70
+ DashboardsServiceClient .parse_common_organization_path
71
+ )
72
+
73
+ common_project_path = staticmethod (DashboardsServiceClient .common_project_path )
74
+ parse_common_project_path = staticmethod (
75
+ DashboardsServiceClient .parse_common_project_path
76
+ )
77
+
78
+ common_location_path = staticmethod (DashboardsServiceClient .common_location_path )
79
+ parse_common_location_path = staticmethod (
80
+ DashboardsServiceClient .parse_common_location_path
81
+ )
52
82
53
83
from_service_account_file = DashboardsServiceClient .from_service_account_file
54
84
from_service_account_json = from_service_account_file
55
85
86
+ @property
87
+ def transport (self ) -> DashboardsServiceTransport :
88
+ """Return the transport used by the client instance.
89
+
90
+ Returns:
91
+ DashboardsServiceTransport: The transport used by the client instance.
92
+ """
93
+ return self ._client .transport
94
+
56
95
get_transport_class = functools .partial (
57
96
type (DashboardsServiceClient ).get_transport_class , type (DashboardsServiceClient )
58
97
)
@@ -63,6 +102,7 @@ def __init__(
63
102
credentials : credentials .Credentials = None ,
64
103
transport : Union [str , DashboardsServiceTransport ] = "grpc_asyncio" ,
65
104
client_options : ClientOptions = None ,
105
+ client_info : gapic_v1 .client_info .ClientInfo = DEFAULT_CLIENT_INFO ,
66
106
) -> None :
67
107
"""Instantiate the dashboards service client.
68
108
@@ -78,24 +118,30 @@ def __init__(
78
118
client_options (ClientOptions): Custom options for the client. It
79
119
won't take effect if a ``transport`` instance is provided.
80
120
(1) The ``api_endpoint`` property can be used to override the
81
- default endpoint provided by the client. GOOGLE_API_USE_MTLS
121
+ default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT
82
122
environment variable can also be used to override the endpoint:
83
123
"always" (always use the default mTLS endpoint), "never" (always
84
- use the default regular endpoint, this is the default value for
85
- the environment variable) and "auto" (auto switch to the default
86
- mTLS endpoint if client SSL credentials is present). However,
87
- the ``api_endpoint`` property takes precedence if provided.
88
- (2) The ``client_cert_source`` property is used to provide client
89
- SSL credentials for mutual TLS transport. If not provided, the
90
- default SSL credentials will be used if present.
124
+ use the default regular endpoint) and "auto" (auto switch to the
125
+ default mTLS endpoint if client certificate is present, this is
126
+ the default value). However, the ``api_endpoint`` property takes
127
+ precedence if provided.
128
+ (2) If GOOGLE_API_USE_CLIENT_CERTIFICATE environment variable
129
+ is "true", then the ``client_cert_source`` property can be used
130
+ to provide client certificate for mutual TLS transport. If
131
+ not provided, the default SSL client certificate will be used if
132
+ present. If GOOGLE_API_USE_CLIENT_CERTIFICATE is "false" or not
133
+ set, no client certificate will be used.
91
134
92
135
Raises:
93
136
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
94
137
creation failed for any reason.
95
138
"""
96
139
97
140
self ._client = DashboardsServiceClient (
98
- credentials = credentials , transport = transport , client_options = client_options ,
141
+ credentials = credentials ,
142
+ transport = transport ,
143
+ client_options = client_options ,
144
+ client_info = client_info ,
99
145
)
100
146
101
147
async def create_dashboard (
@@ -139,7 +185,7 @@ async def create_dashboard(
139
185
rpc = gapic_v1 .method_async .wrap_method (
140
186
self ._client ._transport .create_dashboard ,
141
187
default_timeout = 30.0 ,
142
- client_info = _client_info ,
188
+ client_info = DEFAULT_CLIENT_INFO ,
143
189
)
144
190
145
191
# Certain fields should be provided within the metadata header;
@@ -195,7 +241,7 @@ async def list_dashboards(
195
241
rpc = gapic_v1 .method_async .wrap_method (
196
242
self ._client ._transport .list_dashboards ,
197
243
default_timeout = None ,
198
- client_info = _client_info ,
244
+ client_info = DEFAULT_CLIENT_INFO ,
199
245
)
200
246
201
247
# Certain fields should be provided within the metadata header;
@@ -257,7 +303,7 @@ async def get_dashboard(
257
303
rpc = gapic_v1 .method_async .wrap_method (
258
304
self ._client ._transport .get_dashboard ,
259
305
default_timeout = None ,
260
- client_info = _client_info ,
306
+ client_info = DEFAULT_CLIENT_INFO ,
261
307
)
262
308
263
309
# Certain fields should be provided within the metadata header;
@@ -305,7 +351,7 @@ async def delete_dashboard(
305
351
rpc = gapic_v1 .method_async .wrap_method (
306
352
self ._client ._transport .delete_dashboard ,
307
353
default_timeout = 30.0 ,
308
- client_info = _client_info ,
354
+ client_info = DEFAULT_CLIENT_INFO ,
309
355
)
310
356
311
357
# Certain fields should be provided within the metadata header;
@@ -360,7 +406,7 @@ async def update_dashboard(
360
406
rpc = gapic_v1 .method_async .wrap_method (
361
407
self ._client ._transport .update_dashboard ,
362
408
default_timeout = 30.0 ,
363
- client_info = _client_info ,
409
+ client_info = DEFAULT_CLIENT_INFO ,
364
410
)
365
411
366
412
# Certain fields should be provided within the metadata header;
@@ -379,13 +425,13 @@ async def update_dashboard(
379
425
380
426
381
427
try :
382
- _client_info = gapic_v1 .client_info .ClientInfo (
428
+ DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo (
383
429
gapic_version = pkg_resources .get_distribution (
384
430
"google-monitoring-dashboard" ,
385
431
).version ,
386
432
)
387
433
except pkg_resources .DistributionNotFound :
388
- _client_info = gapic_v1 .client_info .ClientInfo ()
434
+ DEFAULT_CLIENT_INFO = gapic_v1 .client_info .ClientInfo ()
389
435
390
436
391
437
__all__ = ("DashboardsServiceAsyncClient" ,)
0 commit comments