Skip to content
Merged
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
7 changes: 6 additions & 1 deletion products/udns/internal/udns/record_modify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ import (
)

func newRecordModifyCommand(ctx *cli.Context) *cobra.Command {
var ttl int
client := cli.NewServiceClient(ctx, udnssdk.NewClient)
req := client.NewModifyUDNSRecordRequest()
cmd := &cobra.Command{
Use: "modify",
Short: "Modify a DNS record in a UDNS zone",
Long: "Modify a DNS record in a UDNS zone",
Run: func(cmd *cobra.Command, args []string) {
if cmd.Flags().Changed("ttl") {
req.TTL = &ttl
}
recordID := ctx.PickResourceID(*req.RecordId)
req.RecordId = &recordID
_, err := client.ModifyUDNSRecord(req)
Expand All @@ -37,7 +41,8 @@ func newRecordModifyCommand(ctx *cli.Context) *cobra.Command {
req.Type = flags.String("type", "", "Optional. Record type: A, AAAA, CNAME, MX, TXT, SRV, PTR")
req.Value = flags.String("value", "", `Optional. Value string: "IP|weight|enabled,..."`)
req.ValueType = flags.String("value-type", "", "Optional. Normal or Multivalue")
req.TTL = flags.Int("ttl", 0, "Optional. TTL in seconds (5-600); 0 means unchanged")
//req.TTL = flags.Int("ttl", 0, "Optional. TTL in seconds (5-600); 0 means unchanged")
flags.IntVar(&ttl, "ttl", 0, "Optional. TTL in seconds (5-600); 0 means unchanged")
req.Remark = flags.String("remark", "", "Optional. Remark")
ctx.BindRegion(cmd, req)
ctx.BindProjectID(cmd, req)
Expand Down
Loading