Skip to content

delete_endpoint_policy

delete_endpoint_policy(
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    endpoint_name: Optional[EndpointName] = None,
) -> DeleteEndpointPolicyResponse

Deletes the resource-based policy that is attached to an endpoint. After you delete the policy, other accounts can no longer send requests to the endpoint through an inference router. The endpoint continues to serve requests from your account. If the endpoint doesn't have a policy, the operation succeeds.

The change typically takes effect within 30 seconds, and can take up to 5 minutes. To revoke access for one account only, use PutEndpointPolicy to replace the policy with one that doesn't include that account.

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/sage_maker.py
def delete_endpoint_policy(
    self,
    *,
    config_overrides: Optional[SageMakerClientConfig] = None,
    endpoint_name: Optional[
        "capo_sagemaker.types.endpoint_name.EndpointName"
    ] = None,
) -> "capo_sagemaker.types.delete_endpoint_policy_response.DeleteEndpointPolicyResponse":
    """<p>Deletes the resource-based policy that is attached to an endpoint. After you delete the policy, other accounts can no longer send requests to the endpoint through an inference router. The endpoint continues to serve requests from your account. If the endpoint doesn't have a policy, the operation succeeds.</p> <p>The change typically takes effect within 30 seconds, and can take up to 5 minutes. To revoke access for one account only, use <a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_PutEndpointPolicy.html">PutEndpointPolicy</a> to replace the policy with one that doesn't include that account.</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.
    """

    def _handler(
        req: "OperationRequest[capo_sagemaker.types.delete_endpoint_policy_request.DeleteEndpointPolicyRequest]",
    ) -> OperationResponse[
        "capo_sagemaker.types.delete_endpoint_policy_response.DeleteEndpointPolicyResponse"
    ]:
        import capo_sagemaker._operations.sage_maker.delete_endpoint_policy

        output, http_response = (
            capo_sagemaker._operations.sage_maker.delete_endpoint_policy.delete_endpoint_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output