Skip to content

Commit 627cf04

Browse files
committed
fix: updated waiter and corrected examples
1 parent f61f680 commit 627cf04

17 files changed

+691
-122
lines changed

examples/serviceenablement/serviceenablement.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ func main() {
2222
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
2323
os.Exit(1)
2424
}
25+
region := "eu01"
2526

2627
// List Services
27-
listServicesResp, err := client.ListServiceStatusExecute(context.Background(), projectId)
28+
listServicesResp, err := client.ListServiceStatusRegionalExecute(context.Background(), region, projectId)
2829
if err != nil {
2930
fmt.Fprintf(os.Stderr, "Error when calling `ListServices`: %v\n", err)
3031
} else {
@@ -34,33 +35,33 @@ func main() {
3435
// Get Service Id from the list of services
3536
serviceId := (*listServicesResp.Items)[0].ServiceId
3637

37-
getServiceStatusResp, err := client.GetServiceStatus(context.Background(), projectId, *serviceId).Execute()
38+
getServiceStatusResp, err := client.GetServiceStatusRegional(context.Background(), region, projectId, *serviceId).Execute()
3839
if err != nil {
3940
fmt.Fprintf(os.Stderr, "Error when calling `GetServiceStatus`: %v\n", err)
4041
} else {
4142
fmt.Printf("Service state: %s\n", *getServiceStatusResp.State)
4243
}
4344

4445
// Enable Service
45-
err = client.EnableService(context.Background(), projectId, *serviceId).Execute()
46+
err = client.EnableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
4647
if err != nil {
4748
fmt.Fprintf(os.Stderr, "Error when calling `EnableService`: %v\n", err)
4849
}
4950
// Wait for the service to be enabled
50-
status, err := wait.EnableServiceWaitHandler(context.Background(), client, projectId, *serviceId).WaitWithContext(context.Background())
51+
status, err := wait.EnableServiceWaitHandler(context.Background(), client, region, projectId, *serviceId).WaitWithContext(context.Background())
5152
if err != nil {
5253
fmt.Fprintf(os.Stderr, "Error when waiting for service to be enabled: %v\n", err)
5354
} else {
5455
fmt.Printf("Service %q is now enabled\n", *status.ServiceId)
5556
}
5657

5758
// Disable Service
58-
err = client.DisableService(context.Background(), projectId, *serviceId).Execute()
59+
err = client.DisableServiceRegional(context.Background(), region, projectId, *serviceId).Execute()
5960
if err != nil {
6061
fmt.Fprintf(os.Stderr, "Error when calling `DisableService`: %v\n", err)
6162
}
6263
// Wait for the service to be disabled
63-
status, err = wait.DisableServiceWaitHandler(context.Background(), client, projectId, *serviceId).WaitWithContext(context.Background())
64+
status, err = wait.DisableServiceWaitHandler(context.Background(), client, region, projectId, *serviceId).WaitWithContext(context.Background())
6465
if err != nil {
6566
fmt.Fprintf(os.Stderr, "Error when waiting for service to be disabled: %v\n", err)
6667
} else {

0 commit comments

Comments
 (0)