Example usage for com.amazonaws.services.route53.model GetChangeResult setChangeInfo

List of usage examples for com.amazonaws.services.route53.model GetChangeResult setChangeInfo

Introduction

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

Prototype


public void setChangeInfo(ChangeInfo changeInfo) 

Source Link

Document

A complex type that contains information about the specified change batch.

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   www  .jav a2s. 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. j av 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;
}