Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/azure/mgmt/dynatrace/operations/_monitors_operations.py: 14%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

722 statements  

1# pylint: disable=too-many-lines 

2# coding=utf-8 

3# -------------------------------------------------------------------------- 

4# Copyright (c) Microsoft Corporation. All rights reserved. 

5# Licensed under the MIT License. See License.txt in the project root for license information. 

6# Code generated by Microsoft (R) AutoRest Code Generator. 

7# Changes may cause incorrect behavior and will be lost if the code is regenerated. 

8# -------------------------------------------------------------------------- 

9from io import IOBase 

10from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload 

11import urllib.parse 

12 

13from azure.core.exceptions import ( 

14 ClientAuthenticationError, 

15 HttpResponseError, 

16 ResourceExistsError, 

17 ResourceNotFoundError, 

18 ResourceNotModifiedError, 

19 map_error, 

20) 

21from azure.core.paging import ItemPaged 

22from azure.core.pipeline import PipelineResponse 

23from azure.core.pipeline.transport import HttpResponse 

24from azure.core.polling import LROPoller, NoPolling, PollingMethod 

25from azure.core.rest import HttpRequest 

26from azure.core.tracing.decorator import distributed_trace 

27from azure.core.utils import case_insensitive_dict 

28from azure.mgmt.core.exceptions import ARMErrorFormat 

29from azure.mgmt.core.polling.arm_polling import ARMPolling 

30 

31from .. import models as _models 

32from .._serialization import Serializer 

33from .._vendor import _convert_request 

34 

35T = TypeVar("T") 

36ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] 

37 

38_SERIALIZER = Serializer() 

39_SERIALIZER.client_side_validation = False 

40 

41 

42def build_list_monitored_resources_request( 

43 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

44) -> HttpRequest: 

45 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

46 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

47 

48 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

49 accept = _headers.pop("Accept", "application/json") 

50 

51 # Construct URL 

52 _url = kwargs.pop( 

53 "template_url", 

54 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources", 

55 ) # pylint: disable=line-too-long 

56 path_format_arguments = { 

57 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

58 "resourceGroupName": _SERIALIZER.url( 

59 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

60 ), 

61 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

62 } 

63 

64 _url: str = _url.format(**path_format_arguments) # type: ignore 

65 

66 # Construct parameters 

67 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

68 

69 # Construct headers 

70 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

71 

72 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

73 

74 

75def build_get_vm_host_payload_request( 

76 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

77) -> HttpRequest: 

78 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

79 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

80 

81 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

82 accept = _headers.pop("Accept", "application/json") 

83 

84 # Construct URL 

85 _url = kwargs.pop( 

86 "template_url", 

87 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload", 

88 ) # pylint: disable=line-too-long 

89 path_format_arguments = { 

90 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

91 "resourceGroupName": _SERIALIZER.url( 

92 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

93 ), 

94 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

95 } 

96 

97 _url: str = _url.format(**path_format_arguments) # type: ignore 

98 

99 # Construct parameters 

100 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

101 

102 # Construct headers 

103 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

104 

105 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

106 

107 

108def build_get_request(resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: 

109 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

110 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

111 

112 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

113 accept = _headers.pop("Accept", "application/json") 

114 

115 # Construct URL 

116 _url = kwargs.pop( 

117 "template_url", 

118 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 

119 ) # pylint: disable=line-too-long 

120 path_format_arguments = { 

121 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

122 "resourceGroupName": _SERIALIZER.url( 

123 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

124 ), 

125 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

126 } 

127 

128 _url: str = _url.format(**path_format_arguments) # type: ignore 

129 

130 # Construct parameters 

131 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

132 

133 # Construct headers 

134 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

135 

136 return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) 

137 

138 

139def build_create_or_update_request( 

140 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

141) -> HttpRequest: 

142 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

143 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

144 

145 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

146 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

147 accept = _headers.pop("Accept", "application/json") 

148 

149 # Construct URL 

150 _url = kwargs.pop( 

151 "template_url", 

152 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 

153 ) # pylint: disable=line-too-long 

154 path_format_arguments = { 

155 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

156 "resourceGroupName": _SERIALIZER.url( 

157 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

158 ), 

159 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

160 } 

161 

162 _url: str = _url.format(**path_format_arguments) # type: ignore 

163 

164 # Construct parameters 

165 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

166 

167 # Construct headers 

168 if content_type is not None: 

169 _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") 

170 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

171 

172 return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) 

173 

174 

175def build_update_request( 

176 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

177) -> HttpRequest: 

178 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

179 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

180 

181 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

182 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

183 accept = _headers.pop("Accept", "application/json") 

184 

185 # Construct URL 

186 _url = kwargs.pop( 

187 "template_url", 

188 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 

189 ) # pylint: disable=line-too-long 

190 path_format_arguments = { 

191 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

192 "resourceGroupName": _SERIALIZER.url( 

193 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

194 ), 

195 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

196 } 

197 

198 _url: str = _url.format(**path_format_arguments) # type: ignore 

199 

200 # Construct parameters 

201 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

202 

203 # Construct headers 

204 if content_type is not None: 

205 _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") 

206 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

207 

208 return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) 

209 

210 

211def build_delete_request( 

212 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

213) -> HttpRequest: 

214 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

215 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

216 

217 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

218 accept = _headers.pop("Accept", "application/json") 

219 

220 # Construct URL 

221 _url = kwargs.pop( 

222 "template_url", 

223 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}", 

224 ) # pylint: disable=line-too-long 

225 path_format_arguments = { 

226 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

227 "resourceGroupName": _SERIALIZER.url( 

228 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

229 ), 

230 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

231 } 

232 

233 _url: str = _url.format(**path_format_arguments) # type: ignore 

234 

235 # Construct parameters 

236 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

237 

238 # Construct headers 

239 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

240 

241 return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) 

242 

243 

244def build_list_by_subscription_id_request(subscription_id: str, **kwargs: Any) -> HttpRequest: 

245 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

246 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

247 

248 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

249 accept = _headers.pop("Accept", "application/json") 

250 

251 # Construct URL 

252 _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors") 

253 path_format_arguments = { 

254 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

255 } 

256 

257 _url: str = _url.format(**path_format_arguments) # type: ignore 

258 

259 # Construct parameters 

260 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

261 

262 # Construct headers 

263 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

264 

265 return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) 

266 

267 

268def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: 

269 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

270 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

271 

272 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

273 accept = _headers.pop("Accept", "application/json") 

274 

275 # Construct URL 

276 _url = kwargs.pop( 

277 "template_url", 

278 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors", 

279 ) # pylint: disable=line-too-long 

280 path_format_arguments = { 

281 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

282 "resourceGroupName": _SERIALIZER.url( 

283 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

284 ), 

285 } 

286 

287 _url: str = _url.format(**path_format_arguments) # type: ignore 

288 

289 # Construct parameters 

290 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

291 

292 # Construct headers 

293 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

294 

295 return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) 

296 

297 

298def build_get_marketplace_saa_s_resource_details_request(subscription_id: str, **kwargs: Any) -> HttpRequest: 

299 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

300 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

301 

302 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

303 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

304 accept = _headers.pop("Accept", "application/json") 

305 

306 # Construct URL 

307 _url = kwargs.pop( 

308 "template_url", 

309 "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/getMarketplaceSaaSResourceDetails", 

310 ) # pylint: disable=line-too-long 

311 path_format_arguments = { 

312 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

313 } 

314 

315 _url: str = _url.format(**path_format_arguments) # type: ignore 

316 

317 # Construct parameters 

318 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

319 

320 # Construct headers 

321 if content_type is not None: 

322 _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") 

323 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

324 

325 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

326 

327 

328def build_list_hosts_request( 

329 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

330) -> HttpRequest: 

331 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

332 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

333 

334 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

335 accept = _headers.pop("Accept", "application/json") 

336 

337 # Construct URL 

338 _url = kwargs.pop( 

339 "template_url", 

340 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts", 

341 ) # pylint: disable=line-too-long 

342 path_format_arguments = { 

343 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

344 "resourceGroupName": _SERIALIZER.url( 

345 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

346 ), 

347 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

348 } 

349 

350 _url: str = _url.format(**path_format_arguments) # type: ignore 

351 

352 # Construct parameters 

353 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

354 

355 # Construct headers 

356 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

357 

358 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

359 

360 

361def build_get_metric_status_request( 

362 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

363) -> HttpRequest: 

364 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

365 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

366 

367 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

368 accept = _headers.pop("Accept", "application/json") 

369 

370 # Construct URL 

371 _url = kwargs.pop( 

372 "template_url", 

373 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getMetricStatus", 

374 ) # pylint: disable=line-too-long 

375 path_format_arguments = { 

376 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

377 "resourceGroupName": _SERIALIZER.url( 

378 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

379 ), 

380 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

381 } 

382 

383 _url: str = _url.format(**path_format_arguments) # type: ignore 

384 

385 # Construct parameters 

386 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

387 

388 # Construct headers 

389 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

390 

391 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

392 

393 

394def build_list_app_services_request( 

395 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

396) -> HttpRequest: 

397 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

398 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

399 

400 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

401 accept = _headers.pop("Accept", "application/json") 

402 

403 # Construct URL 

404 _url = kwargs.pop( 

405 "template_url", 

406 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices", 

407 ) # pylint: disable=line-too-long 

408 path_format_arguments = { 

409 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

410 "resourceGroupName": _SERIALIZER.url( 

411 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

412 ), 

413 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

414 } 

415 

416 _url: str = _url.format(**path_format_arguments) # type: ignore 

417 

418 # Construct parameters 

419 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

420 

421 # Construct headers 

422 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

423 

424 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

425 

426 

427def build_get_sso_details_request( 

428 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

429) -> HttpRequest: 

430 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

431 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

432 

433 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

434 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

435 accept = _headers.pop("Accept", "application/json") 

436 

437 # Construct URL 

438 _url = kwargs.pop( 

439 "template_url", 

440 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails", 

441 ) # pylint: disable=line-too-long 

442 path_format_arguments = { 

443 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

444 "resourceGroupName": _SERIALIZER.url( 

445 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

446 ), 

447 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

448 } 

449 

450 _url: str = _url.format(**path_format_arguments) # type: ignore 

451 

452 # Construct parameters 

453 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

454 

455 # Construct headers 

456 if content_type is not None: 

457 _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") 

458 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

459 

460 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

461 

462 

463def build_list_linkable_environments_request( 

464 resource_group_name: str, monitor_name: str, subscription_id: str, **kwargs: Any 

465) -> HttpRequest: 

466 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

467 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

468 

469 api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-04-27")) 

470 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

471 accept = _headers.pop("Accept", "application/json") 

472 

473 # Construct URL 

474 _url = kwargs.pop( 

475 "template_url", 

476 "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments", 

477 ) # pylint: disable=line-too-long 

478 path_format_arguments = { 

479 "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), 

480 "resourceGroupName": _SERIALIZER.url( 

481 "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 

482 ), 

483 "monitorName": _SERIALIZER.url("monitor_name", monitor_name, "str"), 

484 } 

485 

486 _url: str = _url.format(**path_format_arguments) # type: ignore 

487 

488 # Construct parameters 

489 _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") 

490 

491 # Construct headers 

492 if content_type is not None: 

493 _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") 

494 _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") 

495 

496 return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) 

497 

498 

499class MonitorsOperations: 

500 """ 

501 .. warning:: 

502 **DO NOT** instantiate this class directly. 

503 

504 Instead, you should access the following operations through 

505 :class:`~azure.mgmt.dynatrace.DynatraceObservabilityMgmtClient`'s 

506 :attr:`monitors` attribute. 

507 """ 

508 

509 models = _models 

510 

511 def __init__(self, *args, **kwargs): 

512 input_args = list(args) 

513 self._client = input_args.pop(0) if input_args else kwargs.pop("client") 

514 self._config = input_args.pop(0) if input_args else kwargs.pop("config") 

515 self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") 

516 self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") 

517 

518 @distributed_trace 

519 def list_monitored_resources( 

520 self, resource_group_name: str, monitor_name: str, **kwargs: Any 

521 ) -> Iterable["_models.MonitoredResource"]: 

522 """List the resources currently being monitored by the Dynatrace monitor resource. 

523 

524 List the resources currently being monitored by the Dynatrace monitor resource. 

525 

526 :param resource_group_name: The name of the resource group. The name is case insensitive. 

527 Required. 

528 :type resource_group_name: str 

529 :param monitor_name: Monitor resource name. Required. 

530 :type monitor_name: str 

531 :keyword callable cls: A custom type or function that will be passed the direct response 

532 :return: An iterator like instance of either MonitoredResource or the result of cls(response) 

533 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitoredResource] 

534 :raises ~azure.core.exceptions.HttpResponseError: 

535 """ 

536 _headers = kwargs.pop("headers", {}) or {} 

537 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

538 

539 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

540 cls: ClsType[_models.MonitoredResourceListResponse] = kwargs.pop("cls", None) 

541 

542 error_map = { 

543 401: ClientAuthenticationError, 

544 404: ResourceNotFoundError, 

545 409: ResourceExistsError, 

546 304: ResourceNotModifiedError, 

547 } 

548 error_map.update(kwargs.pop("error_map", {}) or {}) 

549 

550 def prepare_request(next_link=None): 

551 if not next_link: 

552 

553 request = build_list_monitored_resources_request( 

554 resource_group_name=resource_group_name, 

555 monitor_name=monitor_name, 

556 subscription_id=self._config.subscription_id, 

557 api_version=api_version, 

558 template_url=self.list_monitored_resources.metadata["url"], 

559 headers=_headers, 

560 params=_params, 

561 ) 

562 request = _convert_request(request) 

563 request.url = self._client.format_url(request.url) 

564 

565 else: 

566 # make call to next link with the client's api-version 

567 _parsed_next_link = urllib.parse.urlparse(next_link) 

568 _next_request_params = case_insensitive_dict( 

569 { 

570 key: [urllib.parse.quote(v) for v in value] 

571 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

572 } 

573 ) 

574 _next_request_params["api-version"] = self._config.api_version 

575 request = HttpRequest( 

576 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

577 ) 

578 request = _convert_request(request) 

579 request.url = self._client.format_url(request.url) 

580 request.method = "GET" 

581 return request 

582 

583 def extract_data(pipeline_response): 

584 deserialized = self._deserialize("MonitoredResourceListResponse", pipeline_response) 

585 list_of_elem = deserialized.value 

586 if cls: 

587 list_of_elem = cls(list_of_elem) # type: ignore 

588 return deserialized.next_link or None, iter(list_of_elem) 

589 

590 def get_next(next_link=None): 

591 request = prepare_request(next_link) 

592 

593 _stream = False 

594 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

595 request, stream=_stream, **kwargs 

596 ) 

597 response = pipeline_response.http_response 

598 

599 if response.status_code not in [200]: 

600 map_error(status_code=response.status_code, response=response, error_map=error_map) 

601 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

602 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

603 

604 return pipeline_response 

605 

606 return ItemPaged(get_next, extract_data) 

607 

608 list_monitored_resources.metadata = { 

609 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listMonitoredResources" 

610 } 

611 

612 @distributed_trace 

613 def get_vm_host_payload( 

614 self, resource_group_name: str, monitor_name: str, **kwargs: Any 

615 ) -> _models.VMExtensionPayload: 

616 """Returns the payload that needs to be passed in the request body for installing Dynatrace agent 

617 on a VM. 

618 

619 Returns the payload that needs to be passed in the request body for installing Dynatrace agent 

620 on a VM. 

621 

622 :param resource_group_name: The name of the resource group. The name is case insensitive. 

623 Required. 

624 :type resource_group_name: str 

625 :param monitor_name: Monitor resource name. Required. 

626 :type monitor_name: str 

627 :keyword callable cls: A custom type or function that will be passed the direct response 

628 :return: VMExtensionPayload or the result of cls(response) 

629 :rtype: ~azure.mgmt.dynatrace.models.VMExtensionPayload 

630 :raises ~azure.core.exceptions.HttpResponseError: 

631 """ 

632 error_map = { 

633 401: ClientAuthenticationError, 

634 404: ResourceNotFoundError, 

635 409: ResourceExistsError, 

636 304: ResourceNotModifiedError, 

637 } 

638 error_map.update(kwargs.pop("error_map", {}) or {}) 

639 

640 _headers = kwargs.pop("headers", {}) or {} 

641 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

642 

643 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

644 cls: ClsType[_models.VMExtensionPayload] = kwargs.pop("cls", None) 

645 

646 request = build_get_vm_host_payload_request( 

647 resource_group_name=resource_group_name, 

648 monitor_name=monitor_name, 

649 subscription_id=self._config.subscription_id, 

650 api_version=api_version, 

651 template_url=self.get_vm_host_payload.metadata["url"], 

652 headers=_headers, 

653 params=_params, 

654 ) 

655 request = _convert_request(request) 

656 request.url = self._client.format_url(request.url) 

657 

658 _stream = False 

659 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

660 request, stream=_stream, **kwargs 

661 ) 

662 

663 response = pipeline_response.http_response 

664 

665 if response.status_code not in [200]: 

666 map_error(status_code=response.status_code, response=response, error_map=error_map) 

667 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

668 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

669 

670 deserialized = self._deserialize("VMExtensionPayload", pipeline_response) 

671 

672 if cls: 

673 return cls(pipeline_response, deserialized, {}) 

674 

675 return deserialized 

676 

677 get_vm_host_payload.metadata = { 

678 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getVMHostPayload" 

679 } 

680 

681 @distributed_trace 

682 def get(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> _models.MonitorResource: 

683 """Get a MonitorResource. 

684 

685 Get a MonitorResource. 

686 

687 :param resource_group_name: The name of the resource group. The name is case insensitive. 

688 Required. 

689 :type resource_group_name: str 

690 :param monitor_name: Monitor resource name. Required. 

691 :type monitor_name: str 

692 :keyword callable cls: A custom type or function that will be passed the direct response 

693 :return: MonitorResource or the result of cls(response) 

694 :rtype: ~azure.mgmt.dynatrace.models.MonitorResource 

695 :raises ~azure.core.exceptions.HttpResponseError: 

696 """ 

697 error_map = { 

698 401: ClientAuthenticationError, 

699 404: ResourceNotFoundError, 

700 409: ResourceExistsError, 

701 304: ResourceNotModifiedError, 

702 } 

703 error_map.update(kwargs.pop("error_map", {}) or {}) 

704 

705 _headers = kwargs.pop("headers", {}) or {} 

706 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

707 

708 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

709 cls: ClsType[_models.MonitorResource] = kwargs.pop("cls", None) 

710 

711 request = build_get_request( 

712 resource_group_name=resource_group_name, 

713 monitor_name=monitor_name, 

714 subscription_id=self._config.subscription_id, 

715 api_version=api_version, 

716 template_url=self.get.metadata["url"], 

717 headers=_headers, 

718 params=_params, 

719 ) 

720 request = _convert_request(request) 

721 request.url = self._client.format_url(request.url) 

722 

723 _stream = False 

724 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

725 request, stream=_stream, **kwargs 

726 ) 

727 

728 response = pipeline_response.http_response 

729 

730 if response.status_code not in [200]: 

731 map_error(status_code=response.status_code, response=response, error_map=error_map) 

732 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

733 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

734 

735 deserialized = self._deserialize("MonitorResource", pipeline_response) 

736 

737 if cls: 

738 return cls(pipeline_response, deserialized, {}) 

739 

740 return deserialized 

741 

742 get.metadata = { 

743 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

744 } 

745 

746 def _create_or_update_initial( 

747 self, resource_group_name: str, monitor_name: str, resource: Union[_models.MonitorResource, IO], **kwargs: Any 

748 ) -> _models.MonitorResource: 

749 error_map = { 

750 401: ClientAuthenticationError, 

751 404: ResourceNotFoundError, 

752 409: ResourceExistsError, 

753 304: ResourceNotModifiedError, 

754 } 

755 error_map.update(kwargs.pop("error_map", {}) or {}) 

756 

757 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

758 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

759 

760 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

761 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

762 cls: ClsType[_models.MonitorResource] = kwargs.pop("cls", None) 

763 

764 content_type = content_type or "application/json" 

765 _json = None 

766 _content = None 

767 if isinstance(resource, (IOBase, bytes)): 

768 _content = resource 

769 else: 

770 _json = self._serialize.body(resource, "MonitorResource") 

771 

772 request = build_create_or_update_request( 

773 resource_group_name=resource_group_name, 

774 monitor_name=monitor_name, 

775 subscription_id=self._config.subscription_id, 

776 api_version=api_version, 

777 content_type=content_type, 

778 json=_json, 

779 content=_content, 

780 template_url=self._create_or_update_initial.metadata["url"], 

781 headers=_headers, 

782 params=_params, 

783 ) 

784 request = _convert_request(request) 

785 request.url = self._client.format_url(request.url) 

786 

787 _stream = False 

788 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

789 request, stream=_stream, **kwargs 

790 ) 

791 

792 response = pipeline_response.http_response 

793 

794 if response.status_code not in [200, 201]: 

795 map_error(status_code=response.status_code, response=response, error_map=error_map) 

796 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

797 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

798 

799 if response.status_code == 200: 

800 deserialized = self._deserialize("MonitorResource", pipeline_response) 

801 

802 if response.status_code == 201: 

803 deserialized = self._deserialize("MonitorResource", pipeline_response) 

804 

805 if cls: 

806 return cls(pipeline_response, deserialized, {}) # type: ignore 

807 

808 return deserialized # type: ignore 

809 

810 _create_or_update_initial.metadata = { 

811 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

812 } 

813 

814 @overload 

815 def begin_create_or_update( 

816 self, 

817 resource_group_name: str, 

818 monitor_name: str, 

819 resource: _models.MonitorResource, 

820 *, 

821 content_type: str = "application/json", 

822 **kwargs: Any 

823 ) -> LROPoller[_models.MonitorResource]: 

824 """Create a MonitorResource. 

825 

826 Create a MonitorResource. 

827 

828 :param resource_group_name: The name of the resource group. The name is case insensitive. 

829 Required. 

830 :type resource_group_name: str 

831 :param monitor_name: Monitor resource name. Required. 

832 :type monitor_name: str 

833 :param resource: Resource create parameters. Required. 

834 :type resource: ~azure.mgmt.dynatrace.models.MonitorResource 

835 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. 

836 Default value is "application/json". 

837 :paramtype content_type: str 

838 :keyword callable cls: A custom type or function that will be passed the direct response 

839 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 

840 :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this 

841 operation to not poll, or pass in your own initialized polling object for a personal polling 

842 strategy. 

843 :paramtype polling: bool or ~azure.core.polling.PollingMethod 

844 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no 

845 Retry-After header is present. 

846 :return: An instance of LROPoller that returns either MonitorResource or the result of 

847 cls(response) 

848 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.MonitorResource] 

849 :raises ~azure.core.exceptions.HttpResponseError: 

850 """ 

851 

852 @overload 

853 def begin_create_or_update( 

854 self, 

855 resource_group_name: str, 

856 monitor_name: str, 

857 resource: IO, 

858 *, 

859 content_type: str = "application/json", 

860 **kwargs: Any 

861 ) -> LROPoller[_models.MonitorResource]: 

862 """Create a MonitorResource. 

863 

864 Create a MonitorResource. 

865 

866 :param resource_group_name: The name of the resource group. The name is case insensitive. 

867 Required. 

868 :type resource_group_name: str 

869 :param monitor_name: Monitor resource name. Required. 

870 :type monitor_name: str 

871 :param resource: Resource create parameters. Required. 

872 :type resource: IO 

873 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. 

874 Default value is "application/json". 

875 :paramtype content_type: str 

876 :keyword callable cls: A custom type or function that will be passed the direct response 

877 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 

878 :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this 

879 operation to not poll, or pass in your own initialized polling object for a personal polling 

880 strategy. 

881 :paramtype polling: bool or ~azure.core.polling.PollingMethod 

882 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no 

883 Retry-After header is present. 

884 :return: An instance of LROPoller that returns either MonitorResource or the result of 

885 cls(response) 

886 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.MonitorResource] 

887 :raises ~azure.core.exceptions.HttpResponseError: 

888 """ 

889 

890 @distributed_trace 

891 def begin_create_or_update( 

892 self, resource_group_name: str, monitor_name: str, resource: Union[_models.MonitorResource, IO], **kwargs: Any 

893 ) -> LROPoller[_models.MonitorResource]: 

894 """Create a MonitorResource. 

895 

896 Create a MonitorResource. 

897 

898 :param resource_group_name: The name of the resource group. The name is case insensitive. 

899 Required. 

900 :type resource_group_name: str 

901 :param monitor_name: Monitor resource name. Required. 

902 :type monitor_name: str 

903 :param resource: Resource create parameters. Is either a MonitorResource type or a IO type. 

904 Required. 

905 :type resource: ~azure.mgmt.dynatrace.models.MonitorResource or IO 

906 :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. 

907 Default value is None. 

908 :paramtype content_type: str 

909 :keyword callable cls: A custom type or function that will be passed the direct response 

910 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 

911 :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this 

912 operation to not poll, or pass in your own initialized polling object for a personal polling 

913 strategy. 

914 :paramtype polling: bool or ~azure.core.polling.PollingMethod 

915 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no 

916 Retry-After header is present. 

917 :return: An instance of LROPoller that returns either MonitorResource or the result of 

918 cls(response) 

919 :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.dynatrace.models.MonitorResource] 

920 :raises ~azure.core.exceptions.HttpResponseError: 

921 """ 

922 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

923 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

924 

925 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

926 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

927 cls: ClsType[_models.MonitorResource] = kwargs.pop("cls", None) 

928 polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 

929 lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) 

930 cont_token: Optional[str] = kwargs.pop("continuation_token", None) 

931 if cont_token is None: 

932 raw_result = self._create_or_update_initial( 

933 resource_group_name=resource_group_name, 

934 monitor_name=monitor_name, 

935 resource=resource, 

936 api_version=api_version, 

937 content_type=content_type, 

938 cls=lambda x, y, z: x, 

939 headers=_headers, 

940 params=_params, 

941 **kwargs 

942 ) 

943 kwargs.pop("error_map", None) 

944 

945 def get_long_running_output(pipeline_response): 

946 deserialized = self._deserialize("MonitorResource", pipeline_response) 

947 if cls: 

948 return cls(pipeline_response, deserialized, {}) 

949 return deserialized 

950 

951 if polling is True: 

952 polling_method: PollingMethod = cast( 

953 PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) 

954 ) 

955 elif polling is False: 

956 polling_method = cast(PollingMethod, NoPolling()) 

957 else: 

958 polling_method = polling 

959 if cont_token: 

960 return LROPoller.from_continuation_token( 

961 polling_method=polling_method, 

962 continuation_token=cont_token, 

963 client=self._client, 

964 deserialization_callback=get_long_running_output, 

965 ) 

966 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore 

967 

968 begin_create_or_update.metadata = { 

969 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

970 } 

971 

972 @overload 

973 def update( 

974 self, 

975 resource_group_name: str, 

976 monitor_name: str, 

977 resource: _models.MonitorResourceUpdate, 

978 *, 

979 content_type: str = "application/json", 

980 **kwargs: Any 

981 ) -> _models.MonitorResource: 

982 """Update a MonitorResource. 

983 

984 Update a MonitorResource. 

985 

986 :param resource_group_name: The name of the resource group. The name is case insensitive. 

987 Required. 

988 :type resource_group_name: str 

989 :param monitor_name: Monitor resource name. Required. 

990 :type monitor_name: str 

991 :param resource: The resource properties to be updated. Required. 

992 :type resource: ~azure.mgmt.dynatrace.models.MonitorResourceUpdate 

993 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. 

994 Default value is "application/json". 

995 :paramtype content_type: str 

996 :keyword callable cls: A custom type or function that will be passed the direct response 

997 :return: MonitorResource or the result of cls(response) 

998 :rtype: ~azure.mgmt.dynatrace.models.MonitorResource 

999 :raises ~azure.core.exceptions.HttpResponseError: 

1000 """ 

1001 

1002 @overload 

1003 def update( 

1004 self, 

1005 resource_group_name: str, 

1006 monitor_name: str, 

1007 resource: IO, 

1008 *, 

1009 content_type: str = "application/json", 

1010 **kwargs: Any 

1011 ) -> _models.MonitorResource: 

1012 """Update a MonitorResource. 

1013 

1014 Update a MonitorResource. 

1015 

1016 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1017 Required. 

1018 :type resource_group_name: str 

1019 :param monitor_name: Monitor resource name. Required. 

1020 :type monitor_name: str 

1021 :param resource: The resource properties to be updated. Required. 

1022 :type resource: IO 

1023 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. 

1024 Default value is "application/json". 

1025 :paramtype content_type: str 

1026 :keyword callable cls: A custom type or function that will be passed the direct response 

1027 :return: MonitorResource or the result of cls(response) 

1028 :rtype: ~azure.mgmt.dynatrace.models.MonitorResource 

1029 :raises ~azure.core.exceptions.HttpResponseError: 

1030 """ 

1031 

1032 @distributed_trace 

1033 def update( 

1034 self, 

1035 resource_group_name: str, 

1036 monitor_name: str, 

1037 resource: Union[_models.MonitorResourceUpdate, IO], 

1038 **kwargs: Any 

1039 ) -> _models.MonitorResource: 

1040 """Update a MonitorResource. 

1041 

1042 Update a MonitorResource. 

1043 

1044 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1045 Required. 

1046 :type resource_group_name: str 

1047 :param monitor_name: Monitor resource name. Required. 

1048 :type monitor_name: str 

1049 :param resource: The resource properties to be updated. Is either a MonitorResourceUpdate type 

1050 or a IO type. Required. 

1051 :type resource: ~azure.mgmt.dynatrace.models.MonitorResourceUpdate or IO 

1052 :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. 

1053 Default value is None. 

1054 :paramtype content_type: str 

1055 :keyword callable cls: A custom type or function that will be passed the direct response 

1056 :return: MonitorResource or the result of cls(response) 

1057 :rtype: ~azure.mgmt.dynatrace.models.MonitorResource 

1058 :raises ~azure.core.exceptions.HttpResponseError: 

1059 """ 

1060 error_map = { 

1061 401: ClientAuthenticationError, 

1062 404: ResourceNotFoundError, 

1063 409: ResourceExistsError, 

1064 304: ResourceNotModifiedError, 

1065 } 

1066 error_map.update(kwargs.pop("error_map", {}) or {}) 

1067 

1068 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

1069 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1070 

1071 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1072 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

1073 cls: ClsType[_models.MonitorResource] = kwargs.pop("cls", None) 

1074 

1075 content_type = content_type or "application/json" 

1076 _json = None 

1077 _content = None 

1078 if isinstance(resource, (IOBase, bytes)): 

1079 _content = resource 

1080 else: 

1081 _json = self._serialize.body(resource, "MonitorResourceUpdate") 

1082 

1083 request = build_update_request( 

1084 resource_group_name=resource_group_name, 

1085 monitor_name=monitor_name, 

1086 subscription_id=self._config.subscription_id, 

1087 api_version=api_version, 

1088 content_type=content_type, 

1089 json=_json, 

1090 content=_content, 

1091 template_url=self.update.metadata["url"], 

1092 headers=_headers, 

1093 params=_params, 

1094 ) 

1095 request = _convert_request(request) 

1096 request.url = self._client.format_url(request.url) 

1097 

1098 _stream = False 

1099 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1100 request, stream=_stream, **kwargs 

1101 ) 

1102 

1103 response = pipeline_response.http_response 

1104 

1105 if response.status_code not in [200]: 

1106 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1107 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1108 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1109 

1110 deserialized = self._deserialize("MonitorResource", pipeline_response) 

1111 

1112 if cls: 

1113 return cls(pipeline_response, deserialized, {}) 

1114 

1115 return deserialized 

1116 

1117 update.metadata = { 

1118 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

1119 } 

1120 

1121 def _delete_initial( # pylint: disable=inconsistent-return-statements 

1122 self, resource_group_name: str, monitor_name: str, **kwargs: Any 

1123 ) -> None: 

1124 error_map = { 

1125 401: ClientAuthenticationError, 

1126 404: ResourceNotFoundError, 

1127 409: ResourceExistsError, 

1128 304: ResourceNotModifiedError, 

1129 } 

1130 error_map.update(kwargs.pop("error_map", {}) or {}) 

1131 

1132 _headers = kwargs.pop("headers", {}) or {} 

1133 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1134 

1135 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1136 cls: ClsType[None] = kwargs.pop("cls", None) 

1137 

1138 request = build_delete_request( 

1139 resource_group_name=resource_group_name, 

1140 monitor_name=monitor_name, 

1141 subscription_id=self._config.subscription_id, 

1142 api_version=api_version, 

1143 template_url=self._delete_initial.metadata["url"], 

1144 headers=_headers, 

1145 params=_params, 

1146 ) 

1147 request = _convert_request(request) 

1148 request.url = self._client.format_url(request.url) 

1149 

1150 _stream = False 

1151 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1152 request, stream=_stream, **kwargs 

1153 ) 

1154 

1155 response = pipeline_response.http_response 

1156 

1157 if response.status_code not in [200, 202, 204]: 

1158 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1159 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1160 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1161 

1162 if cls: 

1163 return cls(pipeline_response, None, {}) 

1164 

1165 _delete_initial.metadata = { 

1166 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

1167 } 

1168 

1169 @distributed_trace 

1170 def begin_delete(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> LROPoller[None]: 

1171 """Delete a MonitorResource. 

1172 

1173 Delete a MonitorResource. 

1174 

1175 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1176 Required. 

1177 :type resource_group_name: str 

1178 :param monitor_name: Monitor resource name. Required. 

1179 :type monitor_name: str 

1180 :keyword callable cls: A custom type or function that will be passed the direct response 

1181 :keyword str continuation_token: A continuation token to restart a poller from a saved state. 

1182 :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this 

1183 operation to not poll, or pass in your own initialized polling object for a personal polling 

1184 strategy. 

1185 :paramtype polling: bool or ~azure.core.polling.PollingMethod 

1186 :keyword int polling_interval: Default waiting time between two polls for LRO operations if no 

1187 Retry-After header is present. 

1188 :return: An instance of LROPoller that returns either None or the result of cls(response) 

1189 :rtype: ~azure.core.polling.LROPoller[None] 

1190 :raises ~azure.core.exceptions.HttpResponseError: 

1191 """ 

1192 _headers = kwargs.pop("headers", {}) or {} 

1193 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1194 

1195 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1196 cls: ClsType[None] = kwargs.pop("cls", None) 

1197 polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) 

1198 lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) 

1199 cont_token: Optional[str] = kwargs.pop("continuation_token", None) 

1200 if cont_token is None: 

1201 raw_result = self._delete_initial( # type: ignore 

1202 resource_group_name=resource_group_name, 

1203 monitor_name=monitor_name, 

1204 api_version=api_version, 

1205 cls=lambda x, y, z: x, 

1206 headers=_headers, 

1207 params=_params, 

1208 **kwargs 

1209 ) 

1210 kwargs.pop("error_map", None) 

1211 

1212 def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements 

1213 if cls: 

1214 return cls(pipeline_response, None, {}) 

1215 

1216 if polling is True: 

1217 polling_method: PollingMethod = cast( 

1218 PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) 

1219 ) 

1220 elif polling is False: 

1221 polling_method = cast(PollingMethod, NoPolling()) 

1222 else: 

1223 polling_method = polling 

1224 if cont_token: 

1225 return LROPoller.from_continuation_token( 

1226 polling_method=polling_method, 

1227 continuation_token=cont_token, 

1228 client=self._client, 

1229 deserialization_callback=get_long_running_output, 

1230 ) 

1231 return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore 

1232 

1233 begin_delete.metadata = { 

1234 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}" 

1235 } 

1236 

1237 @distributed_trace 

1238 def list_by_subscription_id(self, **kwargs: Any) -> Iterable["_models.MonitorResource"]: 

1239 """List all MonitorResource by subscriptionId. 

1240 

1241 List all MonitorResource by subscriptionId. 

1242 

1243 :keyword callable cls: A custom type or function that will be passed the direct response 

1244 :return: An iterator like instance of either MonitorResource or the result of cls(response) 

1245 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResource] 

1246 :raises ~azure.core.exceptions.HttpResponseError: 

1247 """ 

1248 _headers = kwargs.pop("headers", {}) or {} 

1249 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1250 

1251 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1252 cls: ClsType[_models.MonitorResourceListResult] = kwargs.pop("cls", None) 

1253 

1254 error_map = { 

1255 401: ClientAuthenticationError, 

1256 404: ResourceNotFoundError, 

1257 409: ResourceExistsError, 

1258 304: ResourceNotModifiedError, 

1259 } 

1260 error_map.update(kwargs.pop("error_map", {}) or {}) 

1261 

1262 def prepare_request(next_link=None): 

1263 if not next_link: 

1264 

1265 request = build_list_by_subscription_id_request( 

1266 subscription_id=self._config.subscription_id, 

1267 api_version=api_version, 

1268 template_url=self.list_by_subscription_id.metadata["url"], 

1269 headers=_headers, 

1270 params=_params, 

1271 ) 

1272 request = _convert_request(request) 

1273 request.url = self._client.format_url(request.url) 

1274 

1275 else: 

1276 # make call to next link with the client's api-version 

1277 _parsed_next_link = urllib.parse.urlparse(next_link) 

1278 _next_request_params = case_insensitive_dict( 

1279 { 

1280 key: [urllib.parse.quote(v) for v in value] 

1281 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

1282 } 

1283 ) 

1284 _next_request_params["api-version"] = self._config.api_version 

1285 request = HttpRequest( 

1286 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

1287 ) 

1288 request = _convert_request(request) 

1289 request.url = self._client.format_url(request.url) 

1290 request.method = "GET" 

1291 return request 

1292 

1293 def extract_data(pipeline_response): 

1294 deserialized = self._deserialize("MonitorResourceListResult", pipeline_response) 

1295 list_of_elem = deserialized.value 

1296 if cls: 

1297 list_of_elem = cls(list_of_elem) # type: ignore 

1298 return deserialized.next_link or None, iter(list_of_elem) 

1299 

1300 def get_next(next_link=None): 

1301 request = prepare_request(next_link) 

1302 

1303 _stream = False 

1304 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1305 request, stream=_stream, **kwargs 

1306 ) 

1307 response = pipeline_response.http_response 

1308 

1309 if response.status_code not in [200]: 

1310 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1311 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1312 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1313 

1314 return pipeline_response 

1315 

1316 return ItemPaged(get_next, extract_data) 

1317 

1318 list_by_subscription_id.metadata = { 

1319 "url": "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/monitors" 

1320 } 

1321 

1322 @distributed_trace 

1323 def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.MonitorResource"]: 

1324 """List MonitorResource resources by resource group. 

1325 

1326 List MonitorResource resources by resource group. 

1327 

1328 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1329 Required. 

1330 :type resource_group_name: str 

1331 :keyword callable cls: A custom type or function that will be passed the direct response 

1332 :return: An iterator like instance of either MonitorResource or the result of cls(response) 

1333 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.MonitorResource] 

1334 :raises ~azure.core.exceptions.HttpResponseError: 

1335 """ 

1336 _headers = kwargs.pop("headers", {}) or {} 

1337 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1338 

1339 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1340 cls: ClsType[_models.MonitorResourceListResult] = kwargs.pop("cls", None) 

1341 

1342 error_map = { 

1343 401: ClientAuthenticationError, 

1344 404: ResourceNotFoundError, 

1345 409: ResourceExistsError, 

1346 304: ResourceNotModifiedError, 

1347 } 

1348 error_map.update(kwargs.pop("error_map", {}) or {}) 

1349 

1350 def prepare_request(next_link=None): 

1351 if not next_link: 

1352 

1353 request = build_list_by_resource_group_request( 

1354 resource_group_name=resource_group_name, 

1355 subscription_id=self._config.subscription_id, 

1356 api_version=api_version, 

1357 template_url=self.list_by_resource_group.metadata["url"], 

1358 headers=_headers, 

1359 params=_params, 

1360 ) 

1361 request = _convert_request(request) 

1362 request.url = self._client.format_url(request.url) 

1363 

1364 else: 

1365 # make call to next link with the client's api-version 

1366 _parsed_next_link = urllib.parse.urlparse(next_link) 

1367 _next_request_params = case_insensitive_dict( 

1368 { 

1369 key: [urllib.parse.quote(v) for v in value] 

1370 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

1371 } 

1372 ) 

1373 _next_request_params["api-version"] = self._config.api_version 

1374 request = HttpRequest( 

1375 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

1376 ) 

1377 request = _convert_request(request) 

1378 request.url = self._client.format_url(request.url) 

1379 request.method = "GET" 

1380 return request 

1381 

1382 def extract_data(pipeline_response): 

1383 deserialized = self._deserialize("MonitorResourceListResult", pipeline_response) 

1384 list_of_elem = deserialized.value 

1385 if cls: 

1386 list_of_elem = cls(list_of_elem) # type: ignore 

1387 return deserialized.next_link or None, iter(list_of_elem) 

1388 

1389 def get_next(next_link=None): 

1390 request = prepare_request(next_link) 

1391 

1392 _stream = False 

1393 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1394 request, stream=_stream, **kwargs 

1395 ) 

1396 response = pipeline_response.http_response 

1397 

1398 if response.status_code not in [200]: 

1399 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1400 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1401 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1402 

1403 return pipeline_response 

1404 

1405 return ItemPaged(get_next, extract_data) 

1406 

1407 list_by_resource_group.metadata = { 

1408 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors" 

1409 } 

1410 

1411 @overload 

1412 def get_marketplace_saa_s_resource_details( 

1413 self, 

1414 request: _models.MarketplaceSaaSResourceDetailsRequest, 

1415 *, 

1416 content_type: str = "application/json", 

1417 **kwargs: Any 

1418 ) -> _models.MarketplaceSaaSResourceDetailsResponse: 

1419 """Get Marketplace SaaS resource details of a tenant under a specific subscription. 

1420 

1421 :param request: Tenant Id. Required. 

1422 :type request: ~azure.mgmt.dynatrace.models.MarketplaceSaaSResourceDetailsRequest 

1423 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. 

1424 Default value is "application/json". 

1425 :paramtype content_type: str 

1426 :keyword callable cls: A custom type or function that will be passed the direct response 

1427 :return: MarketplaceSaaSResourceDetailsResponse or the result of cls(response) 

1428 :rtype: ~azure.mgmt.dynatrace.models.MarketplaceSaaSResourceDetailsResponse 

1429 :raises ~azure.core.exceptions.HttpResponseError: 

1430 """ 

1431 

1432 @overload 

1433 def get_marketplace_saa_s_resource_details( 

1434 self, request: IO, *, content_type: str = "application/json", **kwargs: Any 

1435 ) -> _models.MarketplaceSaaSResourceDetailsResponse: 

1436 """Get Marketplace SaaS resource details of a tenant under a specific subscription. 

1437 

1438 :param request: Tenant Id. Required. 

1439 :type request: IO 

1440 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. 

1441 Default value is "application/json". 

1442 :paramtype content_type: str 

1443 :keyword callable cls: A custom type or function that will be passed the direct response 

1444 :return: MarketplaceSaaSResourceDetailsResponse or the result of cls(response) 

1445 :rtype: ~azure.mgmt.dynatrace.models.MarketplaceSaaSResourceDetailsResponse 

1446 :raises ~azure.core.exceptions.HttpResponseError: 

1447 """ 

1448 

1449 @distributed_trace 

1450 def get_marketplace_saa_s_resource_details( 

1451 self, request: Union[_models.MarketplaceSaaSResourceDetailsRequest, IO], **kwargs: Any 

1452 ) -> _models.MarketplaceSaaSResourceDetailsResponse: 

1453 """Get Marketplace SaaS resource details of a tenant under a specific subscription. 

1454 

1455 :param request: Tenant Id. Is either a MarketplaceSaaSResourceDetailsRequest type or a IO type. 

1456 Required. 

1457 :type request: ~azure.mgmt.dynatrace.models.MarketplaceSaaSResourceDetailsRequest or IO 

1458 :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. 

1459 Default value is None. 

1460 :paramtype content_type: str 

1461 :keyword callable cls: A custom type or function that will be passed the direct response 

1462 :return: MarketplaceSaaSResourceDetailsResponse or the result of cls(response) 

1463 :rtype: ~azure.mgmt.dynatrace.models.MarketplaceSaaSResourceDetailsResponse 

1464 :raises ~azure.core.exceptions.HttpResponseError: 

1465 """ 

1466 error_map = { 

1467 401: ClientAuthenticationError, 

1468 409: ResourceExistsError, 

1469 304: ResourceNotModifiedError, 

1470 404: lambda response: ResourceNotFoundError(response=response, error_format=ARMErrorFormat), 

1471 } 

1472 error_map.update(kwargs.pop("error_map", {}) or {}) 

1473 

1474 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

1475 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1476 

1477 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1478 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

1479 cls: ClsType[_models.MarketplaceSaaSResourceDetailsResponse] = kwargs.pop("cls", None) 

1480 

1481 content_type = content_type or "application/json" 

1482 _json = None 

1483 _content = None 

1484 if isinstance(request, (IOBase, bytes)): 

1485 _content = request 

1486 else: 

1487 _json = self._serialize.body(request, "MarketplaceSaaSResourceDetailsRequest") 

1488 

1489 request = build_get_marketplace_saa_s_resource_details_request( 

1490 subscription_id=self._config.subscription_id, 

1491 api_version=api_version, 

1492 content_type=content_type, 

1493 json=_json, 

1494 content=_content, 

1495 template_url=self.get_marketplace_saa_s_resource_details.metadata["url"], 

1496 headers=_headers, 

1497 params=_params, 

1498 ) 

1499 request = _convert_request(request) 

1500 request.url = self._client.format_url(request.url) 

1501 

1502 _stream = False 

1503 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1504 request, stream=_stream, **kwargs 

1505 ) 

1506 

1507 response = pipeline_response.http_response 

1508 

1509 if response.status_code not in [200]: 

1510 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1511 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1512 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1513 

1514 deserialized = self._deserialize("MarketplaceSaaSResourceDetailsResponse", pipeline_response) 

1515 

1516 if cls: 

1517 return cls(pipeline_response, deserialized, {}) 

1518 

1519 return deserialized 

1520 

1521 get_marketplace_saa_s_resource_details.metadata = { 

1522 "url": "/subscriptions/{subscriptionId}/providers/Dynatrace.Observability/getMarketplaceSaaSResourceDetails" 

1523 } 

1524 

1525 @distributed_trace 

1526 def list_hosts(self, resource_group_name: str, monitor_name: str, **kwargs: Any) -> Iterable["_models.VMInfo"]: 

1527 """List the VM/VMSS resources currently being monitored by the Dynatrace resource. 

1528 

1529 List the VM/VMSS resources currently being monitored by the Dynatrace resource. 

1530 

1531 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1532 Required. 

1533 :type resource_group_name: str 

1534 :param monitor_name: Monitor resource name. Required. 

1535 :type monitor_name: str 

1536 :keyword callable cls: A custom type or function that will be passed the direct response 

1537 :return: An iterator like instance of either VMInfo or the result of cls(response) 

1538 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.VMInfo] 

1539 :raises ~azure.core.exceptions.HttpResponseError: 

1540 """ 

1541 _headers = kwargs.pop("headers", {}) or {} 

1542 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1543 

1544 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1545 cls: ClsType[_models.VMHostsListResponse] = kwargs.pop("cls", None) 

1546 

1547 error_map = { 

1548 401: ClientAuthenticationError, 

1549 404: ResourceNotFoundError, 

1550 409: ResourceExistsError, 

1551 304: ResourceNotModifiedError, 

1552 } 

1553 error_map.update(kwargs.pop("error_map", {}) or {}) 

1554 

1555 def prepare_request(next_link=None): 

1556 if not next_link: 

1557 

1558 request = build_list_hosts_request( 

1559 resource_group_name=resource_group_name, 

1560 monitor_name=monitor_name, 

1561 subscription_id=self._config.subscription_id, 

1562 api_version=api_version, 

1563 template_url=self.list_hosts.metadata["url"], 

1564 headers=_headers, 

1565 params=_params, 

1566 ) 

1567 request = _convert_request(request) 

1568 request.url = self._client.format_url(request.url) 

1569 

1570 else: 

1571 # make call to next link with the client's api-version 

1572 _parsed_next_link = urllib.parse.urlparse(next_link) 

1573 _next_request_params = case_insensitive_dict( 

1574 { 

1575 key: [urllib.parse.quote(v) for v in value] 

1576 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

1577 } 

1578 ) 

1579 _next_request_params["api-version"] = self._config.api_version 

1580 request = HttpRequest( 

1581 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

1582 ) 

1583 request = _convert_request(request) 

1584 request.url = self._client.format_url(request.url) 

1585 request.method = "GET" 

1586 return request 

1587 

1588 def extract_data(pipeline_response): 

1589 deserialized = self._deserialize("VMHostsListResponse", pipeline_response) 

1590 list_of_elem = deserialized.value 

1591 if cls: 

1592 list_of_elem = cls(list_of_elem) # type: ignore 

1593 return deserialized.next_link or None, iter(list_of_elem) 

1594 

1595 def get_next(next_link=None): 

1596 request = prepare_request(next_link) 

1597 

1598 _stream = False 

1599 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1600 request, stream=_stream, **kwargs 

1601 ) 

1602 response = pipeline_response.http_response 

1603 

1604 if response.status_code not in [200]: 

1605 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1606 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1607 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1608 

1609 return pipeline_response 

1610 

1611 return ItemPaged(get_next, extract_data) 

1612 

1613 list_hosts.metadata = { 

1614 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listHosts" 

1615 } 

1616 

1617 @distributed_trace 

1618 def get_metric_status( 

1619 self, resource_group_name: str, monitor_name: str, **kwargs: Any 

1620 ) -> _models.MetricsStatusResponse: 

1621 """Get metric status. 

1622 

1623 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1624 Required. 

1625 :type resource_group_name: str 

1626 :param monitor_name: Name of the Monitor resource. Required. 

1627 :type monitor_name: str 

1628 :keyword callable cls: A custom type or function that will be passed the direct response 

1629 :return: MetricsStatusResponse or the result of cls(response) 

1630 :rtype: ~azure.mgmt.dynatrace.models.MetricsStatusResponse 

1631 :raises ~azure.core.exceptions.HttpResponseError: 

1632 """ 

1633 error_map = { 

1634 401: ClientAuthenticationError, 

1635 404: ResourceNotFoundError, 

1636 409: ResourceExistsError, 

1637 304: ResourceNotModifiedError, 

1638 } 

1639 error_map.update(kwargs.pop("error_map", {}) or {}) 

1640 

1641 _headers = kwargs.pop("headers", {}) or {} 

1642 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1643 

1644 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1645 cls: ClsType[_models.MetricsStatusResponse] = kwargs.pop("cls", None) 

1646 

1647 request = build_get_metric_status_request( 

1648 resource_group_name=resource_group_name, 

1649 monitor_name=monitor_name, 

1650 subscription_id=self._config.subscription_id, 

1651 api_version=api_version, 

1652 template_url=self.get_metric_status.metadata["url"], 

1653 headers=_headers, 

1654 params=_params, 

1655 ) 

1656 request = _convert_request(request) 

1657 request.url = self._client.format_url(request.url) 

1658 

1659 _stream = False 

1660 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1661 request, stream=_stream, **kwargs 

1662 ) 

1663 

1664 response = pipeline_response.http_response 

1665 

1666 if response.status_code not in [200]: 

1667 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1668 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1669 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1670 

1671 deserialized = self._deserialize("MetricsStatusResponse", pipeline_response) 

1672 

1673 if cls: 

1674 return cls(pipeline_response, deserialized, {}) 

1675 

1676 return deserialized 

1677 

1678 get_metric_status.metadata = { 

1679 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getMetricStatus" 

1680 } 

1681 

1682 @distributed_trace 

1683 def list_app_services( 

1684 self, resource_group_name: str, monitor_name: str, **kwargs: Any 

1685 ) -> Iterable["_models.AppServiceInfo"]: 

1686 """Gets list of App Services with Dynatrace PaaS OneAgent enabled. 

1687 

1688 Gets list of App Services with Dynatrace PaaS OneAgent enabled. 

1689 

1690 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1691 Required. 

1692 :type resource_group_name: str 

1693 :param monitor_name: Monitor resource name. Required. 

1694 :type monitor_name: str 

1695 :keyword callable cls: A custom type or function that will be passed the direct response 

1696 :return: An iterator like instance of either AppServiceInfo or the result of cls(response) 

1697 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.AppServiceInfo] 

1698 :raises ~azure.core.exceptions.HttpResponseError: 

1699 """ 

1700 _headers = kwargs.pop("headers", {}) or {} 

1701 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1702 

1703 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1704 cls: ClsType[_models.AppServiceListResponse] = kwargs.pop("cls", None) 

1705 

1706 error_map = { 

1707 401: ClientAuthenticationError, 

1708 404: ResourceNotFoundError, 

1709 409: ResourceExistsError, 

1710 304: ResourceNotModifiedError, 

1711 } 

1712 error_map.update(kwargs.pop("error_map", {}) or {}) 

1713 

1714 def prepare_request(next_link=None): 

1715 if not next_link: 

1716 

1717 request = build_list_app_services_request( 

1718 resource_group_name=resource_group_name, 

1719 monitor_name=monitor_name, 

1720 subscription_id=self._config.subscription_id, 

1721 api_version=api_version, 

1722 template_url=self.list_app_services.metadata["url"], 

1723 headers=_headers, 

1724 params=_params, 

1725 ) 

1726 request = _convert_request(request) 

1727 request.url = self._client.format_url(request.url) 

1728 

1729 else: 

1730 # make call to next link with the client's api-version 

1731 _parsed_next_link = urllib.parse.urlparse(next_link) 

1732 _next_request_params = case_insensitive_dict( 

1733 { 

1734 key: [urllib.parse.quote(v) for v in value] 

1735 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

1736 } 

1737 ) 

1738 _next_request_params["api-version"] = self._config.api_version 

1739 request = HttpRequest( 

1740 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

1741 ) 

1742 request = _convert_request(request) 

1743 request.url = self._client.format_url(request.url) 

1744 request.method = "GET" 

1745 return request 

1746 

1747 def extract_data(pipeline_response): 

1748 deserialized = self._deserialize("AppServiceListResponse", pipeline_response) 

1749 list_of_elem = deserialized.value 

1750 if cls: 

1751 list_of_elem = cls(list_of_elem) # type: ignore 

1752 return deserialized.next_link or None, iter(list_of_elem) 

1753 

1754 def get_next(next_link=None): 

1755 request = prepare_request(next_link) 

1756 

1757 _stream = False 

1758 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1759 request, stream=_stream, **kwargs 

1760 ) 

1761 response = pipeline_response.http_response 

1762 

1763 if response.status_code not in [200]: 

1764 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1765 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1766 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1767 

1768 return pipeline_response 

1769 

1770 return ItemPaged(get_next, extract_data) 

1771 

1772 list_app_services.metadata = { 

1773 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listAppServices" 

1774 } 

1775 

1776 @overload 

1777 def get_sso_details( 

1778 self, 

1779 resource_group_name: str, 

1780 monitor_name: str, 

1781 request: Optional[_models.SSODetailsRequest] = None, 

1782 *, 

1783 content_type: str = "application/json", 

1784 **kwargs: Any 

1785 ) -> _models.SSODetailsResponse: 

1786 """Gets the SSO configuration details from the partner. 

1787 

1788 Gets the SSO configuration details from the partner. 

1789 

1790 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1791 Required. 

1792 :type resource_group_name: str 

1793 :param monitor_name: Monitor resource name. Required. 

1794 :type monitor_name: str 

1795 :param request: The details of the get sso details request. Default value is None. 

1796 :type request: ~azure.mgmt.dynatrace.models.SSODetailsRequest 

1797 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. 

1798 Default value is "application/json". 

1799 :paramtype content_type: str 

1800 :keyword callable cls: A custom type or function that will be passed the direct response 

1801 :return: SSODetailsResponse or the result of cls(response) 

1802 :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse 

1803 :raises ~azure.core.exceptions.HttpResponseError: 

1804 """ 

1805 

1806 @overload 

1807 def get_sso_details( 

1808 self, 

1809 resource_group_name: str, 

1810 monitor_name: str, 

1811 request: Optional[IO] = None, 

1812 *, 

1813 content_type: str = "application/json", 

1814 **kwargs: Any 

1815 ) -> _models.SSODetailsResponse: 

1816 """Gets the SSO configuration details from the partner. 

1817 

1818 Gets the SSO configuration details from the partner. 

1819 

1820 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1821 Required. 

1822 :type resource_group_name: str 

1823 :param monitor_name: Monitor resource name. Required. 

1824 :type monitor_name: str 

1825 :param request: The details of the get sso details request. Default value is None. 

1826 :type request: IO 

1827 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. 

1828 Default value is "application/json". 

1829 :paramtype content_type: str 

1830 :keyword callable cls: A custom type or function that will be passed the direct response 

1831 :return: SSODetailsResponse or the result of cls(response) 

1832 :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse 

1833 :raises ~azure.core.exceptions.HttpResponseError: 

1834 """ 

1835 

1836 @distributed_trace 

1837 def get_sso_details( 

1838 self, 

1839 resource_group_name: str, 

1840 monitor_name: str, 

1841 request: Optional[Union[_models.SSODetailsRequest, IO]] = None, 

1842 **kwargs: Any 

1843 ) -> _models.SSODetailsResponse: 

1844 """Gets the SSO configuration details from the partner. 

1845 

1846 Gets the SSO configuration details from the partner. 

1847 

1848 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1849 Required. 

1850 :type resource_group_name: str 

1851 :param monitor_name: Monitor resource name. Required. 

1852 :type monitor_name: str 

1853 :param request: The details of the get sso details request. Is either a SSODetailsRequest type 

1854 or a IO type. Default value is None. 

1855 :type request: ~azure.mgmt.dynatrace.models.SSODetailsRequest or IO 

1856 :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. 

1857 Default value is None. 

1858 :paramtype content_type: str 

1859 :keyword callable cls: A custom type or function that will be passed the direct response 

1860 :return: SSODetailsResponse or the result of cls(response) 

1861 :rtype: ~azure.mgmt.dynatrace.models.SSODetailsResponse 

1862 :raises ~azure.core.exceptions.HttpResponseError: 

1863 """ 

1864 error_map = { 

1865 404: ResourceNotFoundError, 

1866 409: ResourceExistsError, 

1867 304: ResourceNotModifiedError, 

1868 401: lambda response: ClientAuthenticationError(response=response, error_format=ARMErrorFormat), 

1869 } 

1870 error_map.update(kwargs.pop("error_map", {}) or {}) 

1871 

1872 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

1873 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

1874 

1875 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

1876 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

1877 cls: ClsType[_models.SSODetailsResponse] = kwargs.pop("cls", None) 

1878 

1879 content_type = content_type or "application/json" 

1880 _json = None 

1881 _content = None 

1882 if isinstance(request, (IOBase, bytes)): 

1883 _content = request 

1884 else: 

1885 if request is not None: 

1886 _json = self._serialize.body(request, "SSODetailsRequest") 

1887 else: 

1888 _json = None 

1889 

1890 request = build_get_sso_details_request( 

1891 resource_group_name=resource_group_name, 

1892 monitor_name=monitor_name, 

1893 subscription_id=self._config.subscription_id, 

1894 api_version=api_version, 

1895 content_type=content_type, 

1896 json=_json, 

1897 content=_content, 

1898 template_url=self.get_sso_details.metadata["url"], 

1899 headers=_headers, 

1900 params=_params, 

1901 ) 

1902 request = _convert_request(request) 

1903 request.url = self._client.format_url(request.url) 

1904 

1905 _stream = False 

1906 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

1907 request, stream=_stream, **kwargs 

1908 ) 

1909 

1910 response = pipeline_response.http_response 

1911 

1912 if response.status_code not in [200]: 

1913 map_error(status_code=response.status_code, response=response, error_map=error_map) 

1914 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

1915 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

1916 

1917 deserialized = self._deserialize("SSODetailsResponse", pipeline_response) 

1918 

1919 if cls: 

1920 return cls(pipeline_response, deserialized, {}) 

1921 

1922 return deserialized 

1923 

1924 get_sso_details.metadata = { 

1925 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/getSSODetails" 

1926 } 

1927 

1928 @overload 

1929 def list_linkable_environments( 

1930 self, 

1931 resource_group_name: str, 

1932 monitor_name: str, 

1933 request: _models.LinkableEnvironmentRequest, 

1934 *, 

1935 content_type: str = "application/json", 

1936 **kwargs: Any 

1937 ) -> Iterable["_models.LinkableEnvironmentResponse"]: 

1938 """Gets all the Dynatrace environments that a user can link a azure resource to. 

1939 

1940 Gets all the Dynatrace environments that a user can link a azure resource to. 

1941 

1942 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1943 Required. 

1944 :type resource_group_name: str 

1945 :param monitor_name: Monitor resource name. Required. 

1946 :type monitor_name: str 

1947 :param request: The details of the linkable environment request. Required. 

1948 :type request: ~azure.mgmt.dynatrace.models.LinkableEnvironmentRequest 

1949 :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. 

1950 Default value is "application/json". 

1951 :paramtype content_type: str 

1952 :keyword callable cls: A custom type or function that will be passed the direct response 

1953 :return: An iterator like instance of either LinkableEnvironmentResponse or the result of 

1954 cls(response) 

1955 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentResponse] 

1956 :raises ~azure.core.exceptions.HttpResponseError: 

1957 """ 

1958 

1959 @overload 

1960 def list_linkable_environments( 

1961 self, 

1962 resource_group_name: str, 

1963 monitor_name: str, 

1964 request: IO, 

1965 *, 

1966 content_type: str = "application/json", 

1967 **kwargs: Any 

1968 ) -> Iterable["_models.LinkableEnvironmentResponse"]: 

1969 """Gets all the Dynatrace environments that a user can link a azure resource to. 

1970 

1971 Gets all the Dynatrace environments that a user can link a azure resource to. 

1972 

1973 :param resource_group_name: The name of the resource group. The name is case insensitive. 

1974 Required. 

1975 :type resource_group_name: str 

1976 :param monitor_name: Monitor resource name. Required. 

1977 :type monitor_name: str 

1978 :param request: The details of the linkable environment request. Required. 

1979 :type request: IO 

1980 :keyword content_type: Body Parameter content-type. Content type parameter for binary body. 

1981 Default value is "application/json". 

1982 :paramtype content_type: str 

1983 :keyword callable cls: A custom type or function that will be passed the direct response 

1984 :return: An iterator like instance of either LinkableEnvironmentResponse or the result of 

1985 cls(response) 

1986 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentResponse] 

1987 :raises ~azure.core.exceptions.HttpResponseError: 

1988 """ 

1989 

1990 @distributed_trace 

1991 def list_linkable_environments( 

1992 self, 

1993 resource_group_name: str, 

1994 monitor_name: str, 

1995 request: Union[_models.LinkableEnvironmentRequest, IO], 

1996 **kwargs: Any 

1997 ) -> Iterable["_models.LinkableEnvironmentResponse"]: 

1998 """Gets all the Dynatrace environments that a user can link a azure resource to. 

1999 

2000 Gets all the Dynatrace environments that a user can link a azure resource to. 

2001 

2002 :param resource_group_name: The name of the resource group. The name is case insensitive. 

2003 Required. 

2004 :type resource_group_name: str 

2005 :param monitor_name: Monitor resource name. Required. 

2006 :type monitor_name: str 

2007 :param request: The details of the linkable environment request. Is either a 

2008 LinkableEnvironmentRequest type or a IO type. Required. 

2009 :type request: ~azure.mgmt.dynatrace.models.LinkableEnvironmentRequest or IO 

2010 :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. 

2011 Default value is None. 

2012 :paramtype content_type: str 

2013 :keyword callable cls: A custom type or function that will be passed the direct response 

2014 :return: An iterator like instance of either LinkableEnvironmentResponse or the result of 

2015 cls(response) 

2016 :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.dynatrace.models.LinkableEnvironmentResponse] 

2017 :raises ~azure.core.exceptions.HttpResponseError: 

2018 """ 

2019 _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) 

2020 _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) 

2021 

2022 api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) 

2023 content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) 

2024 cls: ClsType[_models.LinkableEnvironmentListResponse] = kwargs.pop("cls", None) 

2025 

2026 error_map = { 

2027 401: ClientAuthenticationError, 

2028 404: ResourceNotFoundError, 

2029 409: ResourceExistsError, 

2030 304: ResourceNotModifiedError, 

2031 } 

2032 error_map.update(kwargs.pop("error_map", {}) or {}) 

2033 content_type = content_type or "application/json" 

2034 _json = None 

2035 _content = None 

2036 if isinstance(request, (IOBase, bytes)): 

2037 _content = request 

2038 else: 

2039 _json = self._serialize.body(request, "LinkableEnvironmentRequest") 

2040 

2041 def prepare_request(next_link=None): 

2042 if not next_link: 

2043 

2044 request = build_list_linkable_environments_request( 

2045 resource_group_name=resource_group_name, 

2046 monitor_name=monitor_name, 

2047 subscription_id=self._config.subscription_id, 

2048 api_version=api_version, 

2049 content_type=content_type, 

2050 json=_json, 

2051 content=_content, 

2052 template_url=self.list_linkable_environments.metadata["url"], 

2053 headers=_headers, 

2054 params=_params, 

2055 ) 

2056 request = _convert_request(request) 

2057 request.url = self._client.format_url(request.url) 

2058 

2059 else: 

2060 # make call to next link with the client's api-version 

2061 _parsed_next_link = urllib.parse.urlparse(next_link) 

2062 _next_request_params = case_insensitive_dict( 

2063 { 

2064 key: [urllib.parse.quote(v) for v in value] 

2065 for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() 

2066 } 

2067 ) 

2068 _next_request_params["api-version"] = self._config.api_version 

2069 request = HttpRequest( 

2070 "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params 

2071 ) 

2072 request = _convert_request(request) 

2073 request.url = self._client.format_url(request.url) 

2074 request.method = "GET" 

2075 return request 

2076 

2077 def extract_data(pipeline_response): 

2078 deserialized = self._deserialize("LinkableEnvironmentListResponse", pipeline_response) 

2079 list_of_elem = deserialized.value 

2080 if cls: 

2081 list_of_elem = cls(list_of_elem) # type: ignore 

2082 return deserialized.next_link or None, iter(list_of_elem) 

2083 

2084 def get_next(next_link=None): 

2085 request = prepare_request(next_link) 

2086 

2087 _stream = False 

2088 pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access 

2089 request, stream=_stream, **kwargs 

2090 ) 

2091 response = pipeline_response.http_response 

2092 

2093 if response.status_code not in [200]: 

2094 map_error(status_code=response.status_code, response=response, error_map=error_map) 

2095 error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) 

2096 raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) 

2097 

2098 return pipeline_response 

2099 

2100 return ItemPaged(get_next, extract_data) 

2101 

2102 list_linkable_environments.metadata = { 

2103 "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Dynatrace.Observability/monitors/{monitorName}/listLinkableEnvironments" 

2104 }