fixed bug
This commit is contained in:
parent
b2ad30266a
commit
ff81bf738a
1 changed files with 13 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue