1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
|
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------
# Generated file, DO NOT EDIT
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------------------------
from msrest import Serializer, Deserializer
from ...client import Client
from . import models
class DashboardClient(Client):
"""Dashboard
:param str base_url: Service URL
:param Authentication creds: Authenticated credentials.
"""
def __init__(self, base_url=None, creds=None):
super(DashboardClient, self).__init__(base_url, creds)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
resource_area_identifier = '31c84e0a-3ece-48fd-a29d-100849af99ba'
def create_dashboard(self, dashboard, team_context):
"""CreateDashboard.
[Preview API] Create the supplied dashboard.
:param :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>` dashboard: The initial state of the dashboard
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:rtype: :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
content = self._serialize.body(dashboard, 'Dashboard')
response = self._send(http_method='POST',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('Dashboard', response)
def delete_dashboard(self, team_context, dashboard_id):
"""DeleteDashboard.
[Preview API] Delete a dashboard given its ID. This also deletes the widgets associated with this dashboard.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard to delete.
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
self._send(http_method='DELETE',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values)
def get_dashboard(self, team_context, dashboard_id):
"""GetDashboard.
[Preview API] Get a dashboard by its ID.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id:
:rtype: :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
response = self._send(http_method='GET',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values)
return self._deserialize('Dashboard', response)
def get_dashboards(self, team_context):
"""GetDashboards.
[Preview API] Get a list of dashboards.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:rtype: :class:`<DashboardGroup> <azure.devops.v5_0.dashboard.models.DashboardGroup>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
response = self._send(http_method='GET',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values)
return self._deserialize('DashboardGroup', response)
def replace_dashboard(self, dashboard, team_context, dashboard_id):
"""ReplaceDashboard.
[Preview API] Replace configuration for the specified dashboard. Replaces Widget list on Dashboard, only if property is supplied.
:param :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>` dashboard: The Configuration of the dashboard to replace.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard to replace.
:rtype: :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
content = self._serialize.body(dashboard, 'Dashboard')
response = self._send(http_method='PUT',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('Dashboard', response)
def replace_dashboards(self, group, team_context):
"""ReplaceDashboards.
[Preview API] Update the name and position of dashboards in the supplied group, and remove omitted dashboards. Does not modify dashboard content.
:param :class:`<DashboardGroup> <azure.devops.v5_0.dashboard.models.DashboardGroup>` group:
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:rtype: :class:`<DashboardGroup> <azure.devops.v5_0.dashboard.models.DashboardGroup>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
content = self._serialize.body(group, 'DashboardGroup')
response = self._send(http_method='PUT',
location_id='454b3e51-2e6e-48d4-ad81-978154089351',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('DashboardGroup', response)
def create_widget(self, widget, team_context, dashboard_id):
"""CreateWidget.
[Preview API] Create a widget on the specified dashboard.
:param :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>` widget: State of the widget to add
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of dashboard the widget will be added to.
:rtype: :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
content = self._serialize.body(widget, 'Widget')
response = self._send(http_method='POST',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('Widget', response)
def delete_widget(self, team_context, dashboard_id, widget_id):
"""DeleteWidget.
[Preview API] Delete the specified widget.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard containing the widget.
:param str widget_id: ID of the widget to update.
:rtype: :class:`<Dashboard> <azure.devops.v5_0.dashboard.models.Dashboard>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
if widget_id is not None:
route_values['widgetId'] = self._serialize.url('widget_id', widget_id, 'str')
response = self._send(http_method='DELETE',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values)
return self._deserialize('Dashboard', response)
def get_widget(self, team_context, dashboard_id, widget_id):
"""GetWidget.
[Preview API] Get the current state of the specified widget.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard containing the widget.
:param str widget_id: ID of the widget to read.
:rtype: :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
if widget_id is not None:
route_values['widgetId'] = self._serialize.url('widget_id', widget_id, 'str')
response = self._send(http_method='GET',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values)
return self._deserialize('Widget', response)
def get_widgets(self, team_context, dashboard_id, eTag=None):
"""GetWidgets.
[Preview API] Get widgets contained on the specified dashboard.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard to read.
:param String eTag: Dashboard Widgets Version
:rtype: :class:`<WidgetsVersionedList> <azure.devops.v5_0.dashboard.models.WidgetsVersionedList>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
additional_headers = {}
if eTag is not None:
additional_headers['ETag'] = eTag
response = self._send(http_method='GET',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
additional_headers=additional_headers)
response_object = models.WidgetsVersionedList()
response_object.widgets = self._deserialize('[Widget]', self._unwrap_collection(response))
response_object.eTag = response.headers.get('ETag')
return response_object
def replace_widget(self, widget, team_context, dashboard_id, widget_id):
"""ReplaceWidget.
[Preview API] Override the state of the specified widget.
:param :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>` widget: State to be written for the widget.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard containing the widget.
:param str widget_id: ID of the widget to update.
:rtype: :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
if widget_id is not None:
route_values['widgetId'] = self._serialize.url('widget_id', widget_id, 'str')
content = self._serialize.body(widget, 'Widget')
response = self._send(http_method='PUT',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('Widget', response)
def replace_widgets(self, widgets, team_context, dashboard_id, eTag=None):
"""ReplaceWidgets.
[Preview API] Replace the widgets on specified dashboard with the supplied widgets.
:param [Widget] widgets: Revised state of widgets to store for the dashboard.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the Dashboard to modify.
:param String eTag: Dashboard Widgets Version
:rtype: :class:`<WidgetsVersionedList> <azure.devops.v5_0.dashboard.models.WidgetsVersionedList>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
additional_headers = {}
if eTag is not None:
additional_headers['ETag'] = eTag
content = self._serialize.body(widgets, '[Widget]')
response = self._send(http_method='PUT',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
additional_headers=additional_headers,
content=content)
response_object = models.WidgetsVersionedList()
response_object.widgets = self._deserialize('[Widget]', self._unwrap_collection(response))
response_object.eTag = response.headers.get('ETag')
return response_object
def update_widget(self, widget, team_context, dashboard_id, widget_id):
"""UpdateWidget.
[Preview API] Perform a partial update of the specified widget.
:param :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>` widget: Description of the widget changes to apply. All non-null fields will be replaced.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the dashboard containing the widget.
:param str widget_id: ID of the widget to update.
:rtype: :class:`<Widget> <azure.devops.v5_0.dashboard.models.Widget>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
if widget_id is not None:
route_values['widgetId'] = self._serialize.url('widget_id', widget_id, 'str')
content = self._serialize.body(widget, 'Widget')
response = self._send(http_method='PATCH',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
content=content)
return self._deserialize('Widget', response)
def update_widgets(self, widgets, team_context, dashboard_id, eTag=None):
"""UpdateWidgets.
[Preview API] Update the supplied widgets on the dashboard using supplied state. State of existing Widgets not passed in the widget list is preserved.
:param [Widget] widgets: The set of widget states to update on the dashboard.
:param :class:`<TeamContext> <azure.devops.v5_0.dashboard.models.TeamContext>` team_context: The team context for the operation
:param str dashboard_id: ID of the Dashboard to modify.
:param String eTag: Dashboard Widgets Version
:rtype: :class:`<WidgetsVersionedList> <azure.devops.v5_0.dashboard.models.WidgetsVersionedList>`
"""
project = None
team = None
if team_context is not None:
if team_context.project_id:
project = team_context.project_id
else:
project = team_context.project
if team_context.team_id:
team = team_context.team_id
else:
team = team_context.team
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'string')
if team is not None:
route_values['team'] = self._serialize.url('team', team, 'string')
if dashboard_id is not None:
route_values['dashboardId'] = self._serialize.url('dashboard_id', dashboard_id, 'str')
additional_headers = {}
if eTag is not None:
additional_headers['ETag'] = eTag
content = self._serialize.body(widgets, '[Widget]')
response = self._send(http_method='PATCH',
location_id='bdcff53a-8355-4172-a00a-40497ea23afc',
version='5.0-preview.2',
route_values=route_values,
additional_headers=additional_headers,
content=content)
response_object = models.WidgetsVersionedList()
response_object.widgets = self._deserialize('[Widget]', self._unwrap_collection(response))
response_object.eTag = response.headers.get('ETag')
return response_object
def get_widget_metadata(self, contribution_id, project=None):
"""GetWidgetMetadata.
[Preview API] Get the widget metadata satisfying the specified contribution ID.
:param str contribution_id: The ID of Contribution for the Widget
:param str project: Project ID or project name
:rtype: :class:`<WidgetMetadataResponse> <azure.devops.v5_0.dashboard.models.WidgetMetadataResponse>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
if contribution_id is not None:
route_values['contributionId'] = self._serialize.url('contribution_id', contribution_id, 'str')
response = self._send(http_method='GET',
location_id='6b3628d3-e96f-4fc7-b176-50240b03b515',
version='5.0-preview.1',
route_values=route_values)
return self._deserialize('WidgetMetadataResponse', response)
def get_widget_types(self, scope, project=None):
"""GetWidgetTypes.
[Preview API] Get all available widget metadata in alphabetical order.
:param str scope:
:param str project: Project ID or project name
:rtype: :class:`<WidgetTypesResponse> <azure.devops.v5_0.dashboard.models.WidgetTypesResponse>`
"""
route_values = {}
if project is not None:
route_values['project'] = self._serialize.url('project', project, 'str')
query_parameters = {}
if scope is not None:
query_parameters['$scope'] = self._serialize.query('scope', scope, 'str')
response = self._send(http_method='GET',
location_id='6b3628d3-e96f-4fc7-b176-50240b03b515',
version='5.0-preview.1',
route_values=route_values,
query_parameters=query_parameters)
return self._deserialize('WidgetTypesResponse', response)
|