NewGetCertificationTargetCommand returns a cobra command for the `get` subcommand
()
| 119 | |
| 120 | // NewGetCertificationTargetCommand returns a cobra command for the `get` subcommand |
| 121 | func NewGetCertificationTargetCommand() *cobra.Command { |
| 122 | cmd := &cobra.Command{ |
| 123 | Use: "get [id]", |
| 124 | Short: "Retrieves a target certification target by its ID", |
| 125 | Args: cobra.ExactArgs(1), |
| 126 | RunE: func(cmd *cobra.Command, args []string) error { |
| 127 | var ( |
| 128 | err error |
| 129 | session *cli.Session |
| 130 | client orchestrator.OrchestratorClient |
| 131 | res *orchestrator.CertificationTarget |
| 132 | ) |
| 133 | |
| 134 | if session, err = cli.ContinueSession(); err != nil { |
| 135 | fmt.Printf("Error while retrieving the session. Please re-authenticate.\n") |
| 136 | return nil |
| 137 | } |
| 138 | |
| 139 | client = orchestrator.NewOrchestratorClient(session) |
| 140 | |
| 141 | targetID := args[0] |
| 142 | |
| 143 | res, err = client.GetCertificationTarget(context.Background(), &orchestrator.GetCertificationTargetRequest{CertificationTargetId: targetID}) |
| 144 | |
| 145 | return session.HandleResponse(res, err) |
| 146 | }, |
| 147 | ValidArgsFunction: cli.DefaultArgsShellComp, |
| 148 | } |
| 149 | |
| 150 | return cmd |
| 151 | } |
| 152 | |
| 153 | // NewRemoveCertificationTargetComand returns a cobra command for the `get` subcommand |
| 154 | func NewRemoveCertificationTargetComand() *cobra.Command { |