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 value is the optional value of the tag. The string value can be from 1 to 256 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 value * A value is the optional value of the tag. The string value can be from 1 to 256 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 withValue(String value) { setValue(value); return this; }
/** * <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; }
/** * <p> * A value is the optional value of the tag. The string value can be from 1 to 256 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 value * A value is the optional value of the tag. The string value can be from 1 to 256 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 withValue(String value) { setValue(value); return this; }
/** * <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; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof Tag == false) return false; Tag other = (Tag) obj; if (other.getKey() == null ^ this.getKey() == null) return false; if (other.getKey() != null && other.getKey().equals(this.getKey()) == false) return false; if (other.getValue() == null ^ this.getValue() == null) return false; if (other.getValue() != null && other.getValue().equals(this.getValue()) == false) return false; return true; }
/** * * @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; } } /**
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getKey() != null) sb.append("Key: ").append(getKey()).append(","); if (getValue() != null) sb.append("Value: ").append(getValue()); sb.append("}"); return sb.toString(); }
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; } } } }
public Request<AddTagsToResourceRequest> marshall(AddTagsToResourceRequest addTagsToResourceRequest) { if (addTagsToResourceRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<AddTagsToResourceRequest> request = new DefaultRequest<AddTagsToResourceRequest>(addTagsToResourceRequest, "AmazonRDS"); request.addParameter("Action", "AddTagsToResource"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); if (addTagsToResourceRequest.getResourceName() != null) { request.addParameter("ResourceName", StringUtils.fromString(addTagsToResourceRequest.getResourceName())); } if (!addTagsToResourceRequest.getTags().isEmpty() || !((com.amazonaws.internal.SdkInternalList<Tag>) addTagsToResourceRequest.getTags()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<Tag> tagsList = (com.amazonaws.internal.SdkInternalList<Tag>) addTagsToResourceRequest.getTags(); int tagsListIndex = 1; for (Tag tagsListValue : tagsList) { if (tagsListValue.getKey() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey())); } if (tagsListValue.getValue() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue())); } tagsListIndex++; } } return request; }
public Request<CreateDBSnapshotRequest> marshall(CreateDBSnapshotRequest createDBSnapshotRequest) { if (createDBSnapshotRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateDBSnapshotRequest> request = new DefaultRequest<CreateDBSnapshotRequest>(createDBSnapshotRequest, "AmazonRDS"); request.addParameter("Action", "CreateDBSnapshot"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); if (createDBSnapshotRequest.getDBSnapshotIdentifier() != null) { request.addParameter("DBSnapshotIdentifier", StringUtils.fromString(createDBSnapshotRequest.getDBSnapshotIdentifier())); } if (createDBSnapshotRequest.getDBInstanceIdentifier() != null) { request.addParameter("DBInstanceIdentifier", StringUtils.fromString(createDBSnapshotRequest.getDBInstanceIdentifier())); } if (!createDBSnapshotRequest.getTags().isEmpty() || !((com.amazonaws.internal.SdkInternalList<Tag>) createDBSnapshotRequest.getTags()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<Tag> tagsList = (com.amazonaws.internal.SdkInternalList<Tag>) createDBSnapshotRequest.getTags(); int tagsListIndex = 1; for (Tag tagsListValue : tagsList) { if (tagsListValue.getKey() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey())); } if (tagsListValue.getValue() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue())); } tagsListIndex++; } } return request; }
public Request<CreateDBSecurityGroupRequest> marshall(CreateDBSecurityGroupRequest createDBSecurityGroupRequest) { if (createDBSecurityGroupRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateDBSecurityGroupRequest> request = new DefaultRequest<CreateDBSecurityGroupRequest>(createDBSecurityGroupRequest, "AmazonRDS"); request.addParameter("Action", "CreateDBSecurityGroup"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); if (createDBSecurityGroupRequest.getDBSecurityGroupName() != null) { request.addParameter("DBSecurityGroupName", StringUtils.fromString(createDBSecurityGroupRequest.getDBSecurityGroupName())); } if (createDBSecurityGroupRequest.getDBSecurityGroupDescription() != null) { request.addParameter("DBSecurityGroupDescription", StringUtils.fromString(createDBSecurityGroupRequest.getDBSecurityGroupDescription())); } if (!createDBSecurityGroupRequest.getTags().isEmpty() || !((com.amazonaws.internal.SdkInternalList<Tag>) createDBSecurityGroupRequest.getTags()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<Tag> tagsList = (com.amazonaws.internal.SdkInternalList<Tag>) createDBSecurityGroupRequest.getTags(); int tagsListIndex = 1; for (Tag tagsListValue : tagsList) { if (tagsListValue.getKey() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey())); } if (tagsListValue.getValue() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue())); } tagsListIndex++; } } return request; }
public Request<CreateDBClusterSnapshotRequest> marshall(CreateDBClusterSnapshotRequest createDBClusterSnapshotRequest) { if (createDBClusterSnapshotRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateDBClusterSnapshotRequest> request = new DefaultRequest<CreateDBClusterSnapshotRequest>(createDBClusterSnapshotRequest, "AmazonRDS"); request.addParameter("Action", "CreateDBClusterSnapshot"); request.addParameter("Version", "2014-10-31"); request.setHttpMethod(HttpMethodName.POST); if (createDBClusterSnapshotRequest.getDBClusterSnapshotIdentifier() != null) { request.addParameter("DBClusterSnapshotIdentifier", StringUtils.fromString(createDBClusterSnapshotRequest.getDBClusterSnapshotIdentifier())); } if (createDBClusterSnapshotRequest.getDBClusterIdentifier() != null) { request.addParameter("DBClusterIdentifier", StringUtils.fromString(createDBClusterSnapshotRequest.getDBClusterIdentifier())); } if (!createDBClusterSnapshotRequest.getTags().isEmpty() || !((com.amazonaws.internal.SdkInternalList<Tag>) createDBClusterSnapshotRequest.getTags()).isAutoConstruct()) { com.amazonaws.internal.SdkInternalList<Tag> tagsList = (com.amazonaws.internal.SdkInternalList<Tag>) createDBClusterSnapshotRequest.getTags(); int tagsListIndex = 1; for (Tag tagsListValue : tagsList) { if (tagsListValue.getKey() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Key", StringUtils.fromString(tagsListValue.getKey())); } if (tagsListValue.getValue() != null) { request.addParameter("Tags.Tag." + tagsListIndex + ".Value", StringUtils.fromString(tagsListValue.getValue())); } tagsListIndex++; } } return request; }