ユーザーの削除 - Amazon Rekognition

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

ユーザーの削除

DeleteUser オペレーションを使用すると、指定した UserID に基づいて、コレクションからユーザーを削除できます。UserID に関連付けられている顔は、指定した UserID が削除される前に UserID との関連付けが解除されることにご注意ください。

ユーザーを削除するには (SDK)
  1. まだ実行していない場合:

    1. AmazonRekognitionFullAccess アクセス許可を持つ IAM ユーザーアカウントを作成または更新します。詳細については、「ステップ 1: AWS アカウントを設定してユーザーを作成する」を参照してください。

    2. と AWS SDKs をインストール AWS CLI して設定します。詳細については、「ステップ 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 コマンドは、 CLI create-user オペレーションを使用してユーザーを削除します。

    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()