Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DO_OPENAPI_COMMIT_SHA.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
45aa04a
5a50116
160 changes: 160 additions & 0 deletions src/pydo/aio/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
build_addons_patch_request,
build_apps_assign_alert_destinations_request,
build_apps_cancel_deployment_request,
build_apps_cancel_job_invocation_request,
build_apps_commit_rollback_request,
build_apps_create_deployment_request,
build_apps_create_request,
Expand Down Expand Up @@ -86404,6 +86405,165 @@ async def get_job_invocation(

return cast(JSON, deserialized) # type: ignore

@distributed_trace_async
async def cancel_job_invocation(
self,
app_id: str,
job_invocation_id: str,
*,
job_name: Optional[str] = None,
**kwargs: Any
) -> JSON:
# pylint: disable=line-too-long
"""Cancel Job Invocation.

Cancel 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_cancel_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,
Expand Down
194 changes: 194 additions & 0 deletions src/pydo/operations/_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1037,6 +1037,41 @@ def build_apps_get_job_invocation_request(
)


def build_apps_cancel_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}/cancel"
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="POST", 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,
Expand Down Expand Up @@ -99223,6 +99258,165 @@ def get_job_invocation(

return cast(JSON, deserialized) # type: ignore

@distributed_trace
def cancel_job_invocation(
self,
app_id: str,
job_invocation_id: str,
*,
job_name: Optional[str] = None,
**kwargs: Any,
) -> JSON:
# pylint: disable=line-too-long
"""Cancel Job Invocation.

Cancel 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_cancel_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,
Expand Down