This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2013-04-01/"> | |
<ChangeBatch> | |
<Changes> | |
<Change> | |
<Action>{attXmlConfigAction}</Action> | |
<ResourceRecordSet> | |
<Name>{attXmlConfigRecord}</Name> | |
<Type>{attXmlConfigType}</Type> | |
<TTL>{attXmlConfigTtl}</TTL> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dateStr; | |
var chars = [":","-"]; | |
for (var i = 0; i < chars.length;i++) { | |
while (inDate.indexOf(chars[i]) !== -1) { | |
inDate = inDate.replace(chars[i],""); | |
} | |
} | |
dateStr = inDate.split(".")[0] + "Z"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var kDate = CryptoDigest.hmacSha256(CryptoEncoding.base64Encode("AWS4" + inSecretKey), CryptoEncoding.base64Encode(inAmzAuthDate)); | |
var kRegion = CryptoDigest.hmacSha256(kDate, CryptoEncoding.base64Encode(inRegion)); | |
var kService = CryptoDigest.hmacSha256(kRegion, CryptoEncoding.base64Encode(inService)); | |
var kSigning = CryptoDigest.hmacSha256(kService, CryptoEncoding.base64Encode("aws4_request")); | |
var keySigning = CryptoEncoding.base64toHex(kSigning); | |
return keySigning; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Define XML properties | |
var xmlDetail = new Properties(); | |
xmlDetail.put("{attXmlConfigAction}",inAction); | |
xmlDetail.put("{attXmlConfigRecord}",inRecord); | |
xmlDetail.put("{attXmlConfigType}",inType); | |
xmlDetail.put("{attXmlConfigTtl}",inTtl); | |
xmlDetail.put("{attXmlConfigValue}",inValue); | |
//Replace placeholders in XML file with correct values | |
var attBody = attXmlConfigBody.getContentAsMimeAttachment().content; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Hash the payload | |
attHashedPayload = CryptoEncoding.base64toHex(CryptoDigest.sha256(attBody)); | |
// Format the date | |
attAmzDate = System.getModule("com.hobbitcloud.aws.date").getAmzDate(new Date().toISOString()); | |
var canonicalUri = "/2013-04-01/hostedzone/" + attHostedZone + "/rrset"; | |
var canonicalQueryString = ""; | |
var canonicalHeaders = 'host:' + attUrl + '\n' + | |
'x-amz-content-sha256:' + attHashedPayload + '\n' + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Format the auth date | |
attAmzAuthDate = attAmzDate.split("T")[0]; | |
// Define string to sign | |
attStringToSign = 'AWS4-HMAC-SHA256\n' + attAmzDate + '\n' + attAmzAuthDate + '/' + attRegion + '/' + attService + '/aws4_request\n'+ attCanonicalRequestHash; | |
System.log("The string to sign is: " + '\n' + '\n' + attStringToSign + '\n'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the signing key in base64 | |
var kSigningB64 = CryptoEncoding.hexToBase64(attSigningKey); | |
System.log("The signing key in base64 is: " + kSigningB64); | |
// Define the string to sign in base 64 | |
var stringToSignB64 = CryptoEncoding.base64Encode(attStringToSign); | |
System.log("The string to sign in base64 is: " + stringToSignB64); | |
// Calculate the signature | |
var signature = CryptoDigest.hmacSha256(kSigningB64, stringToSignB64); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Define the authentication header string | |
attAuthString = 'AWS4-HMAC-SHA256 Credential=' + attAccessKey + '/' + attAmzAuthDate + '/' + attRegion + '/' + attService + '/aws4_request, SignedHeaders=' + attSignedHeaders + ', Signature=' + attSignature; | |
System.log("Auth string is: " + attAuthString); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Compute the full URL | |
var requestUrlString = "/2013-04-01/hostedzone/" + attHostedZone + "/rrset"; | |
var request = attRestHost.createRequest("POST", requestUrlString, attBody); | |
//Set the authentication header | |
request.setHeader("Authorization", attAuthString); | |
request.setHeader("X-Amz-Content-Sha256", attHashedPayload); | |
request.setHeader("X-Amz-Date", attAmzDate); | |
//Execute the request and get the response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"vcenter": "{{env `packer_vcenter`}}", | |
"vcenterUser": "{{env `packer_vcenterUser`}}", | |
"vcenterPass": "{{env `packer_vcenterPass`}}", | |
"vmName": "{{env `packer_vmName`}}", | |
"cluster": "{{env `packer_cluster`}}", | |
"datastore": "{{env `packer_datastore`}}", | |
"datastore_iso": "{{env `packer_datastoreISO`}}", | |
"network": "{{env `packer_network`}}", |