Source code for idem_vra.exec.vra.catalog.requests

from idem_vra.client.vra_catalog_lib.api import RequestsApi
from idem_vra.helpers.mapper import remap_response
from idem_vra.helpers.models import ExecReturn


[docs]async def action_deployment_request_using_post2( hub, ctx, q_action, p_requestId, **kwargs ): """Submit action on requests. Allowable values: cancel, dismiss. Cancel can be submitted on In-progress requests and Dismiss can be submitted on Failed requests. Performs POST /deployment/api/requests/{requestId} :param string q_action: (required in query) action :param string p_requestId: (required in path) requestId :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. """ hub.log.debug("POST /deployment/api/requests/{requestId}") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.action_deployment_request_using_post2( action=q_action, request_id=p_requestId, **kwargs ) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def get_deployment_requests_using_get2(hub, ctx, p_deploymentId, **kwargs): """Fetch deployment requests. Returns the requests for the deployment. Performs GET /deployment/api/deployments/{deploymentId}/requests :param string p_deploymentId: (required in path) Deployment ID :param array orderby: (optional in query) Sorting criteria in the format: property (asc|desc). Default sort order is ascending. Multiple sort criteria are supported. :param integer skip: (optional in query) Number of records you want to skip :param integer top: (optional in query) Number of records you want :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. :param boolean deleted: (optional in query) Retrieves the soft-deleted requests that have not yet been completely deleted. :param boolean inprogressRequests: (optional in query) Retrieves the requests that are currently in-progress for a deployment. Incase of a false value the param is ignored. """ hub.log.debug("GET /deployment/api/deployments/{deploymentId}/requests") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.get_deployment_requests_using_get2(deployment_id=p_deploymentId, **kwargs) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def get_event_logs_content_using_get2(hub, ctx, p_eventId, p_requestId, **kwargs): """Fetch Event logs content as a file. Returns the log file for an event. Performs GET /deployment/api/requests/{requestId}/events/{eventId}/logs/download :param string p_eventId: (required in path) Event ID :param string p_requestId: (required in path) Request ID :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. """ hub.log.debug( "GET /deployment/api/requests/{requestId}/events/{eventId}/logs/download" ) api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.get_event_logs_content_using_get2( event_id=p_eventId, request_id=p_requestId, **kwargs ) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def get_event_logs_using_get2(hub, ctx, p_eventId, p_requestId, **kwargs): """Fetch Event logs. Returns the logs for an event. Performs GET /deployment/api/requests/{requestId}/events/{eventId}/logs :param string p_eventId: (required in path) Event ID :param string p_requestId: (required in path) Request ID :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. :param integer sinceRow: (optional in query) A positive row number from which to show logs. """ hub.log.debug("GET /deployment/api/requests/{requestId}/events/{eventId}/logs") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.get_event_logs_using_get2( event_id=p_eventId, request_id=p_requestId, **kwargs ) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def get_request_events_using_get2(hub, ctx, p_requestId, **kwargs): """Fetch Request events. Returns all the events for a request. Performs GET /deployment/api/requests/{requestId}/events :param string p_requestId: (required in path) Request ID :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. """ hub.log.debug("GET /deployment/api/requests/{requestId}/events") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.get_request_events_using_get2(request_id=p_requestId, **kwargs) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def get_request_using_get2(hub, ctx, p_requestId, **kwargs): """Get the Request. Returns the request with the given ID. Performs GET /deployment/api/requests/{requestId} :param string p_requestId: (required in path) Request ID :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. """ hub.log.debug("GET /deployment/api/requests/{requestId}") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.get_request_using_get2(request_id=p_requestId, **kwargs) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))
[docs]async def list_resource_requests_using_get2(hub, ctx, p_resourceId, **kwargs): """Get all requests for a resource Performs GET /deployment/api/resources/{resourceId}/requests :param string p_resourceId: (required in path) Resource ID :param array orderby: (optional in query) Sorting criteria in the format: property (asc|desc). Default sort order is ascending. Multiple sort criteria are supported. :param integer skip: (optional in query) Number of records you want to skip :param integer top: (optional in query) Number of records you want :param string apiVersion: (optional in query) The version of the API in yyyy-MM-dd format (UTC). If you do not specify explicitly an exact version, you will be calling the latest supported API version. """ hub.log.debug("GET /deployment/api/resources/{resourceId}/requests") api = RequestsApi(hub.clients["idem_vra.client.vra_catalog_lib.api"]) if "api_version" not in kwargs: kwargs["api_version"] = "2020-08-25" ret = api.list_resource_requests_using_get2(resource_id=p_resourceId, **kwargs) # hub.log.debug(ret) return ExecReturn(result=True, ret=remap_response(ret))