-
Notifications
You must be signed in to change notification settings - Fork 25
/
delete_team.go
42 lines (34 loc) · 896 Bytes
/
delete_team.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package examples
import (
"fmt"
"net/url"
"github.com/OctopusDeploy/go-octopusdeploy/octopusdeploy"
)
// DeleteTeamExample provides an example of how to delete a team from Octopus
// Deploy through the Go API client.
func DeleteTeamExample() {
var (
apiKey string = "API-YOUR_API_KEY"
octopusURL string = "https://your_octopus_url"
spaceID string = "space-id"
// team values
teamID string = "team-id"
)
apiURL, err := url.Parse(octopusURL)
if err != nil {
_ = fmt.Errorf("error parsing URL for Octopus API: %v", err)
return
}
client, err := octopusdeploy.NewClient(nil, apiURL, apiKey, spaceID)
if err != nil {
_ = fmt.Errorf("error creating API client: %v", err)
return
}
// delete team
err = client.Teams.DeleteByID(teamID)
if err != nil {
_ = fmt.Errorf("error deleting team: %v", err)
return
}
fmt.Printf("team deleted: (%s)\n", teamID)
}