

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

# リソースのタグを削除します


[https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_UntagResource.html](https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_UntagResource.html) アクションを使用して、AWS HealthImaging [のデータストア](getting-started-concepts.md#concept-data-store)と[イメージセット](getting-started-concepts.md#concept-image-set)のタグを解除します。次のコード例は、 AWS マネジメントコンソール、 AWS CLI、および AWS SDKs で `UntagResource`アクションを使用する方法を示しています。詳細については、[「 ガイド」の AWS 「 リソースのタグ付け](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html)」を参照してください。 *AWS 全般のリファレンス *

**リソースのタグを削除するには**  
AWS HealthImaging のアクセス設定に基づいてメニューを選択します。

## AWS コンソール


1. HealthImaging コンソールの[データストアページ](https://console.aws.amazon.com/medical-imaging/home#/dataStores)を開きます。

1. データストアを選択します。

   **[データストアの詳細]** ページが開きます。

1. **詳細** タブを選択します。

1. **[タグ]** セクションで、**[タグの管理]** を選択します。

   **[タグの管理]** ページが開きます。

1. 削除するタグの横にある **[削除]** を選択します。

1. **[Save changes]** (変更の保存) をクリックします。

## AWS CLI および SDKs


------
#### [ CLI ]

**AWS CLI**  
**例 1：データストアのタグを削除するには**  
次の `untag-resource` コード例では、データストアにタグを削除します。  

```
aws medical-imaging untag-resource \
    --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012" \
    --tag-keys '["Deployment"]'
```
このコマンドでは何も出力されません。  
**例 2：画像セットにタグを削除するには**  
次の `untag-resource` コード例では、画像セットにタグを削除します。  

```
aws medical-imaging untag-resource \
    --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/18f88ac7870584f58d56256646b4d92b" \
    --tag-keys '["Deployment"]'
```
このコマンドでは何も出力されません。  
詳細については、[AWS HealthImaging デベロッパーガイドの「HealthImaging を使用したリソースのタグ付け](https://docs.aws.amazon.com/healthimaging/latest/devguide/tagging.html)*AWS HealthImaging*」を参照してください。  
+  API の詳細については、「AWS CLI Command Reference」の「[UntagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/medical-imaging/untag-resource.html)」を参照してください。

------
#### [ Java ]

**SDK for Java 2.x**  

```
    public static void untagMedicalImagingResource(MedicalImagingClient medicalImagingClient,
            String resourceArn,
            Collection<String> tagKeys) {
        try {
            UntagResourceRequest untagResourceRequest = UntagResourceRequest.builder()
                    .resourceArn(resourceArn)
                    .tagKeys(tagKeys)
                    .build();

            medicalImagingClient.untagResource(untagResourceRequest);

            System.out.println("Tags have been removed from the resource.");
        } catch (MedicalImagingException e) {
            System.err.println(e.awsErrorDetails().errorMessage());
            System.exit(1);
        }
    }
```
+  API の詳細については、「*AWS SDK for Java 2.x API リファレンス*」の「[UntagResource](https://docs.aws.amazon.com/goto/SdkForJavaV2/medical-imaging-2023-07-19/UntagResource)」を参照してください。
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/medicalimaging#code-examples)での設定と実行の方法を確認してください。

------
#### [ JavaScript ]

**SDK for JavaScript (v3)**  

```
import { UntagResourceCommand } from "@aws-sdk/client-medical-imaging";
import { medicalImagingClient } from "../libs/medicalImagingClient.js";

/**
 * @param {string} resourceArn - The Amazon Resource Name (ARN) for the data store or image set.
 * @param {string[]} tagKeys - The keys of the tags to remove.
 */
export const untagResource = async (
  resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx",
  tagKeys = [],
) => {
  const response = await medicalImagingClient.send(
    new UntagResourceCommand({ resourceArn: resourceArn, tagKeys: tagKeys }),
  );
  console.log(response);
  // {
  //     '$metadata': {
  //        httpStatusCode: 204,
  //         requestId: '8a6de9a3-ec8e-47ef-8643-473518b19d45',
  //         extendedRequestId: undefined,
  //         cfId: undefined,
  //         attempts: 1,
  //         totalRetryDelay: 0
  //    }
  // }

  return response;
};
```
+  API の詳細については、「*AWS SDK for JavaScript API リファレンス*」の「[UntagResource](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/medical-imaging/command/UntagResourceCommand)」を参照してください。
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javascriptv3/example_code/medical-imaging#code-examples)での設定と実行の方法を確認してください。

------
#### [ Python ]

**SDK for Python (Boto3)**  

```
class MedicalImagingWrapper:
    def __init__(self, health_imaging_client):
        self.health_imaging_client = health_imaging_client


    def untag_resource(self, resource_arn, tag_keys):
        """
        Untag a resource.

        :param resource_arn: The ARN of the resource.
        :param tag_keys: The tag keys to remove.
        """
        try:
            self.health_imaging_client.untag_resource(
                resourceArn=resource_arn, tagKeys=tag_keys
            )
        except ClientError as err:
            logger.error(
                "Couldn't untag resource. Here's why: %s: %s",
                err.response["Error"]["Code"],
                err.response["Error"]["Message"],
            )
            raise
```
次のコードは MedicalImagingWrapper オブジェクトをインスタンス化します。  

```
    client = boto3.client("medical-imaging")
    medical_imaging_wrapper = MedicalImagingWrapper(client)
```
+  API の詳細については、*AWS  SDK for Python (Boto3) API リファレンス*の「[UntagResource](https://docs.aws.amazon.com/goto/boto3/medical-imaging-2023-07-19/UntagResource)」を参照してください。
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/python/example_code/medical-imaging#code-examples)での設定と実行の方法を確認してください。

------
#### [ SAP ABAP ]

**SDK for SAP ABAP**  

```
    TRY.
        " iv_resource_arn = 'arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012'
        lo_mig->untagresource(
          iv_resourcearn = iv_resource_arn
          it_tagkeys = it_tag_keys ).
        MESSAGE 'Resource untagged successfully.' TYPE 'I'.
      CATCH /aws1/cx_migaccessdeniedex.
        MESSAGE 'Access denied.' TYPE 'I'.
      CATCH /aws1/cx_miginternalserverex.
        MESSAGE 'Internal server error.' TYPE 'I'.
      CATCH /aws1/cx_migresourcenotfoundex.
        MESSAGE 'Resource not found.' TYPE 'I'.
      CATCH /aws1/cx_migthrottlingex.
        MESSAGE 'Request throttled.' TYPE 'I'.
      CATCH /aws1/cx_migvalidationex.
        MESSAGE 'Validation error.' TYPE 'I'.
    ENDTRY.
```
+  API の詳細については、 *AWS SDK for SAP* [UntagResource](https://docs.aws.amazon.com/sdk-for-sap-abap/v1/api/latest/index.html)」を参照してください。
 GitHub には、その他のリソースもあります。用例一覧を検索し、[AWS コード例リポジトリ](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/sap-abap/services/mig#code-examples)での設定と実行の方法を確認してください。

------

**可用性の例**  
必要なものが見つからなかった場合。このページの右側サイドバーにある**フィードバックを提供する**リンクを使用して、コード例をリクエストします。