def readTag()

in app/com/gu/viewer/aws/AwsInstanceTags.scala [14:25]


  def readTag(tagName: String) = {
    instanceId.flatMap { id =>
      val tagsResult = ec2.describeTags(
        new DescribeTagsRequest().withFilters(
          new Filter("resource-type").withValues("instance"),
          new Filter("resource-id").withValues(id),
          new Filter("key").withValues(tagName)
        )
      )
      tagsResult.getTags.asScala.find(_.getKey == tagName).map(_.getValue)
    }
  }