Im trying to pull the latest image tag from the AWS ECR repo using AWS SDK
Im trying to write below code from the documentation and the google search
public class AwsECRTest {
public static void main(String[] args) {
// TODO Auto-generated method stub
ListTagsForResourceRequest request = new ListTagsForResourceRequest();
request.setResourceArn("arn:aws:ecr:us-east-1:45454512:repository/testrty");
ListTagsForResourceResult r(ListTagsForResourceRequest request);
System.out.println(r.getTags());
}
}
getting below error
Syntax error on token "ListTagsForResourceResult", record expected
not sure , how to pass the request object to ListTagsForResourceResult
please help / suggest
this is the doc link : https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-ecr/src/main/java/com/amazonaws/services/ecr/AmazonECR.java
You're trying to create an object
rof typeListTagsForResourceResultand call a methodr()simultaneously, unfortunately that's not going to work in Java.The
ListTagsForResourceResultobject should be returned from a method call from an instance of theAmazonECRclient, so iou'll need to set up anAmazonECRto interact with your ECR repository first, and then call thelistTagsForResource()method on the client with your request as an argument: