fixed bug

This commit is contained in:
Manuel Ganter 2025-11-11 15:55:38 +01:00
parent b2ad30266a
commit ff81bf738a
No known key found for this signature in database

View file

@ -2,7 +2,9 @@ package provider
import (
"context"
"net/http"
"os"
"time"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/path"
@ -146,8 +148,17 @@ func (p *EdgeConnectProvider) Configure(ctx context.Context, req provider.Config
tflog.Debug(ctx, "Creating Edge Connect client with username/password authentication")
}
client := edgeclient.NewClient(endpoint)
var client *edgeclient.Client
if token != "" {
client = edgeclient.NewClient(endpoint,
edgeclient.WithHTTPClient(&http.Client{Timeout: 30*time.Second}),
edgeclient.WithAuthProvider(edgeclient.NewStaticTokenProvider(token)),
)
} else {
client = edgeclient.NewClientWithCredentials(endpoint, username, password,
edgeclient.WithHTTPClient(&http.Client{Timeout: 30*time.Second}),
)
}
// TODO: Configure client with authentication credentials
// If using token: client.SetToken(token)
// If using username/password: client.SetCredentials(username, password)