|
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_jwks_request, |
58 | 60 | build_well_known_get_openid_configuration_request, |
@@ -2394,3 +2396,264 @@ async def submit_jdl_jobs( |
2394 | 2396 | return cls(pipeline_response, deserialized, {}) # type: ignore |
2395 | 2397 |
|
2396 | 2398 | return deserialized # type: ignore |
| 2399 | + |
| 2400 | + |
| 2401 | +class PilotOperations: |
| 2402 | + """ |
| 2403 | + .. warning:: |
| 2404 | + **DO NOT** instantiate this class directly. |
| 2405 | +
|
| 2406 | + Instead, you should access the following operations through |
| 2407 | + :class:`~_generated.aio.Dirac`'s |
| 2408 | + :attr:`pilot` attribute. |
| 2409 | + """ |
| 2410 | + |
| 2411 | + models = _models |
| 2412 | + |
| 2413 | + def __init__(self, *args, **kwargs) -> None: |
| 2414 | + input_args = list(args) |
| 2415 | + self._client: AsyncPipelineClient = ( |
| 2416 | + input_args.pop(0) if input_args else kwargs.pop("client") |
| 2417 | + ) |
| 2418 | + self._config: DiracConfiguration = ( |
| 2419 | + input_args.pop(0) if input_args else kwargs.pop("config") |
| 2420 | + ) |
| 2421 | + self._serialize: Serializer = ( |
| 2422 | + input_args.pop(0) if input_args else kwargs.pop("serializer") |
| 2423 | + ) |
| 2424 | + self._deserialize: Deserializer = ( |
| 2425 | + input_args.pop(0) if input_args else kwargs.pop("deserializer") |
| 2426 | + ) |
| 2427 | + |
| 2428 | + @overload |
| 2429 | + async def set_job_statuses( |
| 2430 | + self, |
| 2431 | + body: Dict[str, Dict[str, _models.JobStatusUpdate]], |
| 2432 | + *, |
| 2433 | + force: bool = False, |
| 2434 | + content_type: str = "application/json", |
| 2435 | + **kwargs: Any, |
| 2436 | + ) -> _models.SetJobStatusReturn: |
| 2437 | + """Set Job Statuses. |
| 2438 | +
|
| 2439 | + Set Job Statuses. |
| 2440 | +
|
| 2441 | + :param body: Required. |
| 2442 | + :type body: dict[str, dict[str, ~_generated.models.JobStatusUpdate]] |
| 2443 | + :keyword force: Default value is False. |
| 2444 | + :paramtype force: bool |
| 2445 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2446 | + Default value is "application/json". |
| 2447 | + :paramtype content_type: str |
| 2448 | + :return: SetJobStatusReturn |
| 2449 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2450 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2451 | + """ |
| 2452 | + |
| 2453 | + @overload |
| 2454 | + async def set_job_statuses( |
| 2455 | + self, |
| 2456 | + body: IO[bytes], |
| 2457 | + *, |
| 2458 | + force: bool = False, |
| 2459 | + content_type: str = "application/json", |
| 2460 | + **kwargs: Any, |
| 2461 | + ) -> _models.SetJobStatusReturn: |
| 2462 | + """Set Job Statuses. |
| 2463 | +
|
| 2464 | + Set Job Statuses. |
| 2465 | +
|
| 2466 | + :param body: Required. |
| 2467 | + :type body: IO[bytes] |
| 2468 | + :keyword force: Default value is False. |
| 2469 | + :paramtype force: bool |
| 2470 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2471 | + Default value is "application/json". |
| 2472 | + :paramtype content_type: str |
| 2473 | + :return: SetJobStatusReturn |
| 2474 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2475 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2476 | + """ |
| 2477 | + |
| 2478 | + @distributed_trace_async |
| 2479 | + async def set_job_statuses( |
| 2480 | + self, |
| 2481 | + body: Union[Dict[str, Dict[str, _models.JobStatusUpdate]], IO[bytes]], |
| 2482 | + *, |
| 2483 | + force: bool = False, |
| 2484 | + **kwargs: Any, |
| 2485 | + ) -> _models.SetJobStatusReturn: |
| 2486 | + """Set Job Statuses. |
| 2487 | +
|
| 2488 | + Set Job Statuses. |
| 2489 | +
|
| 2490 | + :param body: Is either a {str: {str: JobStatusUpdate}} type or a IO[bytes] type. Required. |
| 2491 | + :type body: dict[str, dict[str, ~_generated.models.JobStatusUpdate]] or IO[bytes] |
| 2492 | + :keyword force: Default value is False. |
| 2493 | + :paramtype force: bool |
| 2494 | + :return: SetJobStatusReturn |
| 2495 | + :rtype: ~_generated.models.SetJobStatusReturn |
| 2496 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2497 | + """ |
| 2498 | + error_map: MutableMapping = { |
| 2499 | + 401: ClientAuthenticationError, |
| 2500 | + 404: ResourceNotFoundError, |
| 2501 | + 409: ResourceExistsError, |
| 2502 | + 304: ResourceNotModifiedError, |
| 2503 | + } |
| 2504 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2505 | + |
| 2506 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2507 | + _params = kwargs.pop("params", {}) or {} |
| 2508 | + |
| 2509 | + content_type: Optional[str] = kwargs.pop( |
| 2510 | + "content_type", _headers.pop("Content-Type", None) |
| 2511 | + ) |
| 2512 | + cls: ClsType[_models.SetJobStatusReturn] = kwargs.pop("cls", None) |
| 2513 | + |
| 2514 | + content_type = content_type or "application/json" |
| 2515 | + _json = None |
| 2516 | + _content = None |
| 2517 | + if isinstance(body, (IOBase, bytes)): |
| 2518 | + _content = body |
| 2519 | + else: |
| 2520 | + _json = self._serialize.body(body, "{{JobStatusUpdate}}") |
| 2521 | + |
| 2522 | + _request = build_pilot_set_job_statuses_request( |
| 2523 | + force=force, |
| 2524 | + content_type=content_type, |
| 2525 | + json=_json, |
| 2526 | + content=_content, |
| 2527 | + headers=_headers, |
| 2528 | + params=_params, |
| 2529 | + ) |
| 2530 | + _request.url = self._client.format_url(_request.url) |
| 2531 | + |
| 2532 | + _stream = False |
| 2533 | + pipeline_response: PipelineResponse = ( |
| 2534 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 2535 | + _request, stream=_stream, **kwargs |
| 2536 | + ) |
| 2537 | + ) |
| 2538 | + |
| 2539 | + response = pipeline_response.http_response |
| 2540 | + |
| 2541 | + if response.status_code not in [200]: |
| 2542 | + map_error( |
| 2543 | + status_code=response.status_code, response=response, error_map=error_map |
| 2544 | + ) |
| 2545 | + raise HttpResponseError(response=response) |
| 2546 | + |
| 2547 | + deserialized = self._deserialize( |
| 2548 | + "SetJobStatusReturn", pipeline_response.http_response |
| 2549 | + ) |
| 2550 | + |
| 2551 | + if cls: |
| 2552 | + return cls(pipeline_response, deserialized, {}) # type: ignore |
| 2553 | + |
| 2554 | + return deserialized # type: ignore |
| 2555 | + |
| 2556 | + @overload |
| 2557 | + async def patch_metadata( |
| 2558 | + self, |
| 2559 | + body: Dict[str, Dict[str, Any]], |
| 2560 | + *, |
| 2561 | + content_type: str = "application/json", |
| 2562 | + **kwargs: Any, |
| 2563 | + ) -> None: |
| 2564 | + """Patch Metadata. |
| 2565 | +
|
| 2566 | + Patch Metadata. |
| 2567 | +
|
| 2568 | + :param body: Required. |
| 2569 | + :type body: dict[str, dict[str, any]] |
| 2570 | + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. |
| 2571 | + Default value is "application/json". |
| 2572 | + :paramtype content_type: str |
| 2573 | + :return: None |
| 2574 | + :rtype: None |
| 2575 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2576 | + """ |
| 2577 | + |
| 2578 | + @overload |
| 2579 | + async def patch_metadata( |
| 2580 | + self, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any |
| 2581 | + ) -> None: |
| 2582 | + """Patch Metadata. |
| 2583 | +
|
| 2584 | + Patch Metadata. |
| 2585 | +
|
| 2586 | + :param body: Required. |
| 2587 | + :type body: IO[bytes] |
| 2588 | + :keyword content_type: Body Parameter content-type. Content type parameter for binary body. |
| 2589 | + Default value is "application/json". |
| 2590 | + :paramtype content_type: str |
| 2591 | + :return: None |
| 2592 | + :rtype: None |
| 2593 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2594 | + """ |
| 2595 | + |
| 2596 | + @distributed_trace_async |
| 2597 | + async def patch_metadata( |
| 2598 | + self, body: Union[Dict[str, Dict[str, Any]], IO[bytes]], **kwargs: Any |
| 2599 | + ) -> None: |
| 2600 | + """Patch Metadata. |
| 2601 | +
|
| 2602 | + Patch Metadata. |
| 2603 | +
|
| 2604 | + :param body: Is either a {str: {str: Any}} type or a IO[bytes] type. Required. |
| 2605 | + :type body: dict[str, dict[str, any]] or IO[bytes] |
| 2606 | + :return: None |
| 2607 | + :rtype: None |
| 2608 | + :raises ~azure.core.exceptions.HttpResponseError: |
| 2609 | + """ |
| 2610 | + error_map: MutableMapping = { |
| 2611 | + 401: ClientAuthenticationError, |
| 2612 | + 404: ResourceNotFoundError, |
| 2613 | + 409: ResourceExistsError, |
| 2614 | + 304: ResourceNotModifiedError, |
| 2615 | + } |
| 2616 | + error_map.update(kwargs.pop("error_map", {}) or {}) |
| 2617 | + |
| 2618 | + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) |
| 2619 | + _params = kwargs.pop("params", {}) or {} |
| 2620 | + |
| 2621 | + content_type: Optional[str] = kwargs.pop( |
| 2622 | + "content_type", _headers.pop("Content-Type", None) |
| 2623 | + ) |
| 2624 | + cls: ClsType[None] = kwargs.pop("cls", None) |
| 2625 | + |
| 2626 | + content_type = content_type or "application/json" |
| 2627 | + _json = None |
| 2628 | + _content = None |
| 2629 | + if isinstance(body, (IOBase, bytes)): |
| 2630 | + _content = body |
| 2631 | + else: |
| 2632 | + _json = self._serialize.body(body, "{{object}}") |
| 2633 | + |
| 2634 | + _request = build_pilot_patch_metadata_request( |
| 2635 | + content_type=content_type, |
| 2636 | + json=_json, |
| 2637 | + content=_content, |
| 2638 | + headers=_headers, |
| 2639 | + params=_params, |
| 2640 | + ) |
| 2641 | + _request.url = self._client.format_url(_request.url) |
| 2642 | + |
| 2643 | + _stream = False |
| 2644 | + pipeline_response: PipelineResponse = ( |
| 2645 | + await self._client._pipeline.run( # pylint: disable=protected-access |
| 2646 | + _request, stream=_stream, **kwargs |
| 2647 | + ) |
| 2648 | + ) |
| 2649 | + |
| 2650 | + response = pipeline_response.http_response |
| 2651 | + |
| 2652 | + if response.status_code not in [204]: |
| 2653 | + map_error( |
| 2654 | + status_code=response.status_code, response=response, error_map=error_map |
| 2655 | + ) |
| 2656 | + raise HttpResponseError(response=response) |
| 2657 | + |
| 2658 | + if cls: |
| 2659 | + return cls(pipeline_response, None, {}) # type: ignore |
0 commit comments