/** * <p> * The value for the resource tag. * </p> * * @param value * The value for the resource tag. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withValue(String value) { setValue(value); return this; }
public Tag unmarshall(StaxUnmarshallerContext context) throws Exception { Tag tag = new Tag(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return tag; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Key", targetDepth)) { tag.setKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { tag.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return tag; } } } }
/** * <p> * The value for the resource tag. * </p> * * @param value * The value for the resource tag. * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withValue(String value) { setValue(value); return this; }
/** * * @param resourceId * @param clientMap * @param pacTag * @return */ private Boolean setRedshiftTag(final String resourceId, final Map<String, Object> clientMap, Map<String, String> pacTag) { com.amazonaws.services.redshift.model.Tag tag = new com.amazonaws.services.redshift.model.Tag(); for (Map.Entry<String, String> tags : pacTag.entrySet()) { tag.setKey(tags.getKey()); tag.setValue(tags.getValue()); } AmazonRedshift amazonRedshift = (AmazonRedshift) clientMap .get("client"); com.amazonaws.services.redshift.model.CreateTagsRequest createTagsRequest = new com.amazonaws.services.redshift.model.CreateTagsRequest(); createTagsRequest.setResourceName(resourceId); createTagsRequest.setTags(Arrays.asList(tag)); try { amazonRedshift.createTags(createTagsRequest); return Boolean.TRUE; } catch (AmazonServiceException ase) { logger.error("error tagging redshift - > " + resourceId, ase); throw ase; } }
public Tag unmarshall(StaxUnmarshallerContext context) throws Exception { Tag tag = new Tag(); int originalDepth = context.getCurrentDepth(); int targetDepth = originalDepth + 1; if (context.isStartOfDocument()) targetDepth += 1; while (true) { XMLEvent xmlEvent = context.nextEvent(); if (xmlEvent.isEndDocument()) return tag; if (xmlEvent.isAttribute() || xmlEvent.isStartElement()) { if (context.testExpression("Key", targetDepth)) { tag.setKey(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } if (context.testExpression("Value", targetDepth)) { tag.setValue(StringStaxUnmarshaller.getInstance().unmarshall(context)); continue; } } else if (xmlEvent.isEndElement()) { if (context.getCurrentDepth() < originalDepth) { return tag; } } } }