MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / deleteRun

Function deleteRun

pkg/cmd/environment/delete/delete.go:75–94  ·  view source on GitHub ↗
(f factory.Factory, cmd *cobra.Command)

Source from the content-addressed store, hash-verified

73}
74
75func deleteRun(f factory.Factory, cmd *cobra.Command) error {
76 client, err := f.GetSpacedClient(apiclient.NewRequester(cmd))
77 if err != nil {
78 return err
79 }
80
81 existingItems, err := client.Environments.GetAll()
82 if err != nil {
83 return err
84 }
85
86 itemToDelete, err := selectors.ByName(f.Ask, existingItems, "Select the environment you wish to delete:")
87 if err != nil {
88 return err
89 }
90
91 return question.DeleteWithConfirmation(f.Ask, "environment", itemToDelete.Name, itemToDelete.GetID(), func() error {
92 return delete(client, itemToDelete)
93 })
94}
95
96func delete(client *client.Client, itemToDelete *environments.Environment) error {
97 return client.Environments.DeleteByID(itemToDelete.GetID())

Callers 1

NewCmdDeleteFunction · 0.70

Calls 5

NewRequesterFunction · 0.92
ByNameFunction · 0.92
DeleteWithConfirmationFunction · 0.92
deleteFunction · 0.70
GetSpacedClientMethod · 0.65

Tested by

no test coverage detected