Skip to content

Commit 22e38a6

Browse files
chore(opensearch): remove stale opensearchclient interface and fix swapped region and instanceid args
relates to STACKITTCLI-372
1 parent 8c0a014 commit 22e38a6

2 files changed

Lines changed: 4 additions & 9 deletions

File tree

internal/pkg/services/opensearch/utils/utils.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,16 @@ func LoadPlanId(planName, version string, offerings *opensearch.ListOfferingsRes
6262
}
6363
}
6464

65-
type OpenSearchClient interface {
66-
GetInstance(ctx context.Context, projectId, region, instanceId string) opensearch.ApiGetInstanceRequest
67-
GetCredentials(ctx context.Context, projectId, region, instanceId, credentialsId string) opensearch.ApiGetCredentialsRequest
68-
}
69-
70-
func GetInstanceName(ctx context.Context, apiClient OpenSearchClient, projectId, region, instanceId string) (string, error) {
65+
func GetInstanceName(ctx context.Context, apiClient opensearch.DefaultAPI, projectId, region, instanceId string) (string, error) {
7166
resp, err := apiClient.GetInstance(ctx, projectId, region, instanceId).Execute()
7267
if err != nil {
7368
return "", fmt.Errorf("get OpenSearch instance: %w", err)
7469
}
7570
return resp.Name, nil
7671
}
7772

78-
func GetCredentialsUsername(ctx context.Context, apiClient OpenSearchClient, projectId, region, instanceId, credentialsId string) (string, error) {
79-
resp, err := apiClient.GetCredentials(ctx, projectId, instanceId, region, credentialsId).Execute()
73+
func GetCredentialsUsername(ctx context.Context, apiClient opensearch.DefaultAPI, projectId, region, instanceId, credentialsId string) (string, error) {
74+
resp, err := apiClient.GetCredentials(ctx, projectId, region, instanceId, credentialsId).Execute()
8075
if err != nil {
8176
return "", fmt.Errorf("get OpenSearch credentials: %w", err)
8277
}

internal/pkg/services/opensearch/utils/utils_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ import (
1313

1414
var (
1515
testProjectId = uuid.NewString()
16-
testRegion = "eu01"
1716
testInstanceId = uuid.NewString()
1817
testCredentialsId = uuid.NewString()
1918
)
2019

2120
const (
21+
testRegion = "eu01"
2222
testInstanceName = "instance"
2323
testCredentialsUsername = "username"
2424
)

0 commit comments

Comments
 (0)