Tagging S3 objects: configuring the components
Procedure
-
Double-click tS3Connection to open its Basic settings view.
- In the Access Key and Secret Key fields, enter the authentication credentials.
- Set the Region option.
-
Double-click tS3List to open its Basic settings view.
- Select the Use existing connection check box to reuse the connection.
- In the Bucket name field, enter the bucket name.
- In the Key prefix field, enter the prefix of the files to add the tag to ("file" in this example).
-
Double-click tJavaFlex to open its Basic settings view.
-
Copy-paste the following code into the Start
code field.
com.amazonaws.services.s3.AmazonS3Client s3Client = (com.amazonaws.services.s3.AmazonS3Client) globalMap .get("conn_tS3Connection_1"); List<Tag> myTags = new ArrayList<Tag>();
-
Copy-paste the following code into the Main
code field.
myTags.add(new Tag("Tag1", "Tag1 value")); s3Client.setObjectTagging(new SetObjectTaggingRequest("compdoc-bucket",((String)globalMap.get("tS3List_1_CURRENT_KEY")), new ObjectTagging(myTags)));
-
In the Advanced settings view,
copy-paste the following into the Import
field.
import com.amazonaws.AmazonServiceException; import com.amazonaws.SdkClientException; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.*; import java.io.File; import java.util.ArrayList; import java.util.List;
Information noteNote: For information about the code blocks in this step, see Managing Tags Using the AWS SDK for Java. -
Copy-paste the following code into the Start
code field.
- Double-click tS3Close and make sure tS3Connection_1 appears in the Component List drop-down list.
Did this page help you?
If you find any issues with this page or its content – a typo, a missing step, or a technical error – please let us know!