Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: regional APIs tab-complete default location #477

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion commands/cdn/distribution/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Delete() *core.Command {
return completer.DistributionsProperty(func(r cdn.Distribution) string {
return *r.Id
})
}, constants.CDNApiRegionalURL),
}, constants.CDNApiRegionalURL, constants.CDNLocations),
)
cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all records if set", core.RequiredFlagOption())

Expand Down
2 changes: 1 addition & 1 deletion commands/cdn/distribution/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func FindByID() *core.Command {
return completer.DistributionsProperty(func(r cdn.Distribution) string {
return *r.Id
})
}, constants.CDNApiRegionalURL),
}, constants.CDNApiRegionalURL, constants.CDNLocations),
)
cmd.Command.SilenceUsage = true
cmd.Command.Flags().SortFlags = false
Expand Down
2 changes: 1 addition & 1 deletion commands/cdn/distribution/routingrules/routing_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func GetDistributionRoutingRules() *core.Command {
return completer.DistributionsProperty(func(r cdn.Distribution) string {
return *r.Id
})
}, constants.CDNApiRegionalURL),
}, constants.CDNApiRegionalURL, constants.CDNLocations),
)
cmd.Command.SilenceUsage = true
cmd.Command.Flags().SortFlags = false
Expand Down
2 changes: 1 addition & 1 deletion commands/cdn/distribution/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func Update() *core.Command {
return completer.DistributionsProperty(func(r cdn.Distribution) string {
return *r.Id
})
}, constants.CDNApiRegionalURL),
}, constants.CDNApiRegionalURL, constants.CDNLocations),
)
cmd.Command.SilenceUsage = true
cmd.Command.Flags().SortFlags = false
Expand Down
2 changes: 1 addition & 1 deletion commands/dbaas/mariadb/backup/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func Get() *core.Command {
}
return *c.Id + "\t" + fmt.Sprintf("(%d MiB)", *c.Properties.Size)
})
}, constants.MariaDBApiRegionalURL),
}, constants.MariaDBApiRegionalURL, constants.MariaDBLocations),
)
return cmd
}
2 changes: 1 addition & 1 deletion commands/dbaas/mariadb/backup/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func List() *core.Command {
}
return *c.Id
})
}, constants.MariaDBApiRegionalURL),
}, constants.MariaDBApiRegionalURL, constants.MariaDBLocations),
)
cmd.AddInt32Flag(constants.FlagMaxResults, constants.FlagMaxResultsShort, 0, constants.DescMaxResults)
cmd.AddInt32Flag(constants.FlagOffset, "", 0, "Skip a certain number of results")
Expand Down
2 changes: 1 addition & 1 deletion commands/dbaas/mariadb/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ ionosctl db mar c d --all --name <name>`,
}
return *c.Id
})
}, constants.MariaDBApiRegionalURL),
}, constants.MariaDBApiRegionalURL, constants.MariaDBLocations),
)
cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all mariadb clusters")
cmd.AddBoolFlag(constants.FlagName, "", false, "When deleting all clusters, filter the clusters by a name")
Expand Down
2 changes: 1 addition & 1 deletion commands/dbaas/mariadb/cluster/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func Get() *core.Command {
}
return *c.Id
})
}, constants.MariaDBApiRegionalURL),
}, constants.MariaDBApiRegionalURL, constants.MariaDBLocations),
)

cmd.Command.SilenceUsage = true
Expand Down
8 changes: 4 additions & 4 deletions commands/dns/dnssec/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,21 +87,21 @@ func Create() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)
cmd.AddStringFlag(FlagAlgorithm, "", "RSASHA256", "Algorithm used to generate signing keys (both Key Signing Keys and Zone Signing Keys)")
cmd.AddIntFlag(FlagKskBits, "", 1024, "Key signing key length in bits. kskBits >= zskBits: [1024/2048/4096]",
core.WithCompletion(
func() []string {
return []string{"1024", "2048", "4096"}
}, constants.DNSApiRegionalURL,
}, constants.DNSApiRegionalURL, constants.DNSLocations,
),
)
cmd.AddIntFlag(FlagZskBits, "", 1024, "Zone signing key length in bits. zskBits <= kskBits: [1024/2048/4096]",
core.WithCompletion(
func() []string {
return []string{"1024", "2048", "4096"}
}, constants.DNSApiRegionalURL,
}, constants.DNSApiRegionalURL, constants.DNSLocations,
),
)
cmd.AddSetFlag(FlagNsecMode, "", "NSEC", []string{"NSEC", "NSEC3"}, "NSEC mode.")
Expand All @@ -110,7 +110,7 @@ func Create() *core.Command {
core.WithCompletion(
func() []string {
return []string{"64", "72", "80", "88", "96", "104", "112", "120", "128"}
}, constants.DNSApiRegionalURL,
}, constants.DNSApiRegionalURL, constants.DNSLocations,
),
)
cmd.AddIntFlag(FlagValidity, "", 90, "Signature validity in days [90..365]")
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/dnssec/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func Delete() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/dnssec/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ionosctl dns keys list --zone ZONE --cols PubKey --no-headers`,
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/reverse-record/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func Delete() *core.Command {
return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string {
return *read.Properties.Ip
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all records if set", core.RequiredFlagOption())
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/reverse-record/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func Get() *core.Command {
return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string {
return *read.Properties.Ip
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/reverse-record/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func List() *core.Command {
return RecordsProperty(func(t dns.ReverseRecordRead) string {
return *t.Properties.Ip
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)
cmd.AddInt32Flag(constants.FlagOffset, "", 0, "The first element (of the total list of elements) to include in the response. Use together with limit for pagination")
cmd.AddInt32Flag(constants.FlagMaxResults, "", 0, constants.DescMaxResults)
Expand Down
4 changes: 2 additions & 2 deletions commands/dns/reverse-record/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func Update() *core.Command {
return RecordsProperty(func(read ionoscloud.ReverseRecordRead) string {
return *read.Properties.Ip
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.AddStringFlag(constants.FlagIp, "", "", "The new IP", core.WithCompletionE(
Expand All @@ -90,7 +90,7 @@ func Update() *core.Command {
}
}
return ips, nil
}, ""),
}, "", nil),
)
cmd.AddStringFlag(constants.FlagName, "", "", "The new record name")
cmd.AddStringFlag(constants.FlagDescription, "", "", "The new description of the record")
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/secondary-zones/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func deleteCmd() *core.Command {
c.Command.Flags().BoolP(constants.ArgAll, constants.ArgAllShort, false, "Delete all secondary zones")

c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone,
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL),
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/secondary-zones/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func getCmd() *core.Command {
)

c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone,
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL),
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/secondary-zones/transfer/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func getCmd() *core.Command {
)

c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone,
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL),
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/secondary-zones/transfer/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func startCmd() *core.Command {
)

c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone,
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL),
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/secondary-zones/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func updateCmd() *core.Command {
c.Command.Flags().StringSlice(constants.FlagPrimaryIPs, []string{}, "Primary DNS server IP addresses")

c.AddStringFlag(constants.FlagZone, constants.FlagZoneShort, "", constants.DescZone,
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL),
core.WithCompletion(completer.SecondaryZonesIDs, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/zone/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func ZonesDeleteCmd() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, fmt.Sprintf("Delete all zones. Required or -%s", constants.FlagZoneShort))
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/zone/file/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func getCmd() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

c.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/zone/file/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func updateCmd() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)
c.Command.Flags().String(constants.FlagZoneFile, "", "Path to the zone file")

Expand Down
2 changes: 1 addition & 1 deletion commands/dns/zone/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func ZonesFindByIdCmd() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)

cmd.Command.SilenceUsage = true
Expand Down
2 changes: 1 addition & 1 deletion commands/dns/zone/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func ZonesPutCmd() *core.Command {
return completer.ZonesProperty(func(t dns.ZoneRead) string {
return *t.Properties.ZoneName
})
}, constants.DNSApiRegionalURL),
}, constants.DNSApiRegionalURL, constants.DNSLocations),
)
cmd.AddStringFlag(constants.FlagName, constants.FlagNameShort, "", "The new name of the DNS zone, e.g. foo.com")
cmd.AddStringFlag(constants.FlagDescription, "", "", "The new description of the DNS zone")
Expand Down
2 changes: 1 addition & 1 deletion commands/kafka/cluster/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Delete() *core.Command {
return *k.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)

Expand Down
2 changes: 1 addition & 1 deletion commands/kafka/cluster/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func FindByID() *core.Command {
return *k.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)

Expand Down
2 changes: 1 addition & 1 deletion commands/kafka/topic/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func createCmd() *core.Command {
return *read.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)

Expand Down
4 changes: 2 additions & 2 deletions commands/kafka/topic/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,15 @@ func deleteCmd() *core.Command {
return *read.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)
cmd.AddStringFlag(
constants.FlagKafkaTopicId, "", "", "The ID of the topic", core.RequiredFlagOption(),
core.WithCompletion(
func() []string {
return completer.Topics(cmd.Command.Flag(constants.FlagClusterId).Value.String())
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)
cmd.AddBoolFlag(constants.ArgAll, constants.ArgAllShort, false, "Delete all topics")
Expand Down
4 changes: 2 additions & 2 deletions commands/kafka/topic/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ func getCmd() *core.Command {
return *read.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)
cmd.AddStringFlag(
constants.FlagKafkaTopicId, "", "", "The ID of the topic", core.RequiredFlagOption(),
core.WithCompletion(
func() []string {
return completer.Topics(cmd.Command.Flag(constants.FlagClusterId).Value.String())
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)

Expand Down
2 changes: 1 addition & 1 deletion commands/kafka/topic/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ionosctl kafka topic list --location LOCATION --cluster-id CLUSTER_ID`,
return *read.Id
},
)
}, constants.KafkaApiRegionalURL,
}, constants.KafkaApiRegionalURL, constants.KafkaLocations,
),
)

Expand Down
2 changes: 1 addition & 1 deletion commands/logging-service/logging-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ func Root() *core.Command {
cmd.AddCommand(pipeline.PipelineCmd())
cmd.AddCommand(logs.LogsCmd())

return core.WithRegionalFlags(cmd, constants.LoggingApiRegionalURL, constants.LoggingAPILocations)
return core.WithRegionalFlags(cmd, constants.LoggingApiRegionalURL, constants.LoggingLocations)
}
2 changes: 1 addition & 1 deletion commands/logging-service/logs/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func LogsAddCmd() *core.Command {
cmd.AddStringFlag(
constants.FlagLoggingPipelineId, constants.FlagIdShort, "",
"The ID of the logging pipeline", core.RequiredFlagOption(),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)

cmd.AddStringFlag(
Expand Down
4 changes: 2 additions & 2 deletions commands/logging-service/logs/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func LogsGetCmd() *core.Command {
cmd.AddStringFlag(
constants.FlagLoggingPipelineId, constants.FlagIdShort, "",
"The ID of the logging pipeline", core.RequiredFlagOption(),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)

cmd.AddStringFlag(
Expand All @@ -41,7 +41,7 @@ func LogsGetCmd() *core.Command {
return completer.LoggingServiceLogTags(
viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLoggingPipelineId)),
)
}, constants.LoggingApiRegionalURL),
}, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)

return cmd
Expand Down
2 changes: 1 addition & 1 deletion commands/logging-service/logs/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func LogsListCmd() *core.Command {
cmd.AddStringFlag(
constants.FlagLoggingPipelineId, constants.FlagIdShort, "",
"The ID of the logging pipeline", core.RequiredFlagOption(),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)

return cmd
Expand Down
4 changes: 2 additions & 2 deletions commands/logging-service/logs/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func LogsRemoveCmd() *core.Command {
cmd.AddStringFlag(
constants.FlagLoggingPipelineId, constants.FlagIdShort, "",
"The ID of the logging pipeline", core.RequiredFlagOption(),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL),
core.WithCompletion(completer.LoggingServicePipelineIds, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)
cmd.AddStringFlag(
constants.FlagLoggingPipelineLogTag, "", "", "The tag of the pipeline log that you want to delete",
Expand All @@ -41,7 +41,7 @@ func LogsRemoveCmd() *core.Command {
return completer.LoggingServiceLogTags(
viper.GetString(core.GetFlagName(cmd.NS, constants.FlagLoggingPipelineId)),
)
}, constants.LoggingApiRegionalURL),
}, constants.LoggingApiRegionalURL, constants.LoggingLocations),
)

return cmd
Expand Down
Loading
Loading