Skip to content

get_endpoint_policy async

get_endpoint_policy(
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    endpoint_name: Optional[EndpointName] = None,
) -> GetEndpointPolicyResponse

Returns the resource-based policy that is attached to an endpoint. If the endpoint doesn't have a policy, you get a ValidationException.

Parameters:

  • endpoint_name (Optional[EndpointName], default: None ) –

    The name of the endpoint. The endpoint must be in your account and in the current Amazon Web Services Region.

Raises:

Source code in docs_src/capo_sagemaker/_services/async_sage_maker.py
async def get_endpoint_policy(
    self,
    *,
    config_overrides: Optional[AsyncSageMakerClientConfig] = None,
    endpoint_name: Optional[
        "capo_sagemaker.types.endpoint_name.EndpointName"
    ] = None,
) -> "capo_sagemaker.types.get_endpoint_policy_response.GetEndpointPolicyResponse":
    """<p>Returns the resource-based policy that is attached to an endpoint. If the endpoint doesn't have a policy, you get a <code>ValidationException</code>.</p>

    Args:
        endpoint_name: <p>The name of the endpoint. The endpoint must be in your account and in the current Amazon Web Services Region.</p>

    Raises:
        capo_sagemaker.errors.resource_not_found.ResourceNotFound: <p>Resource being access is not found.</p>
        capo_sagemaker.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sagemaker.types.get_endpoint_policy_request.GetEndpointPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_sagemaker.types.get_endpoint_policy_response.GetEndpointPolicyResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.get_endpoint_policy

        (
            output,
            http_response,
        ) = await capo_sagemaker._operations.sage_maker.get_endpoint_policy.async_get_endpoint_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetEndpointPolicy")
    )
    input_: capo_sagemaker.types.get_endpoint_policy_request.GetEndpointPolicyRequest = {}
    if endpoint_name is not None:
        input_["endpoint_name"] = endpoint_name

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