사용자 삭제 - Amazon Rekognition

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

사용자 삭제

DeleteUser 작업을 사용하여 제공된 UserID를 기반으로 컬렉션에서 사용자를 삭제할 수 있습니다. UserID와 연결된 모든 얼굴은 해당 UserID가 삭제되기 전에 UserID와의 연결이 해제된다는 점에 유의하십시오.

사용자를 삭제하려면(SDK)
  1. 아직 설정하지 않았다면 다음과 같이 하세요.

    1. AmazonRekognitionFullAccess 권한이 있는 IAM 사용자 계정을 생성하거나 업데이트합니다. 자세한 내용은 1단계: AWS 계정 설정 및 사용자 생성 단원을 참조하십시오.

    2. AWS CLI 및 AWS SDKs를 설치하고 구성합니다. 자세한 내용은 2단계: AWS CLI 및 AWS SDKs 설정 단원을 참조하십시오.

  2. 다음 예제를 사용하여 DeleteUser 작업을 호출합니다.

    Java

    이 Java 코드 예제는 사용자를 삭제합니다.

    import com.amazonaws.services.rekognition.AmazonRekognition; import com.amazonaws.services.rekognition.AmazonRekognitionClientBuilder; import com.amazonaws.services.rekognition.model.DeleteUserRequest; import com.amazonaws.services.rekognition.model.DeleteUserResult; public class DeleteUser { public static void main(String[] args) throws Exception { AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient(); //Replace collectionId and userId with the name of the user that you want to delete from that target collection. String collectionId = "MyCollection"; String userId = "demoUser"; System.out.println("Deleting existing user: " + userId); DeleteUserRequest request = new DeleteUserRequest() .withCollectionId(collectionId) .withUserId(userId); rekognitionClient.deleteUser(request); } }
    AWS CLI

    이 AWS CLI 명령은 create-user CLI 작업을 사용하여 사용자를 삭제합니다.

    aws rekognition delete-user --collection-id MyCollection --user-id user-id --collection-id collection-name --region region-name
    Python

    이 Python 코드 예제는 사용자를 삭제합니다.

    # Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # PDX-License-Identifier: MIT-0 (For details, see https://github.com/awsdocs/amazon-rekognition-developer-guide/blob/master/LICENSE-SAMPLECODE.) import boto3 from botocore.exceptions import ClientError import logging logger = logging.getLogger(__name__) session = boto3.Session(profile_name='profile-name') client = session.client('rekognition') def delete_user(collection_id, user_id): """ Delete the user from the given collection :param collection_id: The ID of the collection where user is stored. :param user_id: The ID of the user in the collection to delete. """ logger.info(f'Deleting user: {collection_id}, {user_id}') try: client.delete_user( CollectionId=collection_id, UserId=user_id ) except ClientError: logger.exception(f'Failed to delete user with given user id: {user_id}') raise def main(): collection_id = "collection-id" user_id = "user-id" delete_user(collection_id, user_id) if __name__ == "__main__": main()