NewRemoveCertificationTargetComand returns a cobra command for the `get` subcommand
()
| 152 | |
| 153 | // NewRemoveCertificationTargetComand returns a cobra command for the `get` subcommand |
| 154 | func NewRemoveCertificationTargetComand() *cobra.Command { |
| 155 | cmd := &cobra.Command{ |
| 156 | Use: "remove [id]", |
| 157 | Short: "Removes a target certification target by its ID", |
| 158 | Args: cobra.ExactArgs(1), |
| 159 | RunE: func(cmd *cobra.Command, args []string) error { |
| 160 | var ( |
| 161 | err error |
| 162 | session *cli.Session |
| 163 | client orchestrator.OrchestratorClient |
| 164 | res *emptypb.Empty |
| 165 | ) |
| 166 | |
| 167 | if session, err = cli.ContinueSession(); err != nil { |
| 168 | fmt.Printf("Error while retrieving the session. Please re-authenticate.\n") |
| 169 | return nil |
| 170 | } |
| 171 | |
| 172 | client = orchestrator.NewOrchestratorClient(session) |
| 173 | |
| 174 | targetID := args[0] |
| 175 | |
| 176 | res, err = client.RemoveCertificationTarget(context.Background(), &orchestrator.RemoveCertificationTargetRequest{CertificationTargetId: targetID}) |
| 177 | |
| 178 | return session.HandleResponse(res, err) |
| 179 | }, |
| 180 | ValidArgsFunction: cli.DefaultArgsShellComp, |
| 181 | } |
| 182 | |
| 183 | return cmd |
| 184 | } |
| 185 | |
| 186 | // NewUpdateCertificationTargetCommand returns a cobra command for the `update` subcommand |
| 187 | func NewUpdateCertificationTargetCommand() *cobra.Command { |