Skip to content

get_resource async

get_resource(
    rest_api_id: String,
    resource_id: String,
    *,
    config_overrides: Optional[AsyncAPIGatewayClientConfig] = None,
    embed: Optional[ListOfString] = None,
) -> Resource

Lists information about a resource.

Parameters:

  • rest_api_id (String) –

    The string identifier of the associated RestApi.

  • resource_id (String) –

    The identifier for the Resource resource.

  • embed (Optional[ListOfString], default: None ) –

    A query parameter to retrieve the specified resources embedded in the returned Resource representation in the response. This embed parameter value is a list of comma-separated strings. Currently, the request supports only retrieval of the embedded Method resources this way. The query parameter value must be a single-valued list and contain the "methods" string. For example, GET /restapis/{restapi_id}/resources/{resource_id}?embed=methods.

Raises:

Source code in docs_src/capo_api_gateway/_services/async_api_gateway.py
async def get_resource(
    self,
    rest_api_id: "capo_api_gateway.types.string.String",
    resource_id: "capo_api_gateway.types.string.String",
    *,
    config_overrides: Optional[AsyncAPIGatewayClientConfig] = None,
    embed: Optional["capo_api_gateway.types.list_of_string.ListOfString"] = None,
) -> "capo_api_gateway.types.resource.Resource":
    """<p>Lists information about a resource.</p>

    Args:
        rest_api_id: <p>The string identifier of the associated RestApi.</p>
        resource_id: <p>The identifier for the Resource resource.</p>
        embed: <p>A query parameter to retrieve the specified resources embedded in the returned Resource representation in the response. This <code>embed</code> parameter value is a list of comma-separated strings. Currently, the request supports only retrieval of the embedded Method resources this way. The query parameter value must be a single-valued list and contain the <code>"methods"</code> string. For example, <code>GET /restapis/{restapi_id}/resources/{resource_id}?embed=methods</code>.</p>

    Raises:
        capo_api_gateway.errors.not_found_exception.NotFoundException: <p>The requested resource is not found. Make sure that the request URI is correct.</p>
        capo_api_gateway.errors.too_many_requests_exception.TooManyRequestsException: <p>The request has reached its throttling limit. Retry after the specified time period.</p>
        capo_api_gateway.errors.unauthorized_exception.UnauthorizedException: <p>The request is denied because the caller has insufficient permissions.</p>
        capo_api_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_api_gateway.types.get_resource_request.GetResourceRequest]",
    ) -> AsyncOperationResponse["capo_api_gateway.types.resource.Resource"]:
        import capo_api_gateway._operations.backplane_control_service.get_resource

        (
            output,
            http_response,
        ) = await capo_api_gateway._operations.backplane_control_service.get_resource.async_get_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetResource")
    )
    input_: capo_api_gateway.types.get_resource_request.GetResourceRequest = {
        "rest_api_id": rest_api_id,
        "resource_id": resource_id,
    }
    if embed is not None:
        input_["embed"] = embed

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output