diff --git a/DO_OPENAPI_COMMIT_SHA.txt b/DO_OPENAPI_COMMIT_SHA.txt index d252388..2853f43 100644 --- a/DO_OPENAPI_COMMIT_SHA.txt +++ b/DO_OPENAPI_COMMIT_SHA.txt @@ -1 +1 @@ -7b21224 +46111f4 diff --git a/src/pydo/aio/operations/_operations.py b/src/pydo/aio/operations/_operations.py index 8cfb7cc..aedd780 100644 --- a/src/pydo/aio/operations/_operations.py +++ b/src/pydo/aio/operations/_operations.py @@ -52,6 +52,8 @@ build_apps_get_health_request, build_apps_get_instance_size_request, build_apps_get_instances_request, + build_apps_get_job_invocation_logs_request, + build_apps_get_job_invocation_request, build_apps_get_logs_active_deployment_aggregate_request, build_apps_get_logs_active_deployment_request, build_apps_get_logs_aggregate_request, @@ -61,6 +63,7 @@ build_apps_list_alerts_request, build_apps_list_deployments_request, build_apps_list_instance_sizes_request, + build_apps_list_job_invocations_request, build_apps_list_metrics_bandwidth_daily_request, build_apps_list_regions_request, build_apps_list_request, @@ -84406,6 +84409,492 @@ async def get_logs_active_deployment_aggregate( return cast(JSON, deserialized) # type: ignore + @distributed_trace_async + async def list_job_invocations( + self, + app_id: str, + *, + job_names: Optional[List[str]] = None, + deployment_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """List Job Invocations. + + List all job invocations for an app. + + :param app_id: The app ID. Required. + :type app_id: str + :keyword job_names: The job names to list job invocations for. Default value is None. + :paramtype job_names: list[str] + :keyword deployment_id: The deployment ID. Default value is None. + :paramtype deployment_id: str + :keyword page: Which 'page' of paginated results to return. Default value is 1. + :paramtype page: int + :keyword per_page: Number of items returned per page. Default value is 20. + :paramtype per_page: int + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "job_invocations": [ + { + "completed_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation completed. + "created_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation was created. + "deployment_id": "str", # Optional. The deployment ID this + job invocation belongs to. + "id": "str", # Optional. The ID of the job invocation. + "job_name": "str", # Optional. The name of the job this + invocation belongs to. + "phase": "str", # Optional. The phase of the job invocation. + Known values are: "UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "FAILED", + "CANCELED", and "SKIPPED". + "started_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation started. + "trigger": { + "manual": { + "user": { + "email": "str", # Optional. The + email of the user who triggered the job. + "full_name": "str", # Optional. The + name of the user who triggered the job. + "uuid": "str" # Optional. The ID of + the user who triggered the job. + } + }, + "scheduled": { + "schedule": { + "cron": "str", # Optional. The cron + expression defining the schedule. + "time_zone": "str" # Optional. The + time zone for the schedule. + } + }, + "type": "UNKNOWN" # Optional. Default value is + "UNKNOWN". The type of trigger that initiated the job invocation. + Known values are: "MANUAL", "SCHEDULE", and "UNKNOWN". + } + } + ], + "links": { + "pages": {} + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_list_job_invocations_request( + app_id=app_id, + job_names=job_names, + deployment_id=deployment_id, + page=page, + per_page=per_page, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get_job_invocation( + self, + app_id: str, + job_invocation_id: str, + *, + job_name: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Get Job Invocations. + + Get a specific job invocation for an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param job_invocation_id: The ID of the job invocation to retrieve. Required. + :type job_invocation_id: str + :keyword job_name: The job name to list job invocations for. Default value is None. + :paramtype job_name: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "completed_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation completed. + "created_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation was created. + "deployment_id": "str", # Optional. The deployment ID this job invocation + belongs to. + "id": "str", # Optional. The ID of the job invocation. + "job_name": "str", # Optional. The name of the job this invocation belongs + to. + "phase": "str", # Optional. The phase of the job invocation. Known values + are: "UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "FAILED", "CANCELED", and + "SKIPPED". + "started_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation started. + "trigger": { + "manual": { + "user": { + "email": "str", # Optional. The email of the user + who triggered the job. + "full_name": "str", # Optional. The name of the user + who triggered the job. + "uuid": "str" # Optional. The ID of the user who + triggered the job. + } + }, + "scheduled": { + "schedule": { + "cron": "str", # Optional. The cron expression + defining the schedule. + "time_zone": "str" # Optional. The time zone for the + schedule. + } + }, + "type": "UNKNOWN" # Optional. Default value is "UNKNOWN". The type + of trigger that initiated the job invocation. Known values are: "MANUAL", + "SCHEDULE", and "UNKNOWN". + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_get_job_invocation_request( + app_id=app_id, + job_invocation_id=job_invocation_id, + job_name=job_name, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace_async + async def get_job_invocation_logs( + self, + app_id: str, + job_name: str, + job_invocation_id: str, + *, + type: str, + deployment_id: Optional[str] = None, + follow: Optional[bool] = None, + pod_connection_timeout: Optional[str] = None, + tail_lines: Optional[str] = None, + **kwargs: Any + ) -> JSON: + # pylint: disable=line-too-long + """Retrieve Job Invocation Logs. + + Retrieve the logs of a past, in-progress, or active deployment. If a component name is + specified, the logs will be limited to only that component. If deployment is omitted the active + deployment will be selected (if available). The response will include links to either real-time + logs of an in-progress or active deployment or archived logs of a past deployment. + + :param app_id: The app ID. Required. + :type app_id: str + :param job_name: The job name to list job invocations for. Required. + :type job_name: str + :param job_invocation_id: The ID of the job invocation to retrieve. Required. + :type job_invocation_id: str + :keyword type: The type of logs to retrieve. "JOB_INVOCATION" Required. + :paramtype type: str + :keyword deployment_id: The deployment ID. Default value is None. + :paramtype deployment_id: str + :keyword follow: Whether the logs should follow live updates. Default value is None. + :paramtype follow: bool + :keyword pod_connection_timeout: An optional time duration to wait if the underlying component + instance is not immediately available. Default: ``3m``. Default value is None. + :paramtype pod_connection_timeout: str + :keyword tail_lines: The number of lines from the end of the logs to retrieve. Default value is + None. + :paramtype tail_lines: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "historic_urls": [ + "str" # Optional. A list of URLs to archived log files. + ], + "live_url": "str" # Optional. A URL of the real-time live logs. This URL may + use either the ``https://`` or ``wss://`` protocols and will keep pushing live + logs as they become available. + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_get_job_invocation_logs_request( + app_id=app_id, + job_name=job_name, + job_invocation_id=job_invocation_id, + type=type, + deployment_id=deployment_id, + follow=follow, + pod_connection_timeout=pod_connection_timeout, + tail_lines=tail_lines, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + await self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + await response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace_async async def list_instance_sizes(self, **kwargs: Any) -> JSON: # pylint: disable=line-too-long @@ -107221,7 +107710,18 @@ async def list_backups(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: "size_gigabytes": 0.0 # The size of the database backup in GBs. Required. } - ] + ], + "backup_progress": "str", # Optional. If a backup is currently in progress, + this attribute shows the percentage of completion. If no backup is in progress, + this attribute will be hidden. + "scheduled_backup_time": { + "backup_hour": 0, # Optional. The hour of the day when the backup is + scheduled (in UTC). + "backup_interval_hours": 0, # Optional. The frequency, in hours, at + which backups are taken. + "backup_minute": 0 # Optional. The minute of the hour when the + backup is scheduled. + } } # response body for status code(s): 404 response == { diff --git a/src/pydo/operations/_operations.py b/src/pydo/operations/_operations.py index 3cbf7db..bcb3486 100644 --- a/src/pydo/operations/_operations.py +++ b/src/pydo/operations/_operations.py @@ -800,6 +800,137 @@ def build_apps_get_logs_active_deployment_aggregate_request( # pylint: disable= ) +def build_apps_list_job_invocations_request( + app_id: str, + *, + job_names: Optional[List[str]] = None, + deployment_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/apps/{app_id}/job-invocations" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if job_names is not None: + _params["job_names"] = _SERIALIZER.query("job_names", job_names, "[str]") + if deployment_id is not None: + _params["deployment_id"] = _SERIALIZER.query( + "deployment_id", deployment_id, "str" + ) + if page is not None: + _params["page"] = _SERIALIZER.query("page", page, "int", minimum=1) + if per_page is not None: + _params["per_page"] = _SERIALIZER.query( + "per_page", per_page, "int", maximum=200, minimum=1 + ) + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_apps_get_job_invocation_request( + app_id: str, + job_invocation_id: str, + *, + job_name: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/apps/{app_id}/job-invocations/{job_invocation_id}" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "job_invocation_id": _SERIALIZER.url( + "job_invocation_id", job_invocation_id, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if job_name is not None: + _params["job_name"] = _SERIALIZER.query("job_name", job_name, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + +def build_apps_get_job_invocation_logs_request( # pylint: disable=name-too-long + app_id: str, + job_name: str, + job_invocation_id: str, + *, + type: str, + deployment_id: Optional[str] = None, + follow: Optional[bool] = None, + pod_connection_timeout: Optional[str] = None, + tail_lines: Optional[str] = None, + **kwargs: Any, +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/v2/apps/{app_id}/jobs/{job_name}/invocations/{job_invocation_id}/logs" + path_format_arguments = { + "app_id": _SERIALIZER.url("app_id", app_id, "str"), + "job_name": _SERIALIZER.url("job_name", job_name, "str"), + "job_invocation_id": _SERIALIZER.url( + "job_invocation_id", job_invocation_id, "str" + ), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore + + # Construct parameters + if deployment_id is not None: + _params["deployment_id"] = _SERIALIZER.query( + "deployment_id", deployment_id, "str" + ) + if follow is not None: + _params["follow"] = _SERIALIZER.query("follow", follow, "bool") + _params["type"] = _SERIALIZER.query("type", type, "str") + if pod_connection_timeout is not None: + _params["pod_connection_timeout"] = _SERIALIZER.query( + "pod_connection_timeout", pod_connection_timeout, "str" + ) + if tail_lines is not None: + _params["tail_lines"] = _SERIALIZER.query("tail_lines", tail_lines, "str") + + # Construct headers + _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") + + return HttpRequest( + method="GET", url=_url, params=_params, headers=_headers, **kwargs + ) + + def build_apps_list_instance_sizes_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -96571,6 +96702,492 @@ def get_logs_active_deployment_aggregate( return cast(JSON, deserialized) # type: ignore + @distributed_trace + def list_job_invocations( + self, + app_id: str, + *, + job_names: Optional[List[str]] = None, + deployment_id: Optional[str] = None, + page: int = 1, + per_page: int = 20, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """List Job Invocations. + + List all job invocations for an app. + + :param app_id: The app ID. Required. + :type app_id: str + :keyword job_names: The job names to list job invocations for. Default value is None. + :paramtype job_names: list[str] + :keyword deployment_id: The deployment ID. Default value is None. + :paramtype deployment_id: str + :keyword page: Which 'page' of paginated results to return. Default value is 1. + :paramtype page: int + :keyword per_page: Number of items returned per page. Default value is 20. + :paramtype per_page: int + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "job_invocations": [ + { + "completed_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation completed. + "created_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation was created. + "deployment_id": "str", # Optional. The deployment ID this + job invocation belongs to. + "id": "str", # Optional. The ID of the job invocation. + "job_name": "str", # Optional. The name of the job this + invocation belongs to. + "phase": "str", # Optional. The phase of the job invocation. + Known values are: "UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "FAILED", + "CANCELED", and "SKIPPED". + "started_at": "2020-02-20 00:00:00", # Optional. The time + when the job invocation started. + "trigger": { + "manual": { + "user": { + "email": "str", # Optional. The + email of the user who triggered the job. + "full_name": "str", # Optional. The + name of the user who triggered the job. + "uuid": "str" # Optional. The ID of + the user who triggered the job. + } + }, + "scheduled": { + "schedule": { + "cron": "str", # Optional. The cron + expression defining the schedule. + "time_zone": "str" # Optional. The + time zone for the schedule. + } + }, + "type": "UNKNOWN" # Optional. Default value is + "UNKNOWN". The type of trigger that initiated the job invocation. + Known values are: "MANUAL", "SCHEDULE", and "UNKNOWN". + } + } + ], + "links": { + "pages": {} + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_list_job_invocations_request( + app_id=app_id, + job_names=job_names, + deployment_id=deployment_id, + page=page, + per_page=per_page, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get_job_invocation( + self, + app_id: str, + job_invocation_id: str, + *, + job_name: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Get Job Invocations. + + Get a specific job invocation for an app. + + :param app_id: The app ID. Required. + :type app_id: str + :param job_invocation_id: The ID of the job invocation to retrieve. Required. + :type job_invocation_id: str + :keyword job_name: The job name to list job invocations for. Default value is None. + :paramtype job_name: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "completed_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation completed. + "created_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation was created. + "deployment_id": "str", # Optional. The deployment ID this job invocation + belongs to. + "id": "str", # Optional. The ID of the job invocation. + "job_name": "str", # Optional. The name of the job this invocation belongs + to. + "phase": "str", # Optional. The phase of the job invocation. Known values + are: "UNKNOWN", "PENDING", "RUNNING", "SUCCEEDED", "FAILED", "CANCELED", and + "SKIPPED". + "started_at": "2020-02-20 00:00:00", # Optional. The time when the job + invocation started. + "trigger": { + "manual": { + "user": { + "email": "str", # Optional. The email of the user + who triggered the job. + "full_name": "str", # Optional. The name of the user + who triggered the job. + "uuid": "str" # Optional. The ID of the user who + triggered the job. + } + }, + "scheduled": { + "schedule": { + "cron": "str", # Optional. The cron expression + defining the schedule. + "time_zone": "str" # Optional. The time zone for the + schedule. + } + }, + "type": "UNKNOWN" # Optional. Default value is "UNKNOWN". The type + of trigger that initiated the job invocation. Known values are: "MANUAL", + "SCHEDULE", and "UNKNOWN". + } + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_get_job_invocation_request( + app_id=app_id, + job_invocation_id=job_invocation_id, + job_name=job_name, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + + @distributed_trace + def get_job_invocation_logs( + self, + app_id: str, + job_name: str, + job_invocation_id: str, + *, + type: str, + deployment_id: Optional[str] = None, + follow: Optional[bool] = None, + pod_connection_timeout: Optional[str] = None, + tail_lines: Optional[str] = None, + **kwargs: Any, + ) -> JSON: + # pylint: disable=line-too-long + """Retrieve Job Invocation Logs. + + Retrieve the logs of a past, in-progress, or active deployment. If a component name is + specified, the logs will be limited to only that component. If deployment is omitted the active + deployment will be selected (if available). The response will include links to either real-time + logs of an in-progress or active deployment or archived logs of a past deployment. + + :param app_id: The app ID. Required. + :type app_id: str + :param job_name: The job name to list job invocations for. Required. + :type job_name: str + :param job_invocation_id: The ID of the job invocation to retrieve. Required. + :type job_invocation_id: str + :keyword type: The type of logs to retrieve. "JOB_INVOCATION" Required. + :paramtype type: str + :keyword deployment_id: The deployment ID. Default value is None. + :paramtype deployment_id: str + :keyword follow: Whether the logs should follow live updates. Default value is None. + :paramtype follow: bool + :keyword pod_connection_timeout: An optional time duration to wait if the underlying component + instance is not immediately available. Default: ``3m``. Default value is None. + :paramtype pod_connection_timeout: str + :keyword tail_lines: The number of lines from the end of the logs to retrieve. Default value is + None. + :paramtype tail_lines: str + :return: JSON object + :rtype: JSON + :raises ~azure.core.exceptions.HttpResponseError: + + Example: + .. code-block:: python + + # response body for status code(s): 200 + response == { + "historic_urls": [ + "str" # Optional. A list of URLs to archived log files. + ], + "live_url": "str" # Optional. A URL of the real-time live logs. This URL may + use either the ``https://`` or ``wss://`` protocols and will keep pushing live + logs as they become available. + } + # response body for status code(s): 404 + response == { + "id": "str", # A short identifier corresponding to the HTTP status code + returned. For example, the ID for a response returning a 404 status code would + be "not_found.". Required. + "message": "str", # A message providing additional information about the + error, including details to help resolve it when possible. Required. + "request_id": "str" # Optional. Optionally, some endpoints may include a + request ID that should be provided when reporting bugs or opening support + tickets to help identify the issue. + } + """ + error_map: MutableMapping[int, Type[HttpResponseError]] = { + 404: ResourceNotFoundError, + 409: ResourceExistsError, + 304: ResourceNotModifiedError, + 401: cast( + Type[HttpResponseError], + lambda response: ClientAuthenticationError(response=response), + ), + 429: HttpResponseError, + 500: HttpResponseError, + } + error_map.update(kwargs.pop("error_map", {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[JSON] = kwargs.pop("cls", None) + + _request = build_apps_get_job_invocation_logs_request( + app_id=app_id, + job_name=job_name, + job_invocation_id=job_invocation_id, + type=type, + deployment_id=deployment_id, + follow=follow, + pod_connection_timeout=pod_connection_timeout, + tail_lines=tail_lines, + headers=_headers, + params=_params, + ) + _request.url = self._client.format_url(_request.url) + + _stream = False + pipeline_response: PipelineResponse = ( + self._client._pipeline.run( # pylint: disable=protected-access + _request, stream=_stream, **kwargs + ) + ) + + response = pipeline_response.http_response + + if response.status_code not in [200, 404]: + if _stream: + response.read() # Load the body in memory and close the socket + map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore + raise HttpResponseError(response=response) + + response_headers = {} + if response.status_code == 200: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if response.status_code == 404: + response_headers["ratelimit-limit"] = self._deserialize( + "int", response.headers.get("ratelimit-limit") + ) + response_headers["ratelimit-remaining"] = self._deserialize( + "int", response.headers.get("ratelimit-remaining") + ) + response_headers["ratelimit-reset"] = self._deserialize( + "int", response.headers.get("ratelimit-reset") + ) + + if response.content: + deserialized = response.json() + else: + deserialized = None + + if cls: + return cls(pipeline_response, cast(JSON, deserialized), response_headers) # type: ignore + + return cast(JSON, deserialized) # type: ignore + @distributed_trace def list_instance_sizes(self, **kwargs: Any) -> JSON: # pylint: disable=line-too-long @@ -119374,7 +119991,18 @@ def list_backups(self, database_cluster_uuid: str, **kwargs: Any) -> JSON: "size_gigabytes": 0.0 # The size of the database backup in GBs. Required. } - ] + ], + "backup_progress": "str", # Optional. If a backup is currently in progress, + this attribute shows the percentage of completion. If no backup is in progress, + this attribute will be hidden. + "scheduled_backup_time": { + "backup_hour": 0, # Optional. The hour of the day when the backup is + scheduled (in UTC). + "backup_interval_hours": 0, # Optional. The frequency, in hours, at + which backups are taken. + "backup_minute": 0 # Optional. The minute of the hour when the + backup is scheduled. + } } # response body for status code(s): 404 response == {