Skip to content

get_policy async

get_policy(
    profiling_group_name: ProfilingGroupName,
    *,
    config_overrides: Optional[AsyncCodeGuruProfilerClientConfig] = None,
) -> GetPolicyResponse

Returns the JSON-formatted resource-based policy on a profiling group.

Parameters:

Raises:

Source code in docs_src/capo_codeguruprofiler/_services/async_code_guru_profiler.py
async def get_policy(
    self,
    profiling_group_name: "capo_codeguruprofiler.types.profiling_group_name.ProfilingGroupName",
    *,
    config_overrides: Optional[AsyncCodeGuruProfilerClientConfig] = None,
) -> "capo_codeguruprofiler.types.get_policy_response.GetPolicyResponse":
    """<p> Returns the JSON-formatted resource-based policy on a profiling group. </p>

    Args:
        profiling_group_name: <p>The name of the profiling group.</p>

    Raises:
        capo_codeguruprofiler.errors.internal_server_exception.InternalServerException: <p>The server encountered an internal error and is unable to complete the request.</p>
        capo_codeguruprofiler.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request does not exist.</p>
        capo_codeguruprofiler.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_codeguruprofiler.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_codeguruprofiler.types.get_policy_request.GetPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_codeguruprofiler.types.get_policy_response.GetPolicyResponse"
    ]:
        import capo_codeguruprofiler._operations.code_guru_profiler.get_policy

        (
            output,
            http_response,
        ) = await capo_codeguruprofiler._operations.code_guru_profiler.get_policy.async_get_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetPolicy")
    )
    input_: capo_codeguruprofiler.types.get_policy_request.GetPolicyRequest = {
        "profiling_group_name": profiling_group_name
    }

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