Skip to content

Commit

Permalink
feat(DNS Records): Added sdk for Import/Export dns records
Browse files Browse the repository at this point in the history
  • Loading branch information
DwitikrDash committed Jul 15, 2021
1 parent 00cde56 commit 0835231
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"files": "package-lock.json|go.sum|^.secrets.baseline$",
"lines": null
},
"generated_at": "2021-07-14T10:47:56Z",
"generated_at": "2021-07-15T07:53:24Z",
"plugins_used": [
{
"name": "AWSKeyDetector"
Expand Down
46 changes: 46 additions & 0 deletions dnssvcsv1/dns_svcs_v1_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package dnssvcsv1_test

import (
"fmt"
"io/ioutil"
"log"
"os"
"strconv"
Expand Down Expand Up @@ -632,6 +633,51 @@ var _ = Describe(`dnssvcsv1`, func() {
Expect(result).ToNot(BeNil())
Expect(response.GetStatusCode()).To(BeEquivalentTo(204))
})
It(`create import records`, func() {
shouldSkipTest()

// Import DNS records
importResourceRecordsOptions := service.NewImportResourceRecordsOptions(instanceID, *zoneInfo.ID)
zoneName := fmt.Sprintf("test-example%s.com", uuid.New().String())
f := strings.NewReader(zoneName + ` 1 IN AAAA 2001::888`)
importResourceRecordsOptions.SetFile(ioutil.NopCloser(f))
importResourceRecordsOptions.SetXCorrelationID("abc123")
importResourceRecordsOptions.SetFileContentType("application/json")
result, response, reqErr := service.ImportResourceRecords(importResourceRecordsOptions)
Expect(reqErr).To(BeNil())
Expect(response).ToNot(BeNil())
Expect(result).ToNot(BeNil())
Expect(response.GetStatusCode()).To(BeEquivalentTo(200))
Expect(*result.TotalRecordsParsed).To(BeEquivalentTo(int64(1)))
})
It(`get Export records`, func() {
shouldSkipTest()

//create a resource record
createResourceRecordOptions := service.NewCreateResourceRecordOptions(instanceID, *zoneInfo.ID)
createResourceRecordOptions.SetName("teststring")
createResourceRecordOptions.SetType(dnssvcsv1.CreateResourceRecordOptions_Type_A)
createResourceRecordOptions.SetTTL(120)
rdataARecord, err := service.NewResourceRecordInputRdataRdataARecord("1.1.1.1")
Expect(err).To(BeNil())
createResourceRecordOptions.SetRdata(rdataARecord)
createResourceRecordOptions.SetXCorrelationID("abc123")
rresult, rresponse, rreqErr := service.CreateResourceRecord(createResourceRecordOptions)
Expect(rreqErr).To(BeNil())
Expect(rresponse).ToNot(BeNil())
Expect(rresult).ToNot(BeNil())
Expect(rresponse.GetStatusCode()).To(BeEquivalentTo(200))
Expect(*rresult.Type).To(BeEquivalentTo(dnssvcsv1.CreateResourceRecordOptions_Type_A))

// Export DNS Records.
exportResourceRecordsOptions := service.NewExportResourceRecordsOptions(instanceID, *zoneInfo.ID)
exportResourceRecordsOptions.SetXCorrelationID("abc123")
result, response, reqErr := service.ExportResourceRecords(exportResourceRecordsOptions)
Expect(reqErr).To(BeNil())
Expect(response).ToNot(BeNil())
Expect(result).ToNot(BeNil())
Expect(response.GetStatusCode()).To(BeEquivalentTo(200))
})
})
})
Describe(`PDNSgloballoadbalancersv1`, func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ func shouldSkipTest() {
}

var _ = Describe(`TransitGatewayApisV1`, func() {
BeforeEach(func() {
Skip("Skipping Tests")
})
err := godotenv.Load("../transit.env")
It(`Successfully loading .env file`, func() {
if err == nil {
Expand Down

0 comments on commit 0835231

Please sign in to comment.