Example usage for com.amazonaws.services.route53.model GetChangeRequest getId

List of usage examples for com.amazonaws.services.route53.model GetChangeRequest getId

Introduction

In this page you can find the example usage for com.amazonaws.services.route53.model GetChangeRequest getId.

Prototype


public String getId() 

Source Link

Document

The ID of the change batch request.

Usage

From source file:com.msi.dns53.client.DNS53Client.java

License:Apache License

public GetChangeResult getChange(GetChangeRequest req) throws AmazonServiceException, AmazonClientException {
    Client c = Client.create();/*from w w  w .ja va2 s .  c om*/
    WebResource r = c.resource(this.changeURL);
    String resultXml = r.path(req.getId()).type(MediaType.APPLICATION_XML_TYPE).accept(MediaType.TEXT_XML)
            .header("X-Amzn-Authorization",
                    "AWS3 AWSAccessKeyId=" + this.accessKey + "," + "Algorithm=HmacSHA256,"
                            + "SignedHeaders=Host;X-Amz-Date," + "Signature=THISISANEXAMPLESIGNATURE=")
            .get(String.class);

    GetChangeResponsePOJO interResult = null;
    try {
        StringReader reader = new StringReader(resultXml);
        JAXBContext context = JAXBContext.newInstance(GetChangeResponsePOJO.class);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        interResult = (GetChangeResponsePOJO) unmarshaller.unmarshal(reader);
    } catch (JAXBException e) {
        e.printStackTrace();
        return null;
    }
    if (interResult == null) {
        return null;
    }

    GetChangeResult result = new GetChangeResult();
    if (interResult.getChangeInfo() != null) {
        ChangeInfo ci = new ChangeInfo();
        ci.setComment(interResult.getChangeInfo().getComment());
        ci.setId(interResult.getChangeInfo().getId());
        ci.setStatus(interResult.getChangeInfo().getStatus());
        ci.setSubmittedAt(interResult.getChangeInfo().getSubmittedAt());
        result.setChangeInfo(ci);
    }
    return result;
}

From source file:com.msi.dns53.server.query.GetChange.java

License:Apache License

private GetChangeResult getChange(GetChangeRequest request) throws ErrorResponse {
    AccessMySQL sqlaccess = AccessMySQL.getInstance();
    GetChangeResult result = new GetChangeResult();

    String[] changeRecord = sqlaccess.getChange(request.getId());
    if (changeRecord[0] == null) { //result empty -> changeID not existing -> AccessDenied
        throw DNS53Faults.NoSuchChange(request.getId());
    }/*from  w w  w. ja v  a  2s.  c o  m*/

    ChangeInfo ci = new ChangeInfo();
    ci.setId(changeRecord[0]);
    ci.setStatus(changeRecord[1]);
    String date = changeRecord[2];
    Date submittedAt = new Date(date);
    ci.setSubmittedAt(submittedAt);

    result.setChangeInfo(ci);

    return result;
}