Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Optional:

- `aws_lambda` (Attributes) AWS configuration for Lambda (see [below for nested schema](#nestedatt--connection_profiles--aws_lambda))
- `validate_certs` (Boolean) Whether to enforce SSL certificate validation, defaults to true. Not applicable for AWS Lambda
- `scheme` (String) URL Scheme to be used to build the ONTAP management interface URL, defaults to https.

<a id="nestedatt--connection_profiles--aws_lambda"></a>

Expand Down
1 change: 1 addition & 0 deletions internal/provider/connection/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
type Profile struct {
// TODO: add certs in addition to basic authentication
// TODO: Add Timeout (currently hardcoded to 10 seconds)
Scheme string
Hostname string
Username string
Password string
Expand Down
6 changes: 6 additions & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ONTAPProvider struct {
// ConnectionProfileModel associate a connection profile with a name
// TODO: augment address with hostname, ...
type ConnectionProfileModel struct {
Scheme types.String `tfsdk:"scheme"`
Name types.String `tfsdk:"name"`
Hostname types.String `tfsdk:"hostname"`
Username types.String `tfsdk:"username"`
Expand Down Expand Up @@ -88,6 +89,10 @@ func (p *ONTAPProvider) Schema(ctx context.Context, req provider.SchemaRequest,
MarkdownDescription: "Profile name",
Required: true,
},
"scheme": schema.StringAttribute{
MarkdownDescription: "URL Scheme to be used to build the ONTAP management interface URL, defaults to https",
Optional: true,
},
"hostname": schema.StringAttribute{
MarkdownDescription: "ONTAP management interface IP address or name. For AWS Lambda, the management endpoints for the FSxN system.",
Required: true,
Expand Down Expand Up @@ -173,6 +178,7 @@ func (p *ONTAPProvider) Configure(ctx context.Context, req provider.ConfigureReq
validateCerts = connectionProfile.ValidateCerts.ValueBool()
}
connectionProfiles[connectionProfile.Name.ValueString()] = connection.Profile{
Scheme: connectionProfile.Scheme.ValueString(),
Hostname: connectionProfile.Hostname.ValueString(),
Username: connectionProfile.Username.ValueString(),
Password: connectionProfile.Password.ValueString(),
Expand Down
1 change: 1 addition & 0 deletions internal/restclient/httpclient/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ type HTTPClient struct {

// HTTPProfile defines the connection attributes to build the base URL and authentication header
type HTTPProfile struct {
Scheme string
APIRoot string
Hostname string
Username string
Expand Down
2 changes: 1 addition & 1 deletion internal/restclient/httpclient/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (r *Request) BuildURL(c *HTTPClient, baseURL string, uuid string) (string,
return "", err
}
u := &url.URL{
Scheme: "https",
Scheme: c.cxProfile.Scheme,
Host: c.cxProfile.Hostname,
Path: c.cxProfile.APIRoot,
}
Expand Down
2 changes: 2 additions & 0 deletions internal/restclient/httpclient/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

func TestRequest_BuildURL(t *testing.T) {
cxProfile := HTTPProfile{
Scheme: "https",
Hostname: "host",
APIRoot: "api",
}
Expand Down Expand Up @@ -62,6 +63,7 @@ func TestRequest_BuildURL(t *testing.T) {

func TestRequest_BuildHTTPReq(t *testing.T) {
cxProfile := HTTPProfile{
Scheme: "https",
Hostname: "host",
APIRoot: "api",
}
Expand Down
4 changes: 4 additions & 0 deletions internal/restclient/rest_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
type ConnectionProfile struct {
// TODO: add certs in addition to basic authentication
// TODO: Add Timeout (currently hardcoded to 10 seconds)
Scheme string
Hostname string
Username string
Password string
Expand Down Expand Up @@ -219,6 +220,9 @@ func NewClient(ctx context.Context, cxProfile ConnectionProfile, tag string, job
return nil, errors.New(msg)
}
httpProfile.APIRoot = "api"
if httpProfile.Scheme == "" {
httpProfile.Scheme = "https"
}
maxConcurrentRequests := cxProfile.MaxConcurrentRequests
if maxConcurrentRequests == 0 {
maxConcurrentRequests = 6
Expand Down