Skip to content

Commit 370da89

Browse files
author
Bjarne Schröder
committed
Dremio: Implementing linter feedback after applying review suggestions.
1 parent 9d46feb commit 370da89

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

examples/dremio/dremio.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ import (
55
"fmt"
66
"os"
77

8+
"github.com/stackitcloud/stackit-sdk-go/core/config"
89
"github.com/stackitcloud/stackit-sdk-go/core/utils"
10+
"github.com/stackitcloud/stackit-sdk-go/services/dremio/v1alphaapi/wait/wait"
11+
912
dremio "github.com/stackitcloud/stackit-sdk-go/services/dremio/v1alphaapi"
10-
"github.com/stackitcloud/stackit-sdk-go/services/dremio/v1alphaapi/wait/wait"
1113
)
1214

1315
func main() {
14-
region := "eu01" // Region where the resources will be created
15-
projectId := "PROJECT_ID" // Your STACKIT project ID
16+
region := "eu01" // Region where the resources will be created
17+
projectId := "PROJECT_ID" // Your STACKIT project ID
1618
serviceAccountKeyPath := "sa-key-path.json" // Path to your STACKIT service account json
1719

18-
1920
ctx := context.Background()
2021

2122
dremioClient, err := dremio.NewAPIClient(
@@ -32,12 +33,12 @@ func main() {
3233
DisplayName: "myExampleDremioInstance",
3334
Description: utils.Ptr("This is a Dremio instance."),
3435
}
35-
createDremioInstanceResponse, err := dremioClient.DefaultAPI.CreateDremioInstance(ctx, projectId, region).CreateDremioInstancePayload(createDremioInstancePayload).Execute()
36+
createDremioInstanceResp, err := dremioClient.DefaultAPI.CreateDremioInstance(ctx, projectId, region).CreateDremioInstancePayload(createDremioInstancePayload).Execute()
3637
if err != nil {
3738
fmt.Fprintf(os.Stderr, "[Dremio] Error when creating Dremio instance: %v\n", err)
3839
os.Exit(1)
3940
}
40-
dremioId := createDremioInstanceResponse.Id
41+
dremioId := createDremioInstanceResp.Id
4142
fmt.Printf("[Dremio] Triggered creation of Dremio with ID: %s. Waiting for it to become active... \n", dremioId)
4243

4344
_, err = wait.CreateDremioWaitHandler(ctx, dremioClient.DefaultAPI, projectId, region, dremioId).WaitWithContext(ctx)
@@ -67,12 +68,12 @@ func main() {
6768
os.Exit(1)
6869
}
6970
fmt.Println("Dremio instances:")
70-
for _, instance := range listResp.Dremios {
71+
for i := range listResp.Dremios {
72+
instance := listResp.Dremios[i]
7173
fmt.Printf("%s - %s\n", instance.Id, instance.DisplayName)
7274
}
7375
fmt.Println()
7476

75-
7677
// Creating a Dremio user
7778
createDremioUserPayload := dremio.CreateDremioUserPayload{
7879
Description: utils.Ptr("This is a new user."),
@@ -82,12 +83,12 @@ func main() {
8283
Name: "newUser",
8384
Password: "aV3ryS4feP4ssw0rd6",
8485
}
85-
createDremioUserResponse, err := dremioClient.DefaultAPI.CreateDremioUser(ctx, projectId, region, dremioId).CreateDremioUserPayload(createDremioUserPayload).Execute()
86+
createDremioUserResp, err := dremioClient.DefaultAPI.CreateDremioUser(ctx, projectId, region, dremioId).CreateDremioUserPayload(createDremioUserPayload).Execute()
8687
if err != nil {
8788
fmt.Fprintf(os.Stderr, "[Dremio] Error when creating Dremio user: %v\n", err)
8889
os.Exit(1)
8990
}
90-
dremioUserId := createDremioUserResponse.Id
91+
dremioUserId := createDremioUserResp.Id
9192
fmt.Printf("[Dremio] Created Dremio User with ID: %s\n", dremioUserId)
9293

9394
_, err = wait.CreateDremioUserWaitHandler(ctx, dremioClient.DefaultAPI, projectId, region, dremioId, dremioUserId).WaitWithContext(ctx)
@@ -103,7 +104,8 @@ func main() {
103104
os.Exit(1)
104105
}
105106
fmt.Println("Dremio users:")
106-
for _, user := range listUsersResp.DremioUsers {
107+
for i := range listUsersResp.DremioUsers {
108+
user := &listUsersResp.DremioUsers[i]
107109
fmt.Printf("%s - %s\n", user.Id, user.Name)
108110
}
109111
fmt.Println()
@@ -131,6 +133,4 @@ func main() {
131133
fmt.Fprintf(os.Stderr, "[Dremio] Error when waiting for deletion: %v\n", err)
132134
os.Exit(1)
133135
}
134-
135-
136136
}

services/dremio/v1alphaapi/wait/wait/wait_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"net/http"
66
"testing"
77
"testing/synctest"
8-
"time"
98

109
"github.com/google/go-cmp/cmp"
1110

0 commit comments

Comments
 (0)