MCPcopy Create free account
hub / github.com/clouditor/clouditor / NewGetCertificationTargetCommand

Function NewGetCertificationTargetCommand

cli/commands/cloud/cloud.go:121–151  ·  view source on GitHub ↗

NewGetCertificationTargetCommand returns a cobra command for the `get` subcommand

()

Source from the content-addressed store, hash-verified

119
120// NewGetCertificationTargetCommand returns a cobra command for the `get` subcommand
121func 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
154func NewRemoveCertificationTargetComand() *cobra.Command {

Callers 2

AddCommandsFunction · 0.85

Calls 4

ContinueSessionFunction · 0.92
NewOrchestratorClientFunction · 0.92
HandleResponseMethod · 0.80

Tested by 1