[#1614] adm/frostfsid: Add 'delete-kv'
All checks were successful
DCO action / DCO (pull_request) Successful in 38s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m35s
Build / Build Components (pull_request) Successful in 1m47s
Vulncheck / Vulncheck (pull_request) Successful in 1m40s
Tests and linters / Staticcheck (pull_request) Successful in 2m7s
Tests and linters / Lint (pull_request) Successful in 2m51s
Tests and linters / Run gofumpt (pull_request) Successful in 4m28s
Tests and linters / Tests (pull_request) Successful in 5m19s
Tests and linters / gopls check (pull_request) Successful in 5m29s
Tests and linters / Tests with -race (pull_request) Successful in 5m52s
All checks were successful
DCO action / DCO (pull_request) Successful in 38s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m35s
Build / Build Components (pull_request) Successful in 1m47s
Vulncheck / Vulncheck (pull_request) Successful in 1m40s
Tests and linters / Staticcheck (pull_request) Successful in 2m7s
Tests and linters / Lint (pull_request) Successful in 2m51s
Tests and linters / Run gofumpt (pull_request) Successful in 4m28s
Tests and linters / Tests (pull_request) Successful in 5m19s
Tests and linters / gopls check (pull_request) Successful in 5m29s
Tests and linters / Tests with -race (pull_request) Successful in 5m52s
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
This commit is contained in:
parent
7872ac7eb3
commit
2be7c21568
2 changed files with 35 additions and 0 deletions
|
@ -166,6 +166,14 @@ var (
|
||||||
},
|
},
|
||||||
Run: frostfsidSetKV,
|
Run: frostfsidSetKV,
|
||||||
}
|
}
|
||||||
|
frostfsidDeleteKVCmd = &cobra.Command{
|
||||||
|
Use: "delete-kv",
|
||||||
|
Short: "Delete a value from the subject's KV storage",
|
||||||
|
PreRun: func(cmd *cobra.Command, _ []string) {
|
||||||
|
_ = viper.BindPFlag(commonflags.EndpointFlag, cmd.Flags().Lookup(commonflags.EndpointFlag))
|
||||||
|
},
|
||||||
|
Run: frostfsidDeleteKV,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func initFrostfsIDCreateNamespaceCmd() {
|
func initFrostfsIDCreateNamespaceCmd() {
|
||||||
|
@ -259,6 +267,13 @@ func initFrostfsIDSetKVCmd() {
|
||||||
frostfsidSetKVCmd.Flags().String(valueFlag, "", valueDescFlag)
|
frostfsidSetKVCmd.Flags().String(valueFlag, "", valueDescFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func initFrostfsIDDeleteKVCmd() {
|
||||||
|
Cmd.AddCommand(frostfsidDeleteKVCmd)
|
||||||
|
frostfsidDeleteKVCmd.Flags().StringP(commonflags.EndpointFlag, commonflags.EndpointFlagShort, "", commonflags.EndpointFlagDesc)
|
||||||
|
frostfsidDeleteKVCmd.Flags().String(subjectAddressFlag, "", "Subject address")
|
||||||
|
frostfsidDeleteKVCmd.Flags().String(keyFlag, "", keyDescFlag)
|
||||||
|
}
|
||||||
|
|
||||||
func frostfsidCreateNamespace(cmd *cobra.Command, _ []string) {
|
func frostfsidCreateNamespace(cmd *cobra.Command, _ []string) {
|
||||||
ns := getFrostfsIDNamespace(cmd)
|
ns := getFrostfsIDNamespace(cmd)
|
||||||
|
|
||||||
|
@ -446,6 +461,25 @@ func frostfsidSetKV(cmd *cobra.Command, _ []string) {
|
||||||
commonCmd.ExitOnErr(cmd, "failed to set: %w", err)
|
commonCmd.ExitOnErr(cmd, "failed to set: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func frostfsidDeleteKV(cmd *cobra.Command, _ []string) {
|
||||||
|
subjectAddress := getFrostfsIDSubjectAddress(cmd)
|
||||||
|
key, _ := cmd.Flags().GetString(keyFlag)
|
||||||
|
|
||||||
|
if key == "" {
|
||||||
|
commonCmd.ExitOnErr(cmd, "", errors.New("key can't be empty"))
|
||||||
|
}
|
||||||
|
|
||||||
|
ffsid, err := newFrostfsIDClient(cmd)
|
||||||
|
commonCmd.ExitOnErr(cmd, "init contract client: %w", err)
|
||||||
|
|
||||||
|
method, args := ffsid.roCli.DeleteSubjectKVCall(subjectAddress, key)
|
||||||
|
|
||||||
|
ffsid.addCall(method, args)
|
||||||
|
|
||||||
|
err = ffsid.sendWait()
|
||||||
|
commonCmd.ExitOnErr(cmd, "failed to delete: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
func frostfsidListGroupSubjects(cmd *cobra.Command, _ []string) {
|
func frostfsidListGroupSubjects(cmd *cobra.Command, _ []string) {
|
||||||
ns := getFrostfsIDNamespace(cmd)
|
ns := getFrostfsIDNamespace(cmd)
|
||||||
groupID := getFrostfsIDGroupID(cmd)
|
groupID := getFrostfsIDGroupID(cmd)
|
||||||
|
|
|
@ -13,6 +13,7 @@ func init() {
|
||||||
initFrostfsIDRemoveSubjectFromGroupCmd()
|
initFrostfsIDRemoveSubjectFromGroupCmd()
|
||||||
initFrostfsIDListGroupSubjectsCmd()
|
initFrostfsIDListGroupSubjectsCmd()
|
||||||
initFrostfsIDSetKVCmd()
|
initFrostfsIDSetKVCmd()
|
||||||
|
initFrostfsIDDeleteKVCmd()
|
||||||
initFrostfsIDAddSubjectKeyCmd()
|
initFrostfsIDAddSubjectKeyCmd()
|
||||||
initFrostfsIDRemoveSubjectKeyCmd()
|
initFrostfsIDRemoveSubjectKeyCmd()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue