Skip to content

Commit

Permalink
fix(delete-record): removing the ommitting of required parameters fro…
Browse files Browse the repository at this point in the history
…m DELETE record (#16)
  • Loading branch information
Garethp authored May 8, 2021
1 parent dad80d1 commit af62caa
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
32 changes: 11 additions & 21 deletions lambda-packages/dns-validated-domain-identity-handler/src/record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,16 @@ export class Record {
) {}

public action(type: "CREATE" | "UPSERT" | "DELETE"): Change {
if (type === "DELETE") {
return {
Action: "DELETE",
ResourceRecordSet: {
Name: this.name,
Type: this.type,
},
};
} else {
return {
Action: type,
ResourceRecordSet: {
Name: this.name,
Type: this.type,
ResourceRecords: [{
Value: this.value,
}],
TTL: this.ttl,
},
};
}
return {
Action: type,
ResourceRecordSet: {
Name: this.name,
Type: this.type,
ResourceRecords: [{
Value: this.value,
}],
TTL: this.ttl,
},
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ describe(Record.name, () => {
ResourceRecordSet: {
Name: "example.com",
Type: "CNAME",
TTL: 1234,
ResourceRecords: [
{ Value: "target.example.com" },
],
},
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ describe(Verifier.name, () => {
ResourceRecordSet: {
Name: "_amazonses.example.com",
Type: "TXT",
TTL: 1800,
ResourceRecords: [
{ Value: "\"token\"" },
],
},
}],
},
Expand Down Expand Up @@ -395,18 +399,30 @@ describe(Verifier.name, () => {
ResourceRecordSet: {
Name: "foo._domainkey.example.com",
Type: "CNAME",
TTL: 1800,
ResourceRecords: [
{ Value: "foo.dkim.amazonses.com"},
],
},
}, {
Action: "DELETE",
ResourceRecordSet: {
Name: "bar._domainkey.example.com",
Type: "CNAME",
TTL: 1800,
ResourceRecords: [
{ Value: "bar.dkim.amazonses.com"},
],
},
}, {
Action: "DELETE",
ResourceRecordSet: {
Name: "baz._domainkey.example.com",
Type: "CNAME",
TTL: 1800,
ResourceRecords: [
{ Value: "baz.dkim.amazonses.com"},
],
},
}],
},
Expand Down

0 comments on commit af62caa

Please sign in to comment.