

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

# 리소스에 태그 지정
<a name="tag-resource"></a>

[https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_TagResource.html](https://docs.aws.amazon.com/healthimaging/latest/APIReference/API_TagResource.html) 작업을 사용하여 AWS HealthImaging의 [데이터 스토어](getting-started-concepts.md#concept-data-store) 및 [이미지 세트](getting-started-concepts.md#concept-image-set)에 태그를 지정합니다. 다음 코드 예제에서는 AWS Management Console AWS CLI, 및 AWS SDKs에서 `TagResource` 작업을 사용하는 방법을 설명합니다. 자세한 내용은 *AWS 일반 참조 가이드*의 [AWS 리소스 태그 지정을 참조하세요](https://docs.aws.amazon.com/tag-editor/latest/userguide/tagging.html).

**리소스에 태그 지정**  
AWS HealthImaging에 대한 액세스 기본 설정에 따라 메뉴를 선택합니다.

## AWS 콘솔
<a name="code-example-console-tag-resource"></a>

1. HealthImaging 콘솔 [데이터 스토어 페이지](https://console.aws.amazon.com/medical-imaging/home#/dataStores)를 엽니다.

1. 데이터 스토어를 선택합니다.

   **데이터 스토어 세부 정보** 페이지가 열립니다.

1. **세부 정보** 탭을 선택하십시오.

1. **태그** 섹션에서 **태그 관리**를 선택합니다.

   **태그 관리** 페이지가 열립니다.

1. **새 태그 추가**를 선택합니다.

1. **키**와 **값**(선택 사항)을 입력합니다.

1. **변경 사항 저장**을 선택합니다.

## AWS CLI 및 SDKs
<a name="code-example-cli-sdk-tag-resource"></a>

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

**AWS CLI**  
**예시 1: 데이터 스토어에 태그 지정**  
다음 `tag-resource` 코드 예시에서는 데이터 스토어에 태그를 지정합니다.  

```
aws medical-imaging tag-resource \
  --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012" \
  --tags '{"Deployment":"Development"}'
```
이 명령은 출력을 생성하지 않습니다.  
**예시 2: 이미지 세트에 태그 지정**  
다음 `tag-resource` 코드 예시에서는 이미지 세트에 태그를 지정합니다.  

```
aws medical-imaging tag-resource \
    --resource-arn "arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/imageset/18f88ac7870584f58d56256646b4d92b" \
    --tags '{"Deployment":"Development"}'
```
이 명령은 출력을 생성하지 않습니다.  
자세한 내용은 [AWS HealthImaging 개발자 안내서의 HealthImaging을 사용하여 리소스 태그 지정](https://docs.aws.amazon.com/healthimaging/latest/devguide/tagging.html)*AWS 을 참조하세요 HealthImaging*.  
+  API 세부 정보는 *AWS CLI 명령 참조*의 [TagResource](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/medical-imaging/tag-resource.html)를 참조하세요.

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

**SDK for Java 2.x**  

```
    public static void tagMedicalImagingResource(MedicalImagingClient medicalImagingClient,
            String resourceArn,
            Map<String, String> tags) {
        try {
            TagResourceRequest tagResourceRequest = TagResourceRequest.builder()
                    .resourceArn(resourceArn)
                    .tags(tags)
                    .build();

            medicalImagingClient.tagResource(tagResourceRequest);

            System.out.println("Tags have been added to the resource.");
        } catch (MedicalImagingException e) {
            System.err.println(e.awsErrorDetails().errorMessage());
            System.exit(1);
        }
    }
```
+  API 세부 정보는 *AWS SDK for Java 2.x API 참조*의 [TagResource](https://docs.aws.amazon.com/goto/SdkForJavaV2/medical-imaging-2023-07-19/TagResource)를 참조하세요.
 GitHub에 더 많은 내용이 있습니다. [AWS 코드 예 리포지토리](https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/javav2/example_code/medicalimaging#code-examples)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

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

**SDK for JavaScript(v3)**  

```
import { TagResourceCommand } 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 {Record<string,string>} tags - The tags to add to the resource as JSON.
 *                     - For example: {"Deployment" : "Development"}
 */
export const tagResource = async (
  resourceArn = "arn:aws:medical-imaging:us-east-1:xxxxxx:datastore/xxxxx/imageset/xxx",
  tags = {},
) => {
  const response = await medicalImagingClient.send(
    new TagResourceCommand({ resourceArn: resourceArn, tags: tags }),
  );
  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 참조*의 [TagResource](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/medical-imaging/command/TagResourceCommand)를 참조하세요.
 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 tag_resource(self, resource_arn, tags):
        """
        Tag a resource.

        :param resource_arn: The ARN of the resource.
        :param tags: The tags to apply.
        """
        try:
            self.health_imaging_client.tag_resource(resourceArn=resource_arn, tags=tags)
        except ClientError as err:
            logger.error(
                "Couldn't tag 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 참조*의 [TagResource](https://docs.aws.amazon.com/goto/boto3/medical-imaging-2023-07-19/TagResource)를 참조하세요.
 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 API**  

```
    TRY.
        " iv_resource_arn = 'arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012'
        lo_mig->tagresource(
          iv_resourcearn = iv_resource_arn
          it_tags = it_tags ).
        MESSAGE 'Resource tagged 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 ABAP API 참조의 *[TagResource](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)에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요.

------

**예제 가용성**  
필요한 예제를 찾을 수 없습니까? 이 페이지의 오른쪽 사이드바에 있는 **피드백 제공** 링크를 사용하여 코드 예제를 요청합니다.