/** * <p> * A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and * can't be prefixed with "aws:" or "rds:". The string can only contain only the set of Unicode letters, digits, * white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$"). * </p> * * @param key * A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length * and can't be prefixed with "aws:" or "rds:". The string can only contain only the set of Unicode letters, * digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$"). * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); 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> * A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and * can't be prefixed with "aws:" or "rds:". The string can only contain only the set of Unicode letters, digits, * white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$"). * </p> * * @param key * A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length * and can't be prefixed with "aws:" or "rds:". The string can only contain only the set of Unicode letters, * digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: "^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-]*)$"). * @return Returns a reference to this object so that method calls can be chained together. */ public Tag withKey(String key) { setKey(key); return this; }
/** * * @param resourceId * @param clientMap * @param pacTag * @return */ private Boolean setRDSDBTag(final String resourceId, final Map<String, Object> clientMap, Map<String, String> pacTag ) { AmazonRDS rdsClient = (AmazonRDS) clientMap.get("client"); com.amazonaws.services.rds.model.Tag tag = new com.amazonaws.services.rds.model.Tag(); for(Map.Entry<String, String> tags : pacTag.entrySet()){ tag.setKey(tags.getKey()); tag.setValue(tags.getValue()); } AddTagsToResourceRequest request = new AddTagsToResourceRequest().withResourceName(resourceId); request.setTags(Arrays.asList(tag)); try { AddTagsToResourceResult response = rdsClient.addTagsToResource(request); return Boolean.TRUE; } catch (AmazonServiceException ase) { logger.error("error tagging rds - > " + 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; } } } }