Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
module github.com/vinyldns/vinyldns-cli

go 1.17
go 1.21

require (
github.com/crackcomm/go-clitable v0.0.0-20151121230230-53bcff2fea36
github.com/olekukonko/tablewriter v0.0.4
github.com/urfave/cli v1.22.17
github.com/vinyldns/go-vinyldns v0.9.16
github.com/vinyldns/go-vinyldns v0.9.17
)

require (
github.com/aws/aws-sdk-go-v2 v1.26.1 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 // indirect
github.com/aws/smithy-go v1.20.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.7 // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/smartystreets/assertions v1.2.1 // indirect
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 // indirect
)
17 changes: 8 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/aws/aws-sdk-go-v2 v1.26.1 h1:5554eUqIYVWpU0YmeeYZ0wU64H2VLBs8TlhRB2L+EkA=
github.com/aws/aws-sdk-go-v2 v1.26.1/go.mod h1:ffIFB97e2yNsv4aTSGkqtHnppsIJzw7G7BReUZ3jCXM=
github.com/aws/aws-sdk-go-v2/credentials v1.17.11 h1:YuIB1dJNf1Re822rriUOTxopaHHvIq0l/pX3fwO+Tzs=
github.com/aws/aws-sdk-go-v2/credentials v1.17.11/go.mod h1:AQtFPsDH9bI2O+71anW6EKL+NcD7LG3dpKGMV4SShgo=
github.com/aws/smithy-go v1.20.2 h1:tbp628ireGtzcHDDmLT/6ADHidqnwgF57XOXZe6tp4Q=
github.com/aws/smithy-go v1.20.2/go.mod h1:krry+ya/rV9RDcV/Q16kpu6ypI4K2czasz0NC3qS14E=
github.com/cpuguy83/go-md2man/v2 v2.0.7 h1:zbFlGlXEAKlwXpmvle3d8Oe3YnkKIK4xSRTd3sHPnBo=
github.com/cpuguy83/go-md2man/v2 v2.0.7/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/crackcomm/go-clitable v0.0.0-20151121230230-53bcff2fea36 h1:Eh9hIExe8+EjlshMnGlF2o7fSfYaAGWS6k7PM1o1RCI=
Expand All @@ -16,13 +22,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
github.com/smartystreets/assertions v1.2.1 h1:bKNHfEv7tSIjZ8JbKaFjzFINljxG4lzZvmHUnElzOIg=
github.com/smartystreets/assertions v1.2.1/go.mod h1:wDmR7qL282YbGsPy6H/yAsesrxfxaaSlJazyFLYVFx8=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9 h1:hp2CYQUINdZMHdvTdXtPOY2ainKl4IoMcpAXEf2xj3Q=
github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM=
github.com/smartystreets/gunit v1.0.4 h1:tpTjnuH7MLlqhoD21vRoMZbMIi5GmBsAJDFyF67GhZA=
github.com/smartystreets/gunit v1.0.4/go.mod h1:EH5qMBab2UclzXUcpR8b93eHsIlp9u+pDQIRp5DZNzQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
Expand All @@ -34,8 +33,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli v1.22.17 h1:SYzXoiPfQjHBbkYxbew5prZHS1TOLT3ierW8SYLqtVQ=
github.com/urfave/cli v1.22.17/go.mod h1:b0ht0aqgH/6pBYzzxURyrM4xXNgsoT/n2ZzwQiEhNVo=
github.com/vinyldns/go-vinyldns v0.9.16 h1:GZJStDkcCk1F1AcRc64LuuMh+ENL8pHA0CVd4ulRMcQ=
github.com/vinyldns/go-vinyldns v0.9.16/go.mod h1:5qIJOdmzAnatKjurI+Tl4uTus7GJKJxb+zitufjHs3Q=
github.com/vinyldns/go-vinyldns v0.9.17 h1:hfPZfCaxcRBX6Gsgl42rLCeoal58/BH8kkvJShzjjdI=
github.com/vinyldns/go-vinyldns v0.9.17/go.mod h1:pwWhE9K/leGDOIduVhRGvQ3ecVMHWRfEnKYUTEU3gB4=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
14 changes: 14 additions & 0 deletions src/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,20 @@ func main() {
},
},
},
{
Name: "zone-details",
Usage: "zone-details --zone-id <zoneID>",
Description: "viewing general zone info when not part of the zone's admin group using zoneID",
Action: func(c *cli.Context) error {
return requireAtLeast(c, zoneDetails, "zone-id", "zone-name")
},
Flags: []cli.Flag{
cli.StringFlag{
Name: "zone-id",
Usage: "The zone ID",
},
},
},
{
Name: "zone-create",
Usage: "zone-create --name <name> --email <email> --admin-group-id <adminGroupID> --transfer-connection-name <transferConnectionName> --transfer-connection-key <transferConnectionKey> --transfer-connection-key-name <transferConnectionKeyName> --transfer-connection-primary-server <transferConnectionPrimaryServer> --zone-connection-name <zoneConnectionName> --zone-connection-key <zoneConnectionKey> --zone-connection-key-name <zoneConnectionKeyName> --zone-connection-primary-server <zoneConnectionPrimaryServer>",
Expand Down
2 changes: 1 addition & 1 deletion src/record_sets.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

func recordSetChanges(c *cli.Context) error {
client := client(c)
zh, err := client.RecordSetChanges(c.String("zone-id"), vinyldns.ListFilter{})
zh, err := client.RecordSetChanges(c.String("zone-id"), vinyldns.ListFilterRecordSetChanges{})
if err != nil {
return err
}
Expand Down
25 changes: 25 additions & 0 deletions src/zones.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ func zone(c *cli.Context) error {
return nil
}

func zoneDetails(c *cli.Context) error {
client := client(c)
id := c.String("zone-id")
z, err := getZoneDetails(client, id)
if err != nil {
return err
}

if c.GlobalString(outputFlag) == "json" {
return printJSON(z)
}

data := [][]string{
{"Name", z.Name},
{"Email", z.Email},
{"Status", z.Status},
{"AdminGroupID", z.AdminGroupID},
{"AdminGroupName", z.AdminGroupName},
}

printBasicTable(data)

return nil
}

func zoneUpdate(c *cli.Context) error {
data := []byte(c.String("json"))
zone := &vinyldns.Zone{}
Expand Down
9 changes: 9 additions & 0 deletions src/zones_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ func getZone(c *vinyldns.Client, name, id string) (vinyldns.Zone, error) {
return c.Zone(id)
}

func getZoneDetails(c *vinyldns.Client, id string) (vinyldns.ZoneDetails, error) {

Comment thread
ssranjani06 marked this conversation as resolved.
z, err := c.ZoneDetails(id)
if err != nil {
return z, err
}
return z, nil
}

func validateConnection(connection string, c *vinyldns.ZoneConnection) (bool, error) {
// if all are empty, we assume the user does not want to declare a connection
if c.Key == "" && c.KeyName == "" && c.Name == "" && c.PrimaryServer == "" {
Expand Down
Loading