-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4aacb42
commit fc006f5
Showing
4 changed files
with
100 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
python/example_code/medical-imaging/tagging_data_stores.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
""" | ||
Purpose | ||
Shows how to use the AWS SDK for Python (Boto3) to tag AWS HealthImaging data stores. | ||
""" | ||
import boto3 | ||
from medical_imaging_basics import MedicalImagingWrapper | ||
|
||
|
||
def tagging_data_stores(medical_imaging_wrapper, data_store_arn): | ||
""" | ||
Taggging a data store. | ||
:param medical_imaging_wrapper: A MedicalImagingWrapper instance. | ||
:param data_store_arn: The Amazon Resource Name (ARN) of the data store. | ||
For example: arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012 | ||
""" | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_datastore.tag] | ||
medical_imaging_wrapper.tag_resource(data_store_arn, {"Deployment": "Development"}) | ||
# snippet-end:[python.example_code.medical-imaging.tagging_datastore.tag] | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_datastore.list] | ||
medical_imaging_wrapper.list_tags_for_resource(data_store_arn) | ||
# snippet-end:[python.example_code.medical-imaging.tagging_datastore.list] | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_datastore.untag] | ||
medical_imaging_wrapper.untag_resource(data_store_arn, ["Deployment"]) | ||
|
||
# snippet-end:[python.example_code.medical-imaging.tagging_datastore.untag] | ||
|
||
|
||
if __name__ == '__main__': | ||
# Replace this ARN with your own. | ||
# snippet-start:[python.example_code.medical-imaging.tagging_datastore.arn] | ||
a_data_store_arn = 'arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012' | ||
# snippet-end:[python.example_code.medical-imaging.tagging_datastore.arn] | ||
|
||
a_data_store_arn = input(f"Enter the ARN of the data store to tag: ") | ||
|
||
client = boto3.client('medical-imaging') | ||
a_medical_imaging_wrapper = MedicalImagingWrapper(client) | ||
|
||
tagging_data_stores(a_medical_imaging_wrapper, a_data_store_arn) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
""" | ||
Purpose | ||
Shows how to use the AWS SDK for Python (Boto3) to tag AWS HealthImaging image sets. | ||
""" | ||
import boto3 | ||
from medical_imaging_basics import MedicalImagingWrapper | ||
|
||
|
||
def tagging_image_sets(medical_imaging_wrapper, image_set_arn): | ||
""" | ||
Taggging an image set. | ||
:param medical_imaging_wrapper: A MedicalImagingWrapper instance. | ||
:param image_set_arn: The Amazon Resource Name (ARN) of the image set. | ||
For example: 'arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/' \ | ||
'imageset/12345678901234567890123456789012' | ||
""" | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_image_set.tag] | ||
medical_imaging_wrapper.tag_resource(image_set_arn, {"Deployment": "Development"}) | ||
# snippet-end:[python.example_code.medical-imaging.tagging_image_set.tag] | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_image_set.list] | ||
medical_imaging_wrapper.list_tags_for_resource(image_set_arn) | ||
# snippet-end:[python.example_code.medical-imaging.tagging_image_set.list] | ||
|
||
# snippet-start:[python.example_code.medical-imaging.tagging_image_set.untag] | ||
medical_imaging_wrapper.untag_resource(image_set_arn, ["Deployment"]) | ||
# snippet-end:[python.example_code.medical-imaging.tagging_image_set.untag] | ||
|
||
|
||
if __name__ == '__main__': | ||
# Replace this ARN with your own. | ||
# snippet-start:[python.example_code.medical-imaging.tagging_image_set.arn] | ||
an_image_set_arn = 'arn:aws:medical-imaging:us-east-1:123456789012:datastore/12345678901234567890123456789012/' \ | ||
'imageset/12345678901234567890123456789012' | ||
# snippet-end:[python.example_code.medical-imaging.tagging_image_set.arn] | ||
|
||
an_image_set_arn = input(f"Enter the ARN of the image set to tag: ") | ||
|
||
client = boto3.client('medical-imaging') | ||
a_medical_imaging_wrapper = MedicalImagingWrapper(client) | ||
|
||
tagging_image_sets(a_medical_imaging_wrapper, an_image_set_arn) |