Skip to content

delete_project_policy

delete_project_policy(
    project_arn: ProjectArn,
    policy_name: ProjectPolicyName,
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    policy_revision_id: Optional[ProjectPolicyRevisionId] = None,
) -> DeleteProjectPolicyResponse

This operation applies only to Amazon Rekognition Custom Labels.

Deletes an existing project policy.

To get a list of project policies attached to a project, call ListProjectPolicies. To attach a project policy to a project, call PutProjectPolicy.

This operation requires permissions to perform the rekognition:DeleteProjectPolicy action.

Parameters:

  • project_arn (ProjectArn) –

    The Amazon Resource Name (ARN) of the project that the project policy you want to delete is attached to.

  • policy_name (ProjectPolicyName) –

    The name of the policy that you want to delete.

  • policy_revision_id (Optional[ProjectPolicyRevisionId], default: None ) –

    The ID of the project policy revision that you want to delete.

Raises:

Examples:

DeleteProjectPolicy This operation deletes a revision of an existing project policy from an Amazon Rekognition Custom Labels project.

>>> client.delete_project_policy(project_arn='arn:aws:rekognition:us-east-1:111122223333:project/SourceProject/1656557123456', policy_name='testPolicy1', policy_revision_id='3b274c25e9203a56a99e00e3ff205fbc')
Source code in docs_src/capo_rekognition/_services/rekognition.py
def delete_project_policy(
    self,
    project_arn: "capo_rekognition.types.project_arn.ProjectArn",
    policy_name: "capo_rekognition.types.project_policy_name.ProjectPolicyName",
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    policy_revision_id: Optional[
        "capo_rekognition.types.project_policy_revision_id.ProjectPolicyRevisionId"
    ] = None,
) -> "capo_rekognition.types.delete_project_policy_response.DeleteProjectPolicyResponse":
    """<note> <p>This operation applies only to Amazon Rekognition Custom Labels.</p> </note> <p>Deletes an existing project policy.</p> <p>To get a list of project policies attached to a project, call <a>ListProjectPolicies</a>. To attach a project policy to a project, call <a>PutProjectPolicy</a>.</p> <p>This operation requires permissions to perform the <code>rekognition:DeleteProjectPolicy</code> action.</p>

    Args:
        project_arn: <p>The Amazon Resource Name (ARN) of the project that the project policy you want to delete is attached to.</p>
        policy_name: <p>The name of the policy that you want to delete.</p>
        policy_revision_id: <p>The ID of the project policy revision that you want to delete.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.invalid_policy_revision_id_exception.InvalidPolicyRevisionIdException: <p>The supplied revision id for the project policy is invalid.</p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        DeleteProjectPolicy
        This operation deletes a revision of an existing project policy from an Amazon Rekognition Custom Labels project.

        >>> client.delete_project_policy(project_arn='arn:aws:rekognition:us-east-1:111122223333:project/SourceProject/1656557123456', policy_name='testPolicy1', policy_revision_id='3b274c25e9203a56a99e00e3ff205fbc')
    """

    def _handler(
        req: "OperationRequest[capo_rekognition.types.delete_project_policy_request.DeleteProjectPolicyRequest]",
    ) -> OperationResponse[
        "capo_rekognition.types.delete_project_policy_response.DeleteProjectPolicyResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.delete_project_policy

        output, http_response = (
            capo_rekognition._operations.rekognition_service.delete_project_policy.delete_project_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteProjectPolicy")
    )
    input_: capo_rekognition.types.delete_project_policy_request.DeleteProjectPolicyRequest = {
        "project_arn": project_arn,
        "policy_name": policy_name,
    }
    if policy_revision_id is not None:
        input_["policy_revision_id"] = policy_revision_id

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