This commit is contained in:
asteam
2024-08-23 16:55:50 +03:00
parent 6f40af6a5f
commit 003e4d656e
524 changed files with 43376 additions and 432 deletions

View File

@@ -65,7 +65,7 @@ func (p *DynamixProvider) Schema(_ context.Context, _ provider.SchemaRequest, re
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
"authenticator": schema.StringAttribute{
MarkdownDescription: "Authentication mode to use when connecting to DECORT cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'.",
MarkdownDescription: "Authentication mode to use when connecting to DYNAMIX cloud API. Should be one of 'decs3o', 'legacy', 'jwt' or 'bvs'.",
Required: true,
Validators: []validator.String{
stringvalidator.OneOfCaseInsensitive("decs3o", "legacy", "jwt", "bvs"), // ignore case while validating
@@ -76,43 +76,43 @@ func (p *DynamixProvider) Schema(_ context.Context, _ provider.SchemaRequest, re
Optional: true,
},
"controller_url": schema.StringAttribute{
MarkdownDescription: "URL of DECORT Cloud controller to use. API calls will be directed to this URL.",
MarkdownDescription: "URL of DYNAMIX Cloud controller to use. API calls will be directed to this URL.",
Required: true,
},
"user": schema.StringAttribute{
MarkdownDescription: "User name for DECORT cloud API operations in 'legacy' authentication mode.",
MarkdownDescription: "User name for DYNAMIX cloud API operations in 'legacy' authentication mode.",
Optional: true,
},
"password": schema.StringAttribute{
MarkdownDescription: "User password for DECORT cloud API operations in 'legacy' authentication mode.",
MarkdownDescription: "User password for DYNAMIX cloud API operations in 'legacy' authentication mode.",
Optional: true,
},
"bvs_user": schema.StringAttribute{
MarkdownDescription: "User name for DECORT cloud API operations in 'bvs' authentication mode.",
MarkdownDescription: "User name for DYNAMIX cloud API operations in 'bvs' authentication mode.",
Optional: true,
},
"bvs_password": schema.StringAttribute{
MarkdownDescription: "User password for DECORT cloud API operations in 'bvs' authentication mode.",
MarkdownDescription: "User password for DYNAMIX cloud API operations in 'bvs' authentication mode.",
Optional: true,
},
"domain": schema.StringAttribute{
MarkdownDescription: "User password for DECORT cloud API operations in 'bvs' authentication mode.",
MarkdownDescription: "User password for DYNAMIX cloud API operations in 'bvs' authentication mode.",
Optional: true,
},
"app_id": schema.StringAttribute{
MarkdownDescription: "Application ID to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.",
MarkdownDescription: "Application ID to access DYNAMIX cloud API in 'decs3o' and 'bvs' authentication mode.",
Optional: true,
},
"app_secret": schema.StringAttribute{
MarkdownDescription: "Application secret to access DECORT cloud API in 'decs3o' and 'bvs' authentication mode.",
MarkdownDescription: "Application secret to access DYNAMIX cloud API in 'decs3o' and 'bvs' authentication mode.",
Optional: true,
},
"jwt": schema.StringAttribute{
MarkdownDescription: "JWT to access DECORT cloud API in 'jwt' authentication mode.",
MarkdownDescription: "JWT to access DYNAMIX cloud API in 'jwt' authentication mode.",
Optional: true,
},
"allow_unverified_ssl": schema.BoolAttribute{
MarkdownDescription: "If true, DECORT API will not verify SSL certificates. Use this with caution and in trusted environments only! Default is false.",
MarkdownDescription: "If true, DYNAMIX API will not verify SSL certificates. Use this with caution and in trusted environments only! Default is false.",
Optional: true,
},
"path_config": schema.StringAttribute{
@@ -137,7 +137,8 @@ func (p *DynamixProvider) Configure(ctx context.Context, req provider.ConfigureR
diags := req.Config.Get(ctx, &config)
resp.Diagnostics.Append(diags...)
if resp.Diagnostics.HasError() {
log.Debugf("Provider Configure error after req.Config.Get")
resp.Diagnostics.AddError("Provider Configure: ", "error after req.Config.Get")
log.Error("Provider Configure error after req.Config.Get")
return
}
@@ -148,7 +149,8 @@ func (p *DynamixProvider) Configure(ctx context.Context, req provider.ConfigureR
// Validate and set up authentication mode
mode, err := dynamixConfig.validateAuthenticator()
if err != nil {
log.Debug(err)
log.Error(err)
resp.Diagnostics.AddError("Provider Configure: validate error:", err.Error())
return
}