def readTag()

in migrator/src/main/scala/com/gu/pathmanager/MigrationAWS.scala [27:38]


  def readTag(tagName: String) = {
    instanceId.flatMap { id =>
      val tagsResult = MigrationAWS.EC2Client.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)
    }
  }