chore: remove generated files from repo
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 7m32s
CI Workflow / CI (pull_request) Failing after 9m49s
CI Workflow / Code coverage report (pull_request) Has been skipped
Some checks failed
CI Workflow / Check GoReleaser config (pull_request) Successful in 5s
CI Workflow / Test readiness for publishing provider (pull_request) Failing after 7m32s
CI Workflow / CI (pull_request) Failing after 9m49s
CI Workflow / Code coverage report (pull_request) Has been skipped
This commit is contained in:
parent
68e4c137f1
commit
0ce3804393
35 changed files with 2 additions and 34290 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -46,3 +46,5 @@ dist
|
||||||
|
|
||||||
pkg_gen
|
pkg_gen
|
||||||
/release/
|
/release/
|
||||||
|
**/datasources_gen**
|
||||||
|
**/resources_gen**
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"database_id": schema.Int64Attribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the database.",
|
|
||||||
MarkdownDescription: "The ID of the database.",
|
|
||||||
},
|
|
||||||
"tf_original_api_id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
DatabaseId types.Int64 `tfsdk:"database_id"`
|
|
||||||
Id types.Int64 `tfsdk:"tf_original_api_id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,74 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"database_id": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the database.",
|
|
||||||
MarkdownDescription: "The ID of the database.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
DatabaseId types.Int64 `tfsdk:"database_id"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,52 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RolesDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"roles": schema.ListAttribute{
|
|
||||||
ElementType: types.StringType,
|
|
||||||
Computed: true,
|
|
||||||
Description: "List of all role names available in the instance",
|
|
||||||
MarkdownDescription: "List of all role names available in the instance",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type RolesModel struct {
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Roles types.List `tfsdk:"roles"`
|
|
||||||
}
|
|
||||||
|
|
@ -1,76 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UserDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"tf_original_api_id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the user.",
|
|
||||||
MarkdownDescription: "The name of the user.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"roles": schema.ListAttribute{
|
|
||||||
ElementType: types.StringType,
|
|
||||||
Computed: true,
|
|
||||||
Description: "A list of user roles.",
|
|
||||||
MarkdownDescription: "A list of user roles.",
|
|
||||||
},
|
|
||||||
"status": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The current status of the user.",
|
|
||||||
MarkdownDescription: "The current status of the user.",
|
|
||||||
},
|
|
||||||
"user_id": schema.Int64Attribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
|
||||||
Id types.Int64 `tfsdk:"tf_original_api_id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Roles types.List `tfsdk:"roles"`
|
|
||||||
Status types.String `tfsdk:"status"`
|
|
||||||
UserId types.Int64 `tfsdk:"user_id"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,93 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UserResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"connection_string": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The connection string for the user to the instance.",
|
|
||||||
MarkdownDescription: "The connection string for the user to the instance.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the user.",
|
|
||||||
MarkdownDescription: "The name of the user.",
|
|
||||||
},
|
|
||||||
"password": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The password for the user.",
|
|
||||||
MarkdownDescription: "The password for the user.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"roles": schema.ListAttribute{
|
|
||||||
ElementType: types.StringType,
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "A list containing the user roles for the instance.",
|
|
||||||
MarkdownDescription: "A list containing the user roles for the instance.",
|
|
||||||
},
|
|
||||||
"status": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The current status of the user.",
|
|
||||||
MarkdownDescription: "The current status of the user.",
|
|
||||||
},
|
|
||||||
"user_id": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
|
||||||
ConnectionString types.String `tfsdk:"connection_string"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Password types.String `tfsdk:"password"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Roles types.List `tfsdk:"roles"`
|
|
||||||
Status types.String `tfsdk:"status"`
|
|
||||||
UserId types.Int64 `tfsdk:"user_id"`
|
|
||||||
}
|
|
||||||
|
|
@ -1,569 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package postgresflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
|
||||||
"github.com/hashicorp/terraform-plugin-go/tftypes"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func VersionsDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"versions": schema.ListNestedAttribute{
|
|
||||||
NestedObject: schema.NestedAttributeObject{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"beta": schema.BoolAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.",
|
|
||||||
MarkdownDescription: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.",
|
|
||||||
},
|
|
||||||
"deprecated": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.",
|
|
||||||
MarkdownDescription: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.",
|
|
||||||
},
|
|
||||||
"recommend": schema.BoolAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Flag if the version is recommend by the STACKIT Team.",
|
|
||||||
MarkdownDescription: "Flag if the version is recommend by the STACKIT Team.",
|
|
||||||
},
|
|
||||||
"version": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The postgres version used for the instance.",
|
|
||||||
MarkdownDescription: "The postgres version used for the instance.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
CustomType: VersionsType{
|
|
||||||
ObjectType: types.ObjectType{
|
|
||||||
AttrTypes: VersionsValue{}.AttributeTypes(ctx),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Computed: true,
|
|
||||||
Description: "A list containing available postgres versions.",
|
|
||||||
MarkdownDescription: "A list containing available postgres versions.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type VersionsModel struct {
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Versions types.List `tfsdk:"versions"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ basetypes.ObjectTypable = VersionsType{}
|
|
||||||
|
|
||||||
type VersionsType struct {
|
|
||||||
basetypes.ObjectType
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) Equal(o attr.Type) bool {
|
|
||||||
other, ok := o.(VersionsType)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return t.ObjectType.Equal(other.ObjectType)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) String() string {
|
|
||||||
return "VersionsType"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
attributes := in.Attributes()
|
|
||||||
|
|
||||||
betaAttribute, ok := attributes["beta"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`beta is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaVal, ok := betaAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedAttribute, ok := attributes["deprecated"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`deprecated is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendAttribute, ok := attributes["recommend"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`recommend is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendVal, ok := recommendAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
versionAttribute, ok := attributes["version"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`version is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
versionVal, ok := versionAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
return VersionsValue{
|
|
||||||
Beta: betaVal,
|
|
||||||
Deprecated: deprecatedVal,
|
|
||||||
Recommend: recommendVal,
|
|
||||||
Version: versionVal,
|
|
||||||
state: attr.ValueStateKnown,
|
|
||||||
}, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueNull() VersionsValue {
|
|
||||||
return VersionsValue{
|
|
||||||
state: attr.ValueStateNull,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueUnknown() VersionsValue {
|
|
||||||
return VersionsValue{
|
|
||||||
state: attr.ValueStateUnknown,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (VersionsValue, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
for name, attributeType := range attributeTypes {
|
|
||||||
attribute, ok := attributes[name]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Missing VersionsValue Attribute Value",
|
|
||||||
"While creating a VersionsValue value, a missing attribute value was detected. "+
|
|
||||||
"A VersionsValue must contain values for all attributes, even if null or unknown. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
|
|
||||||
)
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if !attributeType.Equal(attribute.Type(ctx)) {
|
|
||||||
diags.AddError(
|
|
||||||
"Invalid VersionsValue Attribute Type",
|
|
||||||
"While creating a VersionsValue value, an invalid attribute value was detected. "+
|
|
||||||
"A VersionsValue must use a matching attribute type for the value. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for name := range attributes {
|
|
||||||
_, ok := attributeTypes[name]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Extra VersionsValue Attribute Value",
|
|
||||||
"While creating a VersionsValue value, an extra attribute value was detected. "+
|
|
||||||
"A VersionsValue must not contain values beyond the expected attribute types. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("Extra VersionsValue Attribute Name: %s", name),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaAttribute, ok := attributes["beta"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`beta is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaVal, ok := betaAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedAttribute, ok := attributes["deprecated"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`deprecated is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendAttribute, ok := attributes["recommend"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`recommend is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendVal, ok := recommendAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
versionAttribute, ok := attributes["version"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`version is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
versionVal, ok := versionAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
return VersionsValue{
|
|
||||||
Beta: betaVal,
|
|
||||||
Deprecated: deprecatedVal,
|
|
||||||
Recommend: recommendVal,
|
|
||||||
Version: versionVal,
|
|
||||||
state: attr.ValueStateKnown,
|
|
||||||
}, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) VersionsValue {
|
|
||||||
object, diags := NewVersionsValue(attributeTypes, attributes)
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
// This could potentially be added to the diag package.
|
|
||||||
diagsStrings := make([]string, 0, len(diags))
|
|
||||||
|
|
||||||
for _, diagnostic := range diags {
|
|
||||||
diagsStrings = append(diagsStrings, fmt.Sprintf(
|
|
||||||
"%s | %s | %s",
|
|
||||||
diagnostic.Severity(),
|
|
||||||
diagnostic.Summary(),
|
|
||||||
diagnostic.Detail()))
|
|
||||||
}
|
|
||||||
|
|
||||||
panic("NewVersionsValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
|
|
||||||
if in.Type() == nil {
|
|
||||||
return NewVersionsValueNull(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !in.Type().Equal(t.TerraformType(ctx)) {
|
|
||||||
return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
|
|
||||||
}
|
|
||||||
|
|
||||||
if !in.IsKnown() {
|
|
||||||
return NewVersionsValueUnknown(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if in.IsNull() {
|
|
||||||
return NewVersionsValueNull(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes := map[string]attr.Value{}
|
|
||||||
|
|
||||||
val := map[string]tftypes.Value{}
|
|
||||||
|
|
||||||
err := in.As(&val)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range val {
|
|
||||||
a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[k] = a
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewVersionsValueMust(VersionsValue{}.AttributeTypes(ctx), attributes), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueType(ctx context.Context) attr.Value {
|
|
||||||
return VersionsValue{}
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ basetypes.ObjectValuable = VersionsValue{}
|
|
||||||
|
|
||||||
type VersionsValue struct {
|
|
||||||
Beta basetypes.BoolValue `tfsdk:"beta"`
|
|
||||||
Deprecated basetypes.StringValue `tfsdk:"deprecated"`
|
|
||||||
Recommend basetypes.BoolValue `tfsdk:"recommend"`
|
|
||||||
Version basetypes.StringValue `tfsdk:"version"`
|
|
||||||
state attr.ValueState
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
|
|
||||||
attrTypes := make(map[string]tftypes.Type, 4)
|
|
||||||
|
|
||||||
var val tftypes.Value
|
|
||||||
var err error
|
|
||||||
|
|
||||||
attrTypes["beta"] = basetypes.BoolType{}.TerraformType(ctx)
|
|
||||||
attrTypes["deprecated"] = basetypes.StringType{}.TerraformType(ctx)
|
|
||||||
attrTypes["recommend"] = basetypes.BoolType{}.TerraformType(ctx)
|
|
||||||
attrTypes["version"] = basetypes.StringType{}.TerraformType(ctx)
|
|
||||||
|
|
||||||
objectType := tftypes.Object{AttributeTypes: attrTypes}
|
|
||||||
|
|
||||||
switch v.state {
|
|
||||||
case attr.ValueStateKnown:
|
|
||||||
vals := make(map[string]tftypes.Value, 4)
|
|
||||||
|
|
||||||
val, err = v.Beta.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["beta"] = val
|
|
||||||
|
|
||||||
val, err = v.Deprecated.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["deprecated"] = val
|
|
||||||
|
|
||||||
val, err = v.Recommend.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["recommend"] = val
|
|
||||||
|
|
||||||
val, err = v.Version.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["version"] = val
|
|
||||||
|
|
||||||
if err := tftypes.ValidateValue(objectType, vals); err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
return tftypes.NewValue(objectType, vals), nil
|
|
||||||
case attr.ValueStateNull:
|
|
||||||
return tftypes.NewValue(objectType, nil), nil
|
|
||||||
case attr.ValueStateUnknown:
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
|
|
||||||
default:
|
|
||||||
panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) IsNull() bool {
|
|
||||||
return v.state == attr.ValueStateNull
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) IsUnknown() bool {
|
|
||||||
return v.state == attr.ValueStateUnknown
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) String() string {
|
|
||||||
return "VersionsValue"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
attributeTypes := map[string]attr.Type{
|
|
||||||
"beta": basetypes.BoolType{},
|
|
||||||
"deprecated": basetypes.StringType{},
|
|
||||||
"recommend": basetypes.BoolType{},
|
|
||||||
"version": basetypes.StringType{},
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.IsNull() {
|
|
||||||
return types.ObjectNull(attributeTypes), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.IsUnknown() {
|
|
||||||
return types.ObjectUnknown(attributeTypes), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
objVal, diags := types.ObjectValue(
|
|
||||||
attributeTypes,
|
|
||||||
map[string]attr.Value{
|
|
||||||
"beta": v.Beta,
|
|
||||||
"deprecated": v.Deprecated,
|
|
||||||
"recommend": v.Recommend,
|
|
||||||
"version": v.Version,
|
|
||||||
})
|
|
||||||
|
|
||||||
return objVal, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) Equal(o attr.Value) bool {
|
|
||||||
other, ok := o.(VersionsValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.state != other.state {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.state != attr.ValueStateKnown {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Beta.Equal(other.Beta) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Deprecated.Equal(other.Deprecated) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Recommend.Equal(other.Recommend) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Version.Equal(other.Version) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) Type(ctx context.Context) attr.Type {
|
|
||||||
return VersionsType{
|
|
||||||
basetypes.ObjectType{
|
|
||||||
AttrTypes: v.AttributeTypes(ctx),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
|
|
||||||
return map[string]attr.Type{
|
|
||||||
"beta": basetypes.BoolType{},
|
|
||||||
"deprecated": basetypes.StringType{},
|
|
||||||
"recommend": basetypes.BoolType{},
|
|
||||||
"version": basetypes.StringType{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"collation_name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"compatibility_level": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"database_name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"tf_original_api_id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
CollationName types.String `tfsdk:"collation_name"`
|
|
||||||
CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"`
|
|
||||||
DatabaseName types.String `tfsdk:"database_name"`
|
|
||||||
Id types.Int64 `tfsdk:"tf_original_api_id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,99 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"collation": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"collation_name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"compatibility": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"compatibility_level": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"database_name": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
Collation types.String `tfsdk:"collation"`
|
|
||||||
CollationName types.String `tfsdk:"collation_name"`
|
|
||||||
Compatibility types.Int64 `tfsdk:"compatibility"`
|
|
||||||
CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"`
|
|
||||||
DatabaseName types.String `tfsdk:"database_name"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,111 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexalpha
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UserResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"default_database": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The default database for a user of the instance.",
|
|
||||||
MarkdownDescription: "The default database for a user of the instance.",
|
|
||||||
},
|
|
||||||
"host": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The host of the instance in which the user belongs to.",
|
|
||||||
MarkdownDescription: "The host of the instance in which the user belongs to.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"password": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The password for the user.",
|
|
||||||
MarkdownDescription: "The password for the user.",
|
|
||||||
},
|
|
||||||
"port": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The port of the instance in which the user belongs to.",
|
|
||||||
MarkdownDescription: "The port of the instance in which the user belongs to.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"roles": schema.ListAttribute{
|
|
||||||
ElementType: types.StringType,
|
|
||||||
Required: true,
|
|
||||||
Description: "A list containing the user roles for the instance.",
|
|
||||||
MarkdownDescription: "A list containing the user roles for the instance.",
|
|
||||||
},
|
|
||||||
"status": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The current status of the user.",
|
|
||||||
MarkdownDescription: "The current status of the user.",
|
|
||||||
},
|
|
||||||
"uri": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The connection string for the user to the instance.",
|
|
||||||
MarkdownDescription: "The connection string for the user to the instance.",
|
|
||||||
},
|
|
||||||
"user_id": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"username": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the user.",
|
|
||||||
MarkdownDescription: "The name of the user.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
|
||||||
DefaultDatabase types.String `tfsdk:"default_database"`
|
|
||||||
Host types.String `tfsdk:"host"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Password types.String `tfsdk:"password"`
|
|
||||||
Port types.Int64 `tfsdk:"port"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Roles types.List `tfsdk:"roles"`
|
|
||||||
Status types.String `tfsdk:"status"`
|
|
||||||
Uri types.String `tfsdk:"uri"`
|
|
||||||
UserId types.Int64 `tfsdk:"user_id"`
|
|
||||||
Username types.String `tfsdk:"username"`
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexbeta
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"collation_name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"compatibility_level": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"database_name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"tf_original_api_id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
CollationName types.String `tfsdk:"collation_name"`
|
|
||||||
CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"`
|
|
||||||
DatabaseName types.String `tfsdk:"database_name"`
|
|
||||||
Id types.Int64 `tfsdk:"tf_original_api_id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,99 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexbeta
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func DatabaseResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"collation": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"collation_name": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
MarkdownDescription: "The collation of the database. This database collation should match the *collation_name* of one of the collations given by the **Get database collation list** endpoint.",
|
|
||||||
},
|
|
||||||
"compatibility": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"compatibility_level": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "CompatibilityLevel of the Database.",
|
|
||||||
MarkdownDescription: "CompatibilityLevel of the Database.",
|
|
||||||
},
|
|
||||||
"database_name": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The id of the database.",
|
|
||||||
MarkdownDescription: "The id of the database.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"name": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the database.",
|
|
||||||
MarkdownDescription: "The name of the database.",
|
|
||||||
},
|
|
||||||
"owner": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The owner of the database.",
|
|
||||||
MarkdownDescription: "The owner of the database.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type DatabaseModel struct {
|
|
||||||
Collation types.String `tfsdk:"collation"`
|
|
||||||
CollationName types.String `tfsdk:"collation_name"`
|
|
||||||
Compatibility types.Int64 `tfsdk:"compatibility"`
|
|
||||||
CompatibilityLevel types.Int64 `tfsdk:"compatibility_level"`
|
|
||||||
DatabaseName types.String `tfsdk:"database_name"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Name types.String `tfsdk:"name"`
|
|
||||||
Owner types.String `tfsdk:"owner"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,111 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexbeta
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func UserResourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"default_database": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The default database for a user of the instance.",
|
|
||||||
MarkdownDescription: "The default database for a user of the instance.",
|
|
||||||
},
|
|
||||||
"host": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The host of the instance in which the user belongs to.",
|
|
||||||
MarkdownDescription: "The host of the instance in which the user belongs to.",
|
|
||||||
},
|
|
||||||
"id": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"instance_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the instance.",
|
|
||||||
MarkdownDescription: "The ID of the instance.",
|
|
||||||
},
|
|
||||||
"password": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The password for the user.",
|
|
||||||
MarkdownDescription: "The password for the user.",
|
|
||||||
},
|
|
||||||
"port": schema.Int64Attribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The port of the instance in which the user belongs to.",
|
|
||||||
MarkdownDescription: "The port of the instance in which the user belongs to.",
|
|
||||||
},
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"roles": schema.ListAttribute{
|
|
||||||
ElementType: types.StringType,
|
|
||||||
Required: true,
|
|
||||||
Description: "A list containing the user roles for the instance.",
|
|
||||||
MarkdownDescription: "A list containing the user roles for the instance.",
|
|
||||||
},
|
|
||||||
"status": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The current status of the user.",
|
|
||||||
MarkdownDescription: "The current status of the user.",
|
|
||||||
},
|
|
||||||
"uri": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The connection string for the user to the instance.",
|
|
||||||
MarkdownDescription: "The connection string for the user to the instance.",
|
|
||||||
},
|
|
||||||
"user_id": schema.Int64Attribute{
|
|
||||||
Optional: true,
|
|
||||||
Computed: true,
|
|
||||||
Description: "The ID of the user.",
|
|
||||||
MarkdownDescription: "The ID of the user.",
|
|
||||||
},
|
|
||||||
"username": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The name of the user.",
|
|
||||||
MarkdownDescription: "The name of the user.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type UserModel struct {
|
|
||||||
DefaultDatabase types.String `tfsdk:"default_database"`
|
|
||||||
Host types.String `tfsdk:"host"`
|
|
||||||
Id types.Int64 `tfsdk:"id"`
|
|
||||||
InstanceId types.String `tfsdk:"instance_id"`
|
|
||||||
Password types.String `tfsdk:"password"`
|
|
||||||
Port types.Int64 `tfsdk:"port"`
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Roles types.List `tfsdk:"roles"`
|
|
||||||
Status types.String `tfsdk:"status"`
|
|
||||||
Uri types.String `tfsdk:"uri"`
|
|
||||||
UserId types.Int64 `tfsdk:"user_id"`
|
|
||||||
Username types.String `tfsdk:"username"`
|
|
||||||
}
|
|
||||||
|
|
@ -1,569 +0,0 @@
|
||||||
// Code generated by terraform-plugin-framework-generator DO NOT EDIT.
|
|
||||||
|
|
||||||
package sqlserverflexbeta
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/attr"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/diag"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types"
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
|
|
||||||
"github.com/hashicorp/terraform-plugin-go/tftypes"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
|
|
||||||
)
|
|
||||||
|
|
||||||
func VersionDataSourceSchema(ctx context.Context) schema.Schema {
|
|
||||||
return schema.Schema{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"project_id": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The STACKIT project ID.",
|
|
||||||
MarkdownDescription: "The STACKIT project ID.",
|
|
||||||
},
|
|
||||||
"region": schema.StringAttribute{
|
|
||||||
Required: true,
|
|
||||||
Description: "The region which should be addressed",
|
|
||||||
MarkdownDescription: "The region which should be addressed",
|
|
||||||
Validators: []validator.String{
|
|
||||||
stringvalidator.OneOf(
|
|
||||||
"eu01",
|
|
||||||
),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"versions": schema.ListNestedAttribute{
|
|
||||||
NestedObject: schema.NestedAttributeObject{
|
|
||||||
Attributes: map[string]schema.Attribute{
|
|
||||||
"beta": schema.BoolAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.",
|
|
||||||
MarkdownDescription: "Flag if the version is a beta version. If set the version may contain bugs and is not fully tested.",
|
|
||||||
},
|
|
||||||
"deprecated": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.",
|
|
||||||
MarkdownDescription: "Timestamp in RFC3339 format which says when the version will no longer be supported by STACKIT.",
|
|
||||||
},
|
|
||||||
"recommend": schema.BoolAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "Flag if the version is recommend by the STACKIT Team.",
|
|
||||||
MarkdownDescription: "Flag if the version is recommend by the STACKIT Team.",
|
|
||||||
},
|
|
||||||
"version": schema.StringAttribute{
|
|
||||||
Computed: true,
|
|
||||||
Description: "The sqlserver version used for the instance.",
|
|
||||||
MarkdownDescription: "The sqlserver version used for the instance.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
CustomType: VersionsType{
|
|
||||||
ObjectType: types.ObjectType{
|
|
||||||
AttrTypes: VersionsValue{}.AttributeTypes(ctx),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Computed: true,
|
|
||||||
Description: "A list containing available sqlserver versions.",
|
|
||||||
MarkdownDescription: "A list containing available sqlserver versions.",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type VersionModel struct {
|
|
||||||
ProjectId types.String `tfsdk:"project_id"`
|
|
||||||
Region types.String `tfsdk:"region"`
|
|
||||||
Versions types.List `tfsdk:"versions"`
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ basetypes.ObjectTypable = VersionsType{}
|
|
||||||
|
|
||||||
type VersionsType struct {
|
|
||||||
basetypes.ObjectType
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) Equal(o attr.Type) bool {
|
|
||||||
other, ok := o.(VersionsType)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return t.ObjectType.Equal(other.ObjectType)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) String() string {
|
|
||||||
return "VersionsType"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueFromObject(ctx context.Context, in basetypes.ObjectValue) (basetypes.ObjectValuable, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
attributes := in.Attributes()
|
|
||||||
|
|
||||||
betaAttribute, ok := attributes["beta"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`beta is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaVal, ok := betaAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedAttribute, ok := attributes["deprecated"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`deprecated is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendAttribute, ok := attributes["recommend"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`recommend is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendVal, ok := recommendAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
versionAttribute, ok := attributes["version"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`version is missing from object`)
|
|
||||||
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
versionVal, ok := versionAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return nil, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
return VersionsValue{
|
|
||||||
Beta: betaVal,
|
|
||||||
Deprecated: deprecatedVal,
|
|
||||||
Recommend: recommendVal,
|
|
||||||
Version: versionVal,
|
|
||||||
state: attr.ValueStateKnown,
|
|
||||||
}, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueNull() VersionsValue {
|
|
||||||
return VersionsValue{
|
|
||||||
state: attr.ValueStateNull,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueUnknown() VersionsValue {
|
|
||||||
return VersionsValue{
|
|
||||||
state: attr.ValueStateUnknown,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValue(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) (VersionsValue, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
// Reference: https://github.com/hashicorp/terraform-plugin-framework/issues/521
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
for name, attributeType := range attributeTypes {
|
|
||||||
attribute, ok := attributes[name]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Missing VersionsValue Attribute Value",
|
|
||||||
"While creating a VersionsValue value, a missing attribute value was detected. "+
|
|
||||||
"A VersionsValue must contain values for all attributes, even if null or unknown. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s", name, attributeType.String()),
|
|
||||||
)
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if !attributeType.Equal(attribute.Type(ctx)) {
|
|
||||||
diags.AddError(
|
|
||||||
"Invalid VersionsValue Attribute Type",
|
|
||||||
"While creating a VersionsValue value, an invalid attribute value was detected. "+
|
|
||||||
"A VersionsValue must use a matching attribute type for the value. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Expected Type: %s\n", name, attributeType.String())+
|
|
||||||
fmt.Sprintf("VersionsValue Attribute Name (%s) Given Type: %s", name, attribute.Type(ctx)),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for name := range attributes {
|
|
||||||
_, ok := attributeTypes[name]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Extra VersionsValue Attribute Value",
|
|
||||||
"While creating a VersionsValue value, an extra attribute value was detected. "+
|
|
||||||
"A VersionsValue must not contain values beyond the expected attribute types. "+
|
|
||||||
"This is always an issue with the provider and should be reported to the provider developers.\n\n"+
|
|
||||||
fmt.Sprintf("Extra VersionsValue Attribute Name: %s", name),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaAttribute, ok := attributes["beta"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`beta is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
betaVal, ok := betaAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`beta expected to be basetypes.BoolValue, was: %T`, betaAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedAttribute, ok := attributes["deprecated"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`deprecated is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecatedVal, ok := deprecatedAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`deprecated expected to be basetypes.StringValue, was: %T`, deprecatedAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendAttribute, ok := attributes["recommend"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`recommend is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
recommendVal, ok := recommendAttribute.(basetypes.BoolValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`recommend expected to be basetypes.BoolValue, was: %T`, recommendAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
versionAttribute, ok := attributes["version"]
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Missing",
|
|
||||||
`version is missing from object`)
|
|
||||||
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
versionVal, ok := versionAttribute.(basetypes.StringValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
diags.AddError(
|
|
||||||
"Attribute Wrong Type",
|
|
||||||
fmt.Sprintf(`version expected to be basetypes.StringValue, was: %T`, versionAttribute))
|
|
||||||
}
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
return NewVersionsValueUnknown(), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
return VersionsValue{
|
|
||||||
Beta: betaVal,
|
|
||||||
Deprecated: deprecatedVal,
|
|
||||||
Recommend: recommendVal,
|
|
||||||
Version: versionVal,
|
|
||||||
state: attr.ValueStateKnown,
|
|
||||||
}, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewVersionsValueMust(attributeTypes map[string]attr.Type, attributes map[string]attr.Value) VersionsValue {
|
|
||||||
object, diags := NewVersionsValue(attributeTypes, attributes)
|
|
||||||
|
|
||||||
if diags.HasError() {
|
|
||||||
// This could potentially be added to the diag package.
|
|
||||||
diagsStrings := make([]string, 0, len(diags))
|
|
||||||
|
|
||||||
for _, diagnostic := range diags {
|
|
||||||
diagsStrings = append(diagsStrings, fmt.Sprintf(
|
|
||||||
"%s | %s | %s",
|
|
||||||
diagnostic.Severity(),
|
|
||||||
diagnostic.Summary(),
|
|
||||||
diagnostic.Detail()))
|
|
||||||
}
|
|
||||||
|
|
||||||
panic("NewVersionsValueMust received error(s): " + strings.Join(diagsStrings, "\n"))
|
|
||||||
}
|
|
||||||
|
|
||||||
return object
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueFromTerraform(ctx context.Context, in tftypes.Value) (attr.Value, error) {
|
|
||||||
if in.Type() == nil {
|
|
||||||
return NewVersionsValueNull(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if !in.Type().Equal(t.TerraformType(ctx)) {
|
|
||||||
return nil, fmt.Errorf("expected %s, got %s", t.TerraformType(ctx), in.Type())
|
|
||||||
}
|
|
||||||
|
|
||||||
if !in.IsKnown() {
|
|
||||||
return NewVersionsValueUnknown(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if in.IsNull() {
|
|
||||||
return NewVersionsValueNull(), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes := map[string]attr.Value{}
|
|
||||||
|
|
||||||
val := map[string]tftypes.Value{}
|
|
||||||
|
|
||||||
err := in.As(&val)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v := range val {
|
|
||||||
a, err := t.AttrTypes[k].ValueFromTerraform(ctx, v)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[k] = a
|
|
||||||
}
|
|
||||||
|
|
||||||
return NewVersionsValueMust(VersionsValue{}.AttributeTypes(ctx), attributes), nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t VersionsType) ValueType(ctx context.Context) attr.Value {
|
|
||||||
return VersionsValue{}
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ basetypes.ObjectValuable = VersionsValue{}
|
|
||||||
|
|
||||||
type VersionsValue struct {
|
|
||||||
Beta basetypes.BoolValue `tfsdk:"beta"`
|
|
||||||
Deprecated basetypes.StringValue `tfsdk:"deprecated"`
|
|
||||||
Recommend basetypes.BoolValue `tfsdk:"recommend"`
|
|
||||||
Version basetypes.StringValue `tfsdk:"version"`
|
|
||||||
state attr.ValueState
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) ToTerraformValue(ctx context.Context) (tftypes.Value, error) {
|
|
||||||
attrTypes := make(map[string]tftypes.Type, 4)
|
|
||||||
|
|
||||||
var val tftypes.Value
|
|
||||||
var err error
|
|
||||||
|
|
||||||
attrTypes["beta"] = basetypes.BoolType{}.TerraformType(ctx)
|
|
||||||
attrTypes["deprecated"] = basetypes.StringType{}.TerraformType(ctx)
|
|
||||||
attrTypes["recommend"] = basetypes.BoolType{}.TerraformType(ctx)
|
|
||||||
attrTypes["version"] = basetypes.StringType{}.TerraformType(ctx)
|
|
||||||
|
|
||||||
objectType := tftypes.Object{AttributeTypes: attrTypes}
|
|
||||||
|
|
||||||
switch v.state {
|
|
||||||
case attr.ValueStateKnown:
|
|
||||||
vals := make(map[string]tftypes.Value, 4)
|
|
||||||
|
|
||||||
val, err = v.Beta.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["beta"] = val
|
|
||||||
|
|
||||||
val, err = v.Deprecated.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["deprecated"] = val
|
|
||||||
|
|
||||||
val, err = v.Recommend.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["recommend"] = val
|
|
||||||
|
|
||||||
val, err = v.Version.ToTerraformValue(ctx)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
vals["version"] = val
|
|
||||||
|
|
||||||
if err := tftypes.ValidateValue(objectType, vals); err != nil {
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), err
|
|
||||||
}
|
|
||||||
|
|
||||||
return tftypes.NewValue(objectType, vals), nil
|
|
||||||
case attr.ValueStateNull:
|
|
||||||
return tftypes.NewValue(objectType, nil), nil
|
|
||||||
case attr.ValueStateUnknown:
|
|
||||||
return tftypes.NewValue(objectType, tftypes.UnknownValue), nil
|
|
||||||
default:
|
|
||||||
panic(fmt.Sprintf("unhandled Object state in ToTerraformValue: %s", v.state))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) IsNull() bool {
|
|
||||||
return v.state == attr.ValueStateNull
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) IsUnknown() bool {
|
|
||||||
return v.state == attr.ValueStateUnknown
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) String() string {
|
|
||||||
return "VersionsValue"
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) ToObjectValue(ctx context.Context) (basetypes.ObjectValue, diag.Diagnostics) {
|
|
||||||
var diags diag.Diagnostics
|
|
||||||
|
|
||||||
attributeTypes := map[string]attr.Type{
|
|
||||||
"beta": basetypes.BoolType{},
|
|
||||||
"deprecated": basetypes.StringType{},
|
|
||||||
"recommend": basetypes.BoolType{},
|
|
||||||
"version": basetypes.StringType{},
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.IsNull() {
|
|
||||||
return types.ObjectNull(attributeTypes), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.IsUnknown() {
|
|
||||||
return types.ObjectUnknown(attributeTypes), diags
|
|
||||||
}
|
|
||||||
|
|
||||||
objVal, diags := types.ObjectValue(
|
|
||||||
attributeTypes,
|
|
||||||
map[string]attr.Value{
|
|
||||||
"beta": v.Beta,
|
|
||||||
"deprecated": v.Deprecated,
|
|
||||||
"recommend": v.Recommend,
|
|
||||||
"version": v.Version,
|
|
||||||
})
|
|
||||||
|
|
||||||
return objVal, diags
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) Equal(o attr.Value) bool {
|
|
||||||
other, ok := o.(VersionsValue)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.state != other.state {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.state != attr.ValueStateKnown {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Beta.Equal(other.Beta) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Deprecated.Equal(other.Deprecated) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Recommend.Equal(other.Recommend) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
if !v.Version.Equal(other.Version) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) Type(ctx context.Context) attr.Type {
|
|
||||||
return VersionsType{
|
|
||||||
basetypes.ObjectType{
|
|
||||||
AttrTypes: v.AttributeTypes(ctx),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (v VersionsValue) AttributeTypes(ctx context.Context) map[string]attr.Type {
|
|
||||||
return map[string]attr.Type{
|
|
||||||
"beta": basetypes.BoolType{},
|
|
||||||
"deprecated": basetypes.StringType{},
|
|
||||||
"recommend": basetypes.BoolType{},
|
|
||||||
"version": basetypes.StringType{},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue