@@ -4095,6 +4095,7 @@ def create_dashboard(
40954095 description : str | None = None ,
40964096 filters : list [dict [str , Any ]] | str | None = None ,
40974097 charts : list [dict [str , Any ]] | str | None = None ,
4098+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
40984099 ) -> dict [str , Any ]:
40994100 """Create a new native dashboard.
41004101
@@ -4106,6 +4107,7 @@ def create_dashboard(
41064107 (JSON or JSON string)
41074108 charts: List of charts to include in the dashboard
41084109 (JSON or JSON string)
4110+ api_version: Preferred API version to use. Defaults to V1ALPHA
41094111
41104112 Returns:
41114113 Dictionary containing the created dashboard details
@@ -4125,73 +4127,102 @@ def create_dashboard(
41254127 description = description ,
41264128 filters = filters ,
41274129 charts = charts ,
4130+ api_version = api_version ,
41284131 )
41294132
4130- def import_dashboard (self , dashboard : dict [str , Any ]) -> dict [str , Any ]:
4133+ def import_dashboard (
4134+ self ,
4135+ dashboard : dict [str , Any ],
4136+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
4137+ ) -> dict [str , Any ]:
41314138 """Create a new native dashboard.
41324139
41334140 Args:
41344141 dashboard: ImportNativeDashboardsInlineSource
4142+ api_version: Preferred API version to use. Defaults to V1ALPHA
41354143
41364144 Returns:
41374145 Dictionary containing the created dashboard details
41384146
41394147 Raises:
41404148 APIError: If the API request fails
41414149 """
4150+ return _import_dashboard (
4151+ self , dashboard = dashboard , api_version = api_version
4152+ )
41424153
4143- return _import_dashboard (self , dashboard = dashboard )
4144-
4145- def export_dashboard (self , dashboard_names : list [str ]) -> dict [str , Any ]:
4154+ def export_dashboard (
4155+ self ,
4156+ dashboard_names : list [str ],
4157+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
4158+ ) -> dict [str , Any ]:
41464159 """Export native dashboards.
41474160 It supports single dashboard export operation only.
41484161
41494162 Args:
41504163 dashboard_names: List of dashboard resource names to export.
4164+ api_version: Preferred API version to use. Defaults to V1ALPHA
41514165
41524166 Returns:
41534167 Dictionary containing the exported dashboards.
41544168
41554169 Raises:
41564170 APIError: If the API request fails
41574171 """
4158-
4159- return _export_dashboard (self , dashboard_names = dashboard_names )
4172+ return _export_dashboard (
4173+ self , dashboard_names = dashboard_names , api_version = api_version
4174+ )
41604175
41614176 def list_dashboards (
41624177 self ,
41634178 page_size : int | None = None ,
41644179 page_token : str | None = None ,
4180+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
4181+ as_list : bool = False ,
41654182 ) -> dict [str , Any ]:
4166- """List all available dashboards.
4183+ """List all available dashboards in Basic View .
41674184
41684185 Args:
41694186 page_size: Maximum number of results to return
41704187 page_token: Token for pagination
4188+ api_version: Preferred API version to use. Defaults to V1ALPHA
4189+ as_list: Whether to return results as a list or dictionary
41714190
41724191 Returns:
4173- Dictionary containing dashboard list and pagination info
4192+ If as_list is True: List of dashboards.
4193+ If as_list is False: Dictionary containing list of dashboards
4194+ and pagination info.
4195+
4196+ Raises:
4197+ APIError: If the API request fails
41744198 """
41754199 return _list_dashboards (
41764200 self ,
41774201 page_size = page_size ,
41784202 page_token = page_token ,
4203+ api_version = api_version ,
4204+ as_list = as_list ,
41794205 )
41804206
41814207 def get_dashboard (
41824208 self ,
41834209 dashboard_id : str ,
41844210 view : str | None = None ,
4211+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
41854212 ) -> dict [str , Any ]:
41864213 """Get information about a specific dashboard.
41874214
41884215 Args:
41894216 dashboard_id: ID of the dashboard to retrieve
41904217 view: Level of detail to include in the response
41914218 Defaults to BASIC
4219+ api_version: Preferred API version to use. Defaults to V1ALPHA
41924220
41934221 Returns:
41944222 Dictionary containing dashboard details
4223+
4224+ Raises:
4225+ APIError: If the API request fails
41954226 """
41964227 if view :
41974228 try :
@@ -4203,6 +4234,7 @@ def get_dashboard(
42034234 self ,
42044235 dashboard_id = dashboard_id ,
42054236 view = view ,
4237+ api_version = api_version ,
42064238 )
42074239
42084240 def update_dashboard (
@@ -4212,6 +4244,7 @@ def update_dashboard(
42124244 description : str | None = None ,
42134245 filters : list [dict [str , Any ]] | str | None = None ,
42144246 charts : list [dict [str , Any ]] | str | None = None ,
4247+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
42154248 ) -> dict [str , Any ]:
42164249 """Update an existing dashboard.
42174250
@@ -4221,6 +4254,7 @@ def update_dashboard(
42214254 description: New description for the dashboard (optional)
42224255 filters: New filters for the dashboard (optional)
42234256 charts: New charts for the dashboard (optional)
4257+ api_version: Preferred API version to use. Defaults to V1ALPHA
42244258
42254259 Returns:
42264260 Dictionary containing the updated dashboard details
@@ -4232,15 +4266,29 @@ def update_dashboard(
42324266 description = description ,
42334267 filters = filters ,
42344268 charts = charts ,
4269+ api_version = api_version ,
42354270 )
42364271
4237- def delete_dashboard (self , dashboard_id : str ) -> dict [str , Any ]:
4272+ def delete_dashboard (
4273+ self ,
4274+ dashboard_id : str ,
4275+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
4276+ ) -> dict [str , Any ]:
42384277 """Delete an existing dashboard.
42394278
42404279 Args:
42414280 dashboard_id: ID of the dashboard to delete
4281+ api_version: Preferred API version to use. Defaults to V1ALPHA
4282+
4283+ Returns:
4284+ Empty dictionary if deletion is successful
4285+
4286+ Raises:
4287+ APIError: If the API request fails
42424288 """
4243- return _delete_dashboard (self , dashboard_id = dashboard_id )
4289+ return _delete_dashboard (
4290+ self , dashboard_id = dashboard_id , api_version = api_version
4291+ )
42444292
42454293 def add_chart (
42464294 self ,
@@ -4254,6 +4302,7 @@ def add_chart(
42544302 description : str | None = None ,
42554303 query : str | None = None ,
42564304 interval : InputInterval | dict [str , Any ] | str | None = None ,
4305+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
42574306 ** kwargs ,
42584307 ) -> dict [str , Any ]:
42594308 """Add a chart to an existing dashboard.
@@ -4272,6 +4321,7 @@ def add_chart(
42724321 description: Description for the chart
42734322 query: Query for the chart
42744323 interval: Query input interval for the chart
4324+ api_version: Preferred API version to use. Defaults to V1ALPHA
42754325 **kwargs: Additional keyword arguments
42764326 (Will be added to request payload)
42774327
@@ -4296,6 +4346,7 @@ def add_chart(
42964346 description = description ,
42974347 query = query ,
42984348 interval = interval ,
4349+ api_version = api_version ,
42994350 ** kwargs ,
43004351 )
43014352
@@ -4305,17 +4356,23 @@ def duplicate_dashboard(
43054356 display_name : str ,
43064357 access_type : str ,
43074358 description : str | None = None ,
4359+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
43084360 ) -> dict [str , Any ]:
43094361 """Duplicate an existing dashboard.
43104362
43114363 Args:
4312- dashboard_id: Id of the dashboard to duplicate
4313- display_name: Display name for the new dashboard
4314- access_type: Access type for the new dashboard (PRIVATE or PUBLIC)
4315- description: Description for the new dashboard
4364+ dashboard_id: ID of the dashboard to duplicate
4365+ display_name: New name for the duplicated dashboard
4366+ access_type: Access type for the duplicated dashboard
4367+ (DashboardAccessType.PRIVATE or DashboardAccessType.PUBLIC)
4368+ description: Description for the duplicated dashboard
4369+ api_version: Preferred API version to use. Defaults to V1ALPHA
43164370
43174371 Returns:
4318- Dictionary containing the updated dashboard details
4372+ Dictionary containing the duplicated dashboard details
4373+
4374+ Raises:
4375+ APIError: If the API request fails
43194376 """
43204377 try :
43214378 access_type = DashboardAccessType [access_type .upper ()]
@@ -4328,18 +4385,21 @@ def duplicate_dashboard(
43284385 display_name = display_name ,
43294386 access_type = access_type ,
43304387 description = description ,
4388+ api_version = api_version ,
43314389 )
43324390
43334391 def remove_chart (
43344392 self ,
43354393 dashboard_id : str ,
43364394 chart_id : str ,
4395+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
43374396 ) -> dict [str , Any ]:
43384397 """Remove a chart from a dashboard.
43394398
43404399 Args:
43414400 dashboard_id: ID of the dashboard containing the chart
43424401 chart_id: ID of the chart to remove
4402+ api_version: Preferred API version to use. Defaults to V1ALPHA
43434403
43444404 Returns:
43454405 Dictionary containing the updated dashboard
@@ -4351,24 +4411,34 @@ def remove_chart(
43514411 self ,
43524412 dashboard_id = dashboard_id ,
43534413 chart_id = chart_id ,
4414+ api_version = api_version ,
43544415 )
43554416
4356- def get_chart (self , chart_id : str ) -> dict [str , Any ]:
4357- """Get information about a specific chart.
4417+ def get_chart (
4418+ self ,
4419+ chart_id : str ,
4420+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
4421+ ) -> dict [str , Any ]:
4422+ """Get detail for dashboard chart.
43584423
43594424 Args:
4360- chart_id: ID of the chart to retrieve
4425+ chart_id: ID of the chart
4426+ api_version: Preferred API version to use. Defaults to V1ALPHA
43614427
43624428 Returns:
4363- Dictionary containing chart details
4429+ Dict[str, Any]: Dictionary containing chart details
4430+
4431+ Raises:
4432+ APIError: If the API request fails
43644433 """
4365- return _get_chart (self , chart_id )
4434+ return _get_chart (self , chart_id , api_version )
43664435
43674436 def edit_chart (
43684437 self ,
43694438 dashboard_id : str ,
43704439 dashboard_chart : None | (dict [str , Any ] | DashboardChart | str ) = None ,
43714440 dashboard_query : None | (dict [str , Any ] | DashboardQuery | str ) = None ,
4441+ api_version : APIVersion | None = APIVersion .V1ALPHA ,
43724442 ) -> dict [str , Any ]:
43734443 """Edit an existing chart in a dashboard.
43744444
@@ -4391,15 +4461,21 @@ def edit_chart(
43914461 "input": {},
43924462 "etag":"123131231321321"
43934463 }
4464+ api_version: Preferred API version to use. Defaults to V1ALPHA
4465+
43944466 Returns:
43954467 Dictionary containing the updated dashboard with edited chart
4468+
4469+ Raises:
4470+ APIError: If the API request fails
43964471 """
43974472
43984473 return _edit_chart (
43994474 self ,
44004475 dashboard_id = dashboard_id ,
44014476 dashboard_chart = dashboard_chart ,
44024477 dashboard_query = dashboard_query ,
4478+ api_version = api_version ,
44034479 )
44044480
44054481 def execute_dashboard_query (
0 commit comments