|
53 | 53 | build_jobs_summary_request,
|
54 | 54 | build_jobs_unassign_bulk_jobs_sandboxes_request,
|
55 | 55 | build_jobs_unassign_job_sandboxes_request,
|
| 56 | + build_pilot_patch_metadata_request, |
| 57 | + build_pilot_set_job_statuses_request, |
56 | 58 | build_well_known_get_installation_metadata_request,
|
57 | 59 | build_well_known_get_openid_configuration_request,
|
58 | 60 | )
|
@@ -2342,3 +2344,264 @@ async def submit_jdl_jobs(
|
2342 | 2344 | return cls(pipeline_response, deserialized, {}) # type: ignore
|
2343 | 2345 |
|
2344 | 2346 | return deserialized # type: ignore
|
| 2347 | + |
| 2348 | + |
| 2349 | +class PilotOperations: |
| 2350 | + """ |
| 2351 | + .. warning:: |
| 2352 | + **DO NOT** instantiate this class directly. |
| 2353 | +
|
| 2354 | + Instead, you should access the following operations through |
| 2355 | + :class:`~_generated.aio.Dirac`'s |
| 2356 | + :attr:`pilot` attribute. |
| 2357 | + """ |
| 2358 | + |
| 2359 | + models = _models |
| 2360 | + |
| 2361 | + def __init__(self, *args, **kwargs) -> None: |
| 2362 | + input_args = list(args) |
| 2363 | + self._client: AsyncPipelineClient = ( |
| 2364 | + input_args.pop(0) if input_args else kwargs.pop("client") |
| 2365 | + ) |
| 2366 | + self._config: DiracConfiguration = ( |
| 2367 | + input_args.pop(0) if input_args else kwargs.pop("config") |
| 2368 | + ) |
| 2369 | + self._serialize: Serializer = ( |
| 2370 | + input_args.pop(0) if input_args else kwargs.pop("serializer") |
| 2371 | + ) |
| 2372 | + self._deserialize: Deserializer = ( |
| 2373 | + input_args.pop(0) if input_args else kwargs.pop("deserializer") |
| 2374 | + ) |
| 2375 | + |
| 2376 | + @overload |
| 2377 | + async def set_job_statuses( |
| 2378 | + self, |
| 2379 | + body: Dict[str, Dict[str, _models.JobStatusUpdate]], |
| 2380 | + *, |
| 2381 | + force: bool = False, |
| 2382 | + content_type: str = "application/json", |
| 2383 | + **kwargs: Any, |
| 2384 | + ) -> _models.SetJobStatusReturn: |
| 2385 | + """Set Job Statuses. |
| 2386 | +
|
| 2387 | + Set Job Statuses. |
| 2388 | +
|
| 2389 | + :param body: Required. |
| 2390 | + :type body: dict[str, dict[str, ~_generated.models.JobStatusUpdate]] |
| 2391 | + :keyword force: Default value is False. |
| 2392 | + :paramtype force: bool |
| 2393 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2394 | + Default value is "application/json". |
| 2395 | + :paramtype content_type: str |
| 2396 | + :return: SetJobStatusReturn |
| 2397 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2398 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2399 | + """ |
| 2400 | + |
| 2401 | + @overload |
| 2402 | + async def set_job_statuses( |
| 2403 | + self, |
| 2404 | + body: IO[bytes], |
| 2405 | + *, |
| 2406 | + force: bool = False, |
| 2407 | + content_type: str = "application/json", |
| 2408 | + **kwargs: Any, |
| 2409 | + ) -> _models.SetJobStatusReturn: |
| 2410 | + """Set Job Statuses. |
| 2411 | +
|
| 2412 | + Set Job Statuses. |
| 2413 | +
|
| 2414 | + :param body: Required. |
| 2415 | + :type body: IO[bytes] |
| 2416 | + :keyword force: Default value is False. |
| 2417 | + :paramtype force: bool |
| 2418 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2419 | + Default value is "application/json". |
| 2420 | + :paramtype content_type: str |
| 2421 | + :return: SetJobStatusReturn |
| 2422 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2423 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2424 | + """ |
| 2425 | + |
| 2426 | + @distributed_trace_async |
| 2427 | + async def set_job_statuses( |
| 2428 | + self, |
| 2429 | + body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]], |
| 2430 | + *, |
| 2431 | + force: bool = False, |
| 2432 | + **kwargs: Any, |
| 2433 | + ) -> _models.SetJobStatusReturn: |
| 2434 | + """Set Job Statuses. |
| 2435 | +
|
| 2436 | + Set Job Statuses. |
| 2437 | +
|
| 2438 | + :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO[bytes] type. Required. |
| 2439 | + :type body: dict[str, dict[str, ~_generated.models.JobStatusUpdate]] or IO[bytes] |
| 2440 | + :keyword force: Default value is False. |
| 2441 | + :paramtype force: bool |
| 2442 | + :return: SetJobStatusReturn |
| 2443 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2444 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2445 | + """ |
| 2446 | + error_map: MutableMapping = { |
| 2447 | + 401: ClientAuthenticationError, |
| 2448 | + 404: ResourceNotFoundError, |
| 2449 | + 409: ResourceExistsError, |
| 2450 | + 304: ResourceNotModifiedError, |
| 2451 | + } |
| 2452 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2453 | + |
| 2454 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2455 | + _params = kwargs.pop("params", {}) or {} |
| 2456 | + |
| 2457 | + content_type: Optional[str] = kwargs.pop( |
| 2458 | + "content_type", _headers.pop("Content-Type", None) |
| 2459 | + ) |
| 2460 | + cls: ClsType[_models.SetJobStatusReturn] = kwargs.pop("cls", None) |
| 2461 | + |
| 2462 | + content_type = content_type or "application/json" |
| 2463 | + _json = None |
| 2464 | + _content = None |
| 2465 | + if isinstance(body, (IOBase, bytes)): |
| 2466 | + _content = body |
| 2467 | + else: |
| 2468 | + _json = self._serialize.body(body, "{{JobStatusUpdate}}") |
| 2469 | + |
| 2470 | + _request = build_pilot_set_job_statuses_request( |
| 2471 | + force=force, |
| 2472 | + content_type=content_type, |
| 2473 | + json=_json, |
| 2474 | + content=_content, |
| 2475 | + headers=_headers, |
| 2476 | + params=_params, |
| 2477 | + ) |
| 2478 | + _request.url = self._client.format_url(_request.url) |
| 2479 | + |
| 2480 | + _stream = False |
| 2481 | + pipeline_response: PipelineResponse = ( |
| 2482 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 2483 | + _request, stream=_stream, **kwargs |
| 2484 | + ) |
| 2485 | + ) |
| 2486 | + |
| 2487 | + response = pipeline_response.http_response |
| 2488 | + |
| 2489 | + if response.status_code not in [200]: |
| 2490 | + map_error( |
| 2491 | + status_code=response.status_code, response=response, error_map=error_map |
| 2492 | + ) |
| 2493 | + raise HttpResponseError(response=response) |
| 2494 | + |
| 2495 | + deserialized = self._deserialize( |
| 2496 | + "SetJobStatusReturn", pipeline_response.http_response |
| 2497 | + ) |
| 2498 | + |
| 2499 | + if cls: |
| 2500 | + return cls(pipeline_response, deserialized, {}) # type: ignore |
| 2501 | + |
| 2502 | + return deserialized # type: ignore |
| 2503 | + |
| 2504 | + @overload |
| 2505 | + async def patch_metadata( |
| 2506 | + self, |
| 2507 | + body: Dict[str, Dict[str, Any]], |
| 2508 | + *, |
| 2509 | + content_type: str = "application/json", |
| 2510 | + **kwargs: Any, |
| 2511 | + ) -> None: |
| 2512 | + """Patch Metadata. |
| 2513 | +
|
| 2514 | + Patch Metadata. |
| 2515 | +
|
| 2516 | + :param body: Required. |
| 2517 | + :type body: dict[str, dict[str, any]] |
| 2518 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2519 | + Default value is "application/json". |
| 2520 | + :paramtype content_type: str |
| 2521 | + :return: None |
| 2522 | + :rtype: None |
| 2523 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2524 | + """ |
| 2525 | + |
| 2526 | + @overload |
| 2527 | + async def patch_metadata( |
| 2528 | + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any |
| 2529 | + ) -> None: |
| 2530 | + """Patch Metadata. |
| 2531 | +
|
| 2532 | + Patch Metadata. |
| 2533 | +
|
| 2534 | + :param body: Required. |
| 2535 | + :type body: IO[bytes] |
| 2536 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2537 | + Default value is "application/json". |
| 2538 | + :paramtype content_type: str |
| 2539 | + :return: None |
| 2540 | + :rtype: None |
| 2541 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2542 | + """ |
| 2543 | + |
| 2544 | + @distributed_trace_async |
| 2545 | + async def patch_metadata( |
| 2546 | + self, body: Union[Dict[str, Dict[str, Any]], IO[bytes]], **kwargs: Any |
| 2547 | + ) -> None: |
| 2548 | + """Patch Metadata. |
| 2549 | +
|
| 2550 | + Patch Metadata. |
| 2551 | +
|
| 2552 | + :param body: Is either a {str: {str: Any}} type or a IO[bytes] type. Required. |
| 2553 | + :type body: dict[str, dict[str, any]] or IO[bytes] |
| 2554 | + :return: None |
| 2555 | + :rtype: None |
| 2556 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2557 | + """ |
| 2558 | + error_map: MutableMapping = { |
| 2559 | + 401: ClientAuthenticationError, |
| 2560 | + 404: ResourceNotFoundError, |
| 2561 | + 409: ResourceExistsError, |
| 2562 | + 304: ResourceNotModifiedError, |
| 2563 | + } |
| 2564 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2565 | + |
| 2566 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2567 | + _params = kwargs.pop("params", {}) or {} |
| 2568 | + |
| 2569 | + content_type: Optional[str] = kwargs.pop( |
| 2570 | + "content_type", _headers.pop("Content-Type", None) |
| 2571 | + ) |
| 2572 | + cls: ClsType[None] = kwargs.pop("cls", None) |
| 2573 | + |
| 2574 | + content_type = content_type or "application/json" |
| 2575 | + _json = None |
| 2576 | + _content = None |
| 2577 | + if isinstance(body, (IOBase, bytes)): |
| 2578 | + _content = body |
| 2579 | + else: |
| 2580 | + _json = self._serialize.body(body, "{{object}}") |
| 2581 | + |
| 2582 | + _request = build_pilot_patch_metadata_request( |
| 2583 | + content_type=content_type, |
| 2584 | + json=_json, |
| 2585 | + content=_content, |
| 2586 | + headers=_headers, |
| 2587 | + params=_params, |
| 2588 | + ) |
| 2589 | + _request.url = self._client.format_url(_request.url) |
| 2590 | + |
| 2591 | + _stream = False |
| 2592 | + pipeline_response: PipelineResponse = ( |
| 2593 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 2594 | + _request, stream=_stream, **kwargs |
| 2595 | + ) |
| 2596 | + ) |
| 2597 | + |
| 2598 | + response = pipeline_response.http_response |
| 2599 | + |
| 2600 | + if response.status_code not in [204]: |
| 2601 | + map_error( |
| 2602 | + status_code=response.status_code, response=response, error_map=error_map |
| 2603 | + ) |
| 2604 | + raise HttpResponseError(response=response) |
| 2605 | + |
| 2606 | + if cls: |
| 2607 | + return cls(pipeline_response, None, {}) # type: ignore |
0 commit comments