Skip to content

Commit

Permalink
doc: add some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
hatamiarash7 committed Mar 24, 2023
1 parent 9ed4447 commit 31f0eb6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/gookit/gcli/v3/interact"
)

// List of functions for every DNS record type
var funcs = map[string]func() interface{}{
"A": createDNSRecord_A,
"AAAA": createDNSRecord_AAAA,
Expand Down Expand Up @@ -87,6 +88,7 @@ func CreateDNSRecord(ctx context.Context, api *arvancloud.API, domain string, re
arvancloud.PrettyPrint(u)
}

// createDNSRecordParams will configure the parameters for creating a DNS record
func createDNSRecordParams(params *arvancloud.CreateDNSRecordParams) {
recordName, _ := interact.ReadInput("Record name: ")
params.Name = recordName
Expand Down Expand Up @@ -148,10 +150,11 @@ func createDNSRecordParams(params *arvancloud.CreateDNSRecordParams) {
)
params.UpstreamHTTPS = recordUpstreamHTTPS

// Call function based on record type
if f, ok := funcs[recordType]; ok {
params.Value = f()
} else {
log.Fatal("Unknown function:", recordType)
log.Fatal("Unknown record type:", recordType)
}

params.IPFilterMode = createDNSRecord_IPFilterMode()
Expand Down

0 comments on commit 31f0eb6

Please sign in to comment.