public void setTags(String tags) { List<String> nvPairs = asList(tags.split(",")); this.tags = nvPairs .stream() .map(this::extractNVPair) .map(mapEntry -> new Tag().withKey(mapEntry.getKey()).withValue(mapEntry.getValue())) .collect(Collectors.toList()); }
public static Collection<Tag> parseTags(InputStream is) throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode tree = mapper.readTree(is); ArrayNode jsonNodes = (ArrayNode) tree; return StreamSupport.stream(jsonNodes.spliterator(), false) .map(node -> { return new Tag() .withKey(node.get("Key").asText()) .withValue(node.get("Value").asText()); }) .collect(Collectors.toList()); } }
protected final Collection<Tag> getAwsTags(StepExecution stepExecution) { Collection<Tag> tagList = new ArrayList<>(); if (this.tags != null) { for (String tag : this.tags) { int i = tag.indexOf('='); if (i < 0) { throw new IllegalArgumentException("Missing = in tag " + tag); } String key = tag.substring(0, i); String value = tag.substring(i + 1); tagList.add(new Tag().withKey(key).withValue(value)); } } if (this.tagsFile != null) { FilePath tagsFile = loadFileFromWorkspace(stepExecution, this.tagsFile); try { tagList.addAll(TagsFileParser.parseTags(tagsFile.read())); } catch (IOException e) { throw new UncheckedIOException(e); } catch (InterruptedException e) { Thread.interrupted(); throw new RuntimeException(e); } } return tagList; }
/** * Allows you to add any number of nested preconfigured StackTag elements. * * @param stackTag * a preconfigured StackTag object. */ public void addConfiguredStackTag(StackTag stackTag) { tags.add(new Tag().withKey(stackTag.getKey()).withValue( stackTag.getValue())); }
.map(it -> new Tag() .withKey(it.getKey().toString()) .withValue(it.getValue().toString())) .collect(Collectors.toList())); task.conventionMapping("cfnTemplateUrl", () -> cfnExt.getTemplateURL()); .map(it -> new Tag() .withKey(it.getKey().toString()) .withValue(it.getValue().toString())) .collect(Collectors.toList())); task.conventionMapping("cfnTemplateUrl", () -> cfnExt.getTemplateURL());
stackRequest .withParameters(populatedExpectedParameters) .withTags(new Tag().withKey("Creator").withValue("testgrid-" + tgEnvironment));